Mercurial > hg
changeset 15861:ee8f5e4ce7b8
minirst: simplify and standardize field list formatting
The default width of field lists is changed from 12 to 14 to align minirst with
the rst2html tool. Shrinking the width of the left column to fit the content is
removed, to keep formatting simple and uniform.
author | Olav Reinert <seroton10@gmail.com> |
---|---|
date | Wed, 11 Jan 2012 18:08:25 +0100 |
parents | 3ecce805ac13 |
children | d0f2a89c8cfa |
files | mercurial/minirst.py tests/test-convert.t tests/test-extension.t tests/test-help.t tests/test-minirst.py.out tests/test-qrecord.t |
diffstat | 6 files changed, 77 insertions(+), 83 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/minirst.py Wed Jan 11 16:53:51 2012 +0100 +++ b/mercurial/minirst.py Wed Jan 11 18:08:25 2012 +0100 @@ -162,28 +162,24 @@ i += 1 return blocks -_fieldwidth = 12 +_fieldwidth = 14 def updatefieldlists(blocks): - """Find key and maximum key width for field lists.""" + """Find key for field lists.""" i = 0 while i < len(blocks): if blocks[i]['type'] != 'field': i += 1 continue - keywidth = 0 j = i while j < len(blocks) and blocks[j]['type'] == 'field': m = _fieldre.match(blocks[j]['lines'][0]) key, rest = m.groups() blocks[j]['lines'][0] = rest blocks[j]['key'] = key - keywidth = max(keywidth, len(key)) j += 1 - for block in blocks[i:j]: - block['keywidth'] = keywidth i = j + 1 return blocks @@ -492,19 +488,13 @@ m = _bulletre.match(block['lines'][0]) subindent = indent + m.end() * ' ' elif block['type'] == 'field': - keywidth = block['keywidth'] key = block['key'] - subindent = indent + _fieldwidth * ' ' if len(key) + 2 > _fieldwidth: # key too large, use full line width key = key.ljust(width) - elif keywidth + 2 < _fieldwidth: - # all keys are small, add only two spaces - key = key.ljust(keywidth + 2) - subindent = indent + (keywidth + 2) * ' ' else: - # mixed sizes, use fieldwidth for this one + # key fits within field width key = key.ljust(_fieldwidth) block['lines'][0] = key + block['lines'][0] elif block['type'] == 'option':
--- a/tests/test-convert.t Wed Jan 11 16:53:51 2012 +0100 +++ b/tests/test-convert.t Wed Jan 11 18:08:25 2012 +0100 @@ -128,15 +128,16 @@ you can set on the command line with "--config": convert.hg.ignoreerrors - ignore integrity errors when reading. Use it to fix Mercurial - repositories with missing revlogs, by converting from and to - Mercurial. Default is False. + ignore integrity errors when reading. Use it to fix + Mercurial repositories with missing revlogs, by converting + from and to Mercurial. Default is False. convert.hg.saverev - store original revision ID in changeset (forces target IDs to - change). It takes a boolean argument and defaults to False. + store original revision ID in changeset (forces target IDs + to change). It takes a boolean argument and defaults to + False. convert.hg.startrev - convert start revision and its descendants. It takes a hg - revision identifier and defaults to 0. + convert start revision and its descendants. It takes a hg + revision identifier and defaults to 0. CVS Source '''''''''' @@ -153,36 +154,35 @@ The following options can be used with "--config": convert.cvsps.cache - Set to False to disable remote log caching, for testing and - debugging purposes. Default is True. + Set to False to disable remote log caching, for testing and + debugging purposes. Default is True. convert.cvsps.fuzz - Specify the maximum time (in seconds) that is allowed between - commits with identical user and log message in a single - changeset. When very large files were checked in as part of a - changeset then the default may not be long enough. The default - is 60. + Specify the maximum time (in seconds) that is allowed + between commits with identical user and log message in a + single changeset. When very large files were checked in as + part of a changeset then the default may not be long enough. + The default is 60. convert.cvsps.mergeto - Specify a regular expression to which commit log messages are - matched. If a match occurs, then the conversion process will - insert a dummy revision merging the branch on which this log - message occurs to the branch indicated in the regex. Default - is "{{mergetobranch ([-\w]+)}}" + Specify a regular expression to which commit log messages + are matched. If a match occurs, then the conversion process + will insert a dummy revision merging the branch on which + this log message occurs to the branch indicated in the + regex. Default is "{{mergetobranch ([-\w]+)}}" convert.cvsps.mergefrom - Specify a regular expression to which commit log messages are - matched. If a match occurs, then the conversion process will - add the most recent revision on the branch indicated in the - regex as the second parent of the changeset. Default is - "{{mergefrombranch ([-\w]+)}}" - hook.cvslog - Specify a Python function to be called at the end of gathering - the CVS log. The function is passed a list with the log - entries, and can modify the entries in-place, or add or delete - them. + Specify a regular expression to which commit log messages + are matched. If a match occurs, then the conversion process + will add the most recent revision on the branch indicated in + the regex as the second parent of the changeset. Default is + "{{mergefrombranch ([-\w]+)}}" + hook.cvslog Specify a Python function to be called at the end of + gathering the CVS log. The function is passed a list with + the log entries, and can modify the entries in-place, or add + or delete them. hook.cvschangesets - Specify a Python function to be called after the changesets - are calculated from the the CVS log. The function is passed a - list with the changeset entries, and can modify the changesets - in-place, or add or delete them. + Specify a Python function to be called after the changesets + are calculated from the the CVS log. The function is passed + a list with the changeset entries, and can modify the + changesets in-place, or add or delete them. An additional "debugcvsps" Mercurial command allows the builtin changeset merging code to be run without doing a conversion. Its parameters and @@ -205,19 +205,21 @@ The following options can be set with "--config": convert.svn.branches - specify the directory containing branches. The default is - "branches". + specify the directory containing branches. The default is + "branches". convert.svn.tags - specify the directory containing tags. The default is "tags". + specify the directory containing tags. The default is + "tags". convert.svn.trunk - specify the name of the trunk branch. The default is "trunk". + specify the name of the trunk branch. The default is + "trunk". Source history can be retrieved starting at a specific revision, instead of being integrally converted. Only single branch conversions are supported. convert.svn.startrev - specify start Subversion revision number. The default is 0. + specify start Subversion revision number. The default is 0. Perforce Source ''''''''''''''' @@ -232,8 +234,8 @@ specifying an initial Perforce revision: convert.p4.startrev - specify initial Perforce revision (a Perforce changelist - number). + specify initial Perforce revision (a Perforce changelist + number). Mercurial Destination ''''''''''''''''''''' @@ -241,12 +243,12 @@ The following options are supported: convert.hg.clonebranches - dispatch source branches in separate clones. The default is - False. + dispatch source branches in separate clones. The default is + False. convert.hg.tagsbranch - branch name for tag revisions, defaults to "default". + branch name for tag revisions, defaults to "default". convert.hg.usebranchnames - preserve branch names. The default is True. + preserve branch names. The default is True. options:
--- a/tests/test-extension.t Wed Jan 11 16:53:51 2012 +0100 +++ b/tests/test-extension.t Wed Jan 11 18:08:25 2012 +0100 @@ -419,14 +419,14 @@ $ hg help email 'email' is provided by the following extension: - patchbomb command to send changesets as (a series of) patch emails + patchbomb command to send changesets as (a series of) patch emails use "hg help extensions" for information on enabling extensions $ hg qdel hg: unknown command 'qdel' 'qdelete' is provided by the following extension: - mq manage a stack of patches + mq manage a stack of patches use "hg help extensions" for information on enabling extensions [255] @@ -434,7 +434,7 @@ hg: unknown command 'churn' 'churn' is provided by the following extension: - churn command to display statistics about repository history + churn command to display statistics about repository history use "hg help extensions" for information on enabling extensions [255]
--- a/tests/test-help.t Wed Jan 11 16:53:51 2012 +0100 +++ b/tests/test-help.t Wed Jan 11 18:08:25 2012 +0100 @@ -675,7 +675,7 @@ enabled extensions: - helpext (no help text available) + helpext (no help text available) additional help topics: @@ -748,10 +748,10 @@ Test templating help $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) ' - desc String. The text of the changeset description. - diffstat String. Statistics of changes with the following format: - firstline Any text. Returns the first line of text. - nonempty Any text. Returns '(none)' if the string is empty. + desc String. The text of the changeset description. + diffstat String. Statistics of changes with the following format: + firstline Any text. Returns the first line of text. + nonempty Any text. Returns '(none)' if the string is empty. Test help hooks
--- a/tests/test-minirst.py.out Wed Jan 11 16:53:51 2012 +0100 +++ b/tests/test-minirst.py.out Wed Jan 11 18:08:25 2012 +0100 @@ -414,35 +414,37 @@ == fields == 60 column format: ---------------------------------------------------------------------- -a First item. -ab Second item. Indentation and wrapping is handled - automatically. +a First item. +ab Second item. Indentation and wrapping is + handled automatically. Next list: -small The larger key below triggers full indentation - here. +small The larger key below triggers full indentation + here. much too large - This key is big enough to get its own line. + This key is big enough to get its own line. ---------------------------------------------------------------------- 30 column format: ---------------------------------------------------------------------- -a First item. -ab Second item. Indentation - and wrapping is handled - automatically. +a First item. +ab Second item. + Indentation and + wrapping is + handled + automatically. Next list: -small The larger key - below triggers - full indentation - here. +small The larger key + below triggers + full indentation + here. much too large - This key is big - enough to get its - own line. + This key is big + enough to get + its own line. ---------------------------------------------------------------------- html format:
--- a/tests/test-qrecord.t Wed Jan 11 16:53:51 2012 +0100 +++ b/tests/test-qrecord.t Wed Jan 11 18:08:25 2012 +0100 @@ -15,7 +15,7 @@ $ hg help qrecord 'qrecord' is provided by the following extension: - record commands to interactively select changes for commit/qrefresh + record commands to interactively select changes for commit/qrefresh use "hg help extensions" for information on enabling extensions