--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/mercurial/patches/hgmanpage.patch Wed Apr 02 14:52:38 2014 -0700
@@ -0,0 +1,103 @@
+rst2man does a poor job of creating man pages that can be read on Solaris.
+Some of the changes in this patch make the Solaris *roff tools do the right
+thing:
+
+ - Getting rid of the rst2man header before the SYNOPSIS
+
+ - Changing "\(aq" to "'", and making sure that single quotes don't start
+ a line (at least in a couple of places where it's not safe)
+
+ - Changing ".ft C" and ".ft P" to simply ".ft"
+
+ - Removing "\%" and "\:"
+
+Groff also seems to have as much trouble with the .INDENT/.UNINDENT macros
+as Solaris *roff, de-indenting paragraphs that shouldn't be, so we use
+.RS/.RE instead. It's not as fancy, but seems to do the job.
+
+Applying this patch has no effect in the normal userland build (it can't
+run automatically until docutils is delivered), but it enables a "gmake
+patches/manpage.patch" to regenerate the manpages with the updated text
+(found in rst.patch) with the patched hgmanpage.py, and updates the
+manpage.patch file.
+
+--- mercurial-2.7/doc/hgmanpage.py Thu Aug 1 20:37:39 2013
++++ mercurial-2.7/doc/hgmanpage.py Mon Aug 19 14:40:04 2013
+@@ -197,6 +197,7 @@
+ self._in_docinfo = None
+ self._active_table = None
+ self._in_literal = False
++ self._in_literal_inline = False
+ self.header_written = 0
+ self._line_block = 0
+ self.authors = []
+@@ -212,15 +213,15 @@
+ # ``B`` bold, ``I`` italic, ``R`` roman should be available.
+ # Hopefully ``C`` courier too.
+ self.defs = {
+- 'indent' : ('.INDENT %.1f\n', '.UNINDENT\n'),
++ 'indent' : ('.RS %d\n', '.RE\n'),
+ 'definition_list_item' : ('.TP', ''),
+ 'field_name' : ('.TP\n.B ', '\n'),
+ 'literal' : ('\\fB', '\\fP'),
+- 'literal_block' : ('.sp\n.nf\n.ft C\n', '\n.ft P\n.fi\n'),
++ 'literal_block' : ('.sp\n.nf\n.ft\n', '\n.ft\n.fi\n'),
+
+ 'option_list_item' : ('.TP\n', ''),
+
+- 'reference' : (r'\%', r'\:'),
++ 'reference' : (r'', r''),
+ 'emphasis': ('\\fI', '\\fP'),
+ 'strong' : ('\\fB', '\\fP'),
+ 'term' : ('\n.B ', '\n'),
+@@ -267,6 +268,7 @@
+ self.body[i - 2][:4] == '.TP\n'):
+ self.body[i] = '.\n'
+ elif (self.body[i - 1] == '\n' and
++ self.body[i - 2] and
+ self.body[i - 2][0] != '.' and
+ (self.body[i - 3][:7] == '.TP\n.B '
+ or self.body[i - 3][:4] == '\n.B ')
+@@ -284,7 +286,6 @@
+ text = text.replace('\\','\\e')
+ replace_pairs = [
+ (u'-', ur'\-'),
+- (u'\'', ur'\(aq'),
+ (u'ยด', ur'\''),
+ (u'`', ur'\(ga'),
+ ]
+@@ -297,6 +298,15 @@
+ if text[0] == '.':
+ text = '\\&' + text
+ text = text.replace('\n.', '\n\\&.')
++ # We need to do the same thing for the inline literals, too
++ if self._in_literal_inline and text[0] == '.':
++ if self.body[-2].endswith('\n') and \
++ self.body[-1] == self.defs['literal'][0]:
++ self.body.append('\\&')
++ # Single quotes starting a line are harmful, too.
++ if text[0] == "'":
++ text = '\\&' + text
++ text = text.replace("\n'", "\n\\&'")
+ self.body.append(text)
+
+ def depart_Text(self, node):
+@@ -381,7 +391,6 @@
+ if self.header_written:
+ return
+ self.body.append(self.header())
+- self.body.append(MACRO_DEF)
+ self.header_written = 1
+
+ def visit_address(self, node):
+@@ -795,8 +804,10 @@
+
+ def visit_literal(self, node):
+ self.body.append(self.defs['literal'][0])
++ self._in_literal_inline = True
+
+ def depart_literal(self, node):
++ self._in_literal_inline = False
+ self.body.append(self.defs['literal'][1])
+
+ def visit_literal_block(self, node):