Mercurial > hg-stable
changeset 9170:7bfce9c948aa
Merge with crew
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sat, 18 Jul 2009 12:41:49 -0500 |
parents | e6162b854ed5 (current diff) 7a276f72a08a (diff) |
children | a458b9bf4f3a |
files | |
diffstat | 22 files changed, 1369 insertions(+), 656 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/Makefile Sat Jul 18 12:34:38 2009 -0500 +++ b/doc/Makefile Sat Jul 18 12:41:49 2009 -0500 @@ -5,7 +5,8 @@ MANDIR=$(PREFIX)/share/man INSTALL=install -c -m 644 PYTHON=python -ASCIIDOC=asciidoc +RST2HTML=rst2html +RST2MAN=rst2man all: man html @@ -19,16 +20,15 @@ hg.1.gendoc.txt: gendoc.py ../mercurial/commands.py ../mercurial/help.py ${PYTHON} gendoc.py > $@ -%: %.xml - xmlto man $*.xml && \ - sed -e 's/^\.hg/\\\&.hg/' $* > $*~ && \ - mv $*~ $* +%: %.txt common.txt + # add newline after all literal blocks and fix backslash escape + $(RST2MAN) $*.txt \ + | sed -e 's/^\.fi$$/.fi\n/' \ + | sed -e 's/\\fB\\\\fP/\\fB\\e\\fP/' \ + > $* -%.xml: %.txt - $(ASCIIDOC) -d manpage -b docbook $*.txt - -%.html: %.txt - $(ASCIIDOC) -b html4 $*.txt || $(ASCIIDOC) -b html $*.txt +%.html: %.txt common.txt + $(RST2HTML) $*.txt > $*.html MANIFEST: man html # tracked files are already in the main MANIFEST @@ -45,4 +45,4 @@ done clean: - $(RM) $(MAN) $(MAN:%=%.xml) $(MAN:%=%.html) *.[0-9].gendoc.txt MANIFEST + $(RM) $(MAN) $(MAN:%=%.html) *.[0-9].gendoc.txt MANIFEST
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/common.txt Sat Jul 18 12:41:49 2009 -0500 @@ -0,0 +1,8 @@ +.. Common link and substitution definitions. + +.. |hg(1)| replace:: **hg**\ (1) +.. _hg(1): hg.1.html +.. |hgrc(5)| replace:: **hgrc**\ (5) +.. _hgrc(5): hgrc.5.html +.. |hgignore(5)| replace:: **hgignore**\ (5) +.. _hgignore(5): hgignore.5.html
--- a/doc/gendoc.py Sat Jul 18 12:34:38 2009 -0500 +++ b/doc/gendoc.py Sat Jul 18 12:41:49 2009 -0500 @@ -62,7 +62,7 @@ # print options underlined(_("OPTIONS")) for optstr, desc in get_opts(globalopts): - ui.write("%s::\n %s\n\n" % (optstr, desc)) + ui.write("%s\n %s\n\n" % (optstr, desc)) # print cmds underlined(_("COMMANDS")) @@ -78,15 +78,15 @@ if f.startswith("debug"): continue d = get_cmd(h[f]) # synopsis - ui.write("[[%s]]\n" % d['cmd']) - ui.write("%s::\n" % d['synopsis'].replace("hg ","", 1)) + ui.write(".. _%s:\n\n" % d['cmd']) + ui.write("``%s``\n" % d['synopsis'].replace("hg ","", 1)) # description ui.write("%s\n\n" % d['desc'][1]) # options opt_output = list(d['opts']) if opt_output: opts_len = max([len(line[0]) for line in opt_output]) - ui.write(_(" options:\n")) + ui.write(_(" options:\n\n")) for optstr, desc in opt_output: if desc: s = "%-*s %s" % (opts_len, optstr, desc)
--- a/doc/hg.1.txt Sat Jul 18 12:34:38 2009 -0500 +++ b/doc/hg.1.txt Sat Jul 18 12:41:49 2009 -0500 @@ -1,64 +1,70 @@ -HG(1) -===== -Matt Mackall <mpm@selenic.com> -:man source: Mercurial -:man manual: Mercurial Manual +==== + hg +==== -NAME ----- -hg - Mercurial source code management system +--------------------------------------- +Mercurial source code management system +--------------------------------------- + +:Author: Matt Mackall <mpm@selenic.com> +:Organization: Mercurial +:Manual section: 1 +:Manual group: Mercurial Manual + SYNOPSIS -------- -*hg* 'command' ['option']... ['argument']... +**hg** *command* [*option*]... [*argument*]... DESCRIPTION ----------- -The *hg* command provides a command line interface to the Mercurial +The **hg** command provides a command line interface to the Mercurial system. COMMAND ELEMENTS ---------------- -files ...:: +files... indicates one or more filename or relative path filenames; see "FILE NAME PATTERNS" for information on pattern matching -path:: +path indicates a path on the local machine -revision:: +revision indicates a changeset which can be specified as a changeset revision number, a tag, or a unique substring of the changeset hash value -repository path:: +repository path either the pathname of a local repository or the URI of a remote repository. -include::hg.1.gendoc.txt[] +.. include:: hg.1.gendoc.txt FILES ----- - `.hgignore`:: + +``.hgignore`` This file contains regular expressions (one per line) that - describe file names that should be ignored by *hg*. For details, - see *hgignore(5)*. + describe file names that should be ignored by **hg**. For details, + see |hgignore(5)|_. - `.hgtags`:: +``.hgtags`` This file contains changeset hash values and text tag names (one of each separated by spaces) that correspond to tagged versions of the repository contents. - `/etc/mercurial/hgrc`, `$HOME/.hgrc`, `.hg/hgrc`:: - This file contains defaults and configuration. Values in `.hg/hgrc` - override those in `$HOME/.hgrc`, and these override settings made in - the global `/etc/mercurial/hgrc` configuration. See *hgrc(5)* for - details of the contents and format of these files. +``/etc/mercurial/hgrc``, ``$HOME/.hgrc``, ``.hg/hgrc`` + This file contains defaults and configuration. Values in + ``.hg/hgrc`` override those in ``$HOME/.hgrc``, and these override + settings made in the global ``/etc/mercurial/hgrc`` configuration. + See |hgrc(5)|_ for details of the contents and format of these + files. -Some commands (e.g. revert) produce backup files ending in `.orig`, if -the `.orig` file already exists and is not tracked by Mercurial, it will -be overwritten. +Some commands (e.g. revert) produce backup files ending in ``.orig``, +if the ``.orig`` file already exists and is not tracked by Mercurial, +it will be overwritten. BUGS ---- @@ -67,7 +73,7 @@ SEE ALSO -------- -*hgignore(5)*, *hgrc(5)* +|hgignore(5)|_, |hgrc(5)|_ AUTHOR ------ @@ -75,14 +81,16 @@ RESOURCES --------- -http://mercurial.selenic.com/[Main Web Site] +Main Web Site: http://mercurial.selenic.com/ -http://selenic.com/hg[Source code repository] +Source code repository: http://selenic.com/hg -http://selenic.com/mailman/listinfo/mercurial[Mailing list] +Mailing list: http://selenic.com/mailman/listinfo/mercurial COPYING ------- Copyright \(C) 2005-2009 Matt Mackall. Free use of this software is granted under the terms of the GNU General Public License (GPL). + +.. include:: common.txt
--- a/doc/hgignore.5.txt Sat Jul 18 12:34:38 2009 -0500 +++ b/doc/hgignore.5.txt Sat Jul 18 12:41:49 2009 -0500 @@ -1,17 +1,20 @@ -HGIGNORE(5) -=========== -Vadim Gelfer <vadim.gelfer@gmail.com> -:man source: Mercurial -:man manual: Mercurial Manual +========== + hgignore +========== -NAME ----- -hgignore - syntax for Mercurial ignore files +--------------------------------- +syntax for Mercurial ignore files +--------------------------------- + +:Author: Vadim Gelfer <vadim.gelfer@gmail.com> +:Organization: Mercurial +:Manual section: 5 +:Manual group: Mercurial Manual SYNOPSIS -------- -The Mercurial system uses a file called `.hgignore` in the root +The Mercurial system uses a file called ``.hgignore`` in the root directory of a repository to control its behavior when it searches for files that it is not currently tracking. @@ -22,52 +25,52 @@ root directory, or any prefix path of that path, is matched against any pattern in `.hgignore`. -For example, say we have an an untracked file, `file.c`, at -`a/b/file.c` inside our repository. Mercurial will ignore `file.c` if -any pattern in `.hgignore` matches `a/b/file.c`, `a/b` or `a`. +For example, say we have an an untracked file, ``file.c``, at +``a/b/file.c`` inside our repository. Mercurial will ignore ``file.c`` +if any pattern in ``.hgignore`` matches ``a/b/file.c``, ``a/b`` or ``a``. In addition, a Mercurial configuration file can reference a set of -per-user or global ignore files. See the hgrc(5) man page for details +per-user or global ignore files. See the |hgrc(5)|_ man page for details of how to configure these files. Look for the "ignore" entry in the "ui" section. To control Mercurial's handling of files that it manages, see the -hg(1) man page. Look for the "-I" and "-X" options. +|hg(1)|_ man page. Look for the "-I" and "-X" options. SYNTAX ------ An ignore file is a plain text file consisting of a list of patterns, -with one pattern per line. Empty lines are skipped. The "`#`" -character is treated as a comment character, and the "`\`" character +with one pattern per line. Empty lines are skipped. The "``#``" +character is treated as a comment character, and the "``\``" character is treated as an escape character. Mercurial supports several pattern syntaxes. The default syntax used is Python/Perl-style regular expressions. -To change the syntax used, use a line of the following form: +To change the syntax used, use a line of the following form:: -syntax: NAME + syntax: NAME -where NAME is one of the following: +where ``NAME`` is one of the following: -regexp:: +``regexp`` Regular expression, Python/Perl syntax. -glob:: +``glob`` Shell-style glob. The chosen syntax stays in effect when parsing all patterns that follow, until another syntax is selected. Neither glob nor regexp patterns are rooted. A glob-syntax pattern of -the form "`*.c`" will match a file ending in "`.c`" in any directory, -and a regexp pattern of the form "`\.c$`" will do the same. To root a -regexp pattern, start it with "`^`". +the form "``*.c``" will match a file ending in "``.c``" in any directory, +and a regexp pattern of the form "``\.c$``" will do the same. To root a +regexp pattern, start it with "``^``". EXAMPLE ------- -Here is an example ignore file. +Here is an example ignore file. :: # use glob syntax. syntax: glob @@ -88,7 +91,7 @@ SEE ALSO -------- -hg(1), hgrc(5) +|hg(1)|_, |hgrc(5)|_ COPYING ------- @@ -96,3 +99,5 @@ Mercurial is copyright 2005-2009 Matt Mackall. Free use of this software is granted under the terms of the GNU General Public License (GPL). + +.. include:: common.txt
--- a/doc/hgrc.5.txt Sat Jul 18 12:34:38 2009 -0500 +++ b/doc/hgrc.5.txt Sat Jul 18 12:41:49 2009 -0500 @@ -1,12 +1,16 @@ -HGRC(5) -======= -Bryan O'Sullivan <bos@serpentine.com> -:man source: Mercurial -:man manual: Mercurial Manual +====== + hgrc +====== -NAME ----- -hgrc - configuration files for Mercurial +--------------------------------- +configuration files for Mercurial +--------------------------------- + +:Author: Bryan O'Sullivan <bos@serpentine.com> +:Organization: Mercurial +:Manual section: 5 +:Manual group: Mercurial Manual + SYNOPSIS -------- @@ -19,51 +23,54 @@ Mercurial reads configuration data from several files, if they exist. The names of these files depend on the system on which Mercurial is -installed. `*.rc` files from a single directory are read in +installed. ``*.rc`` files from a single directory are read in alphabetical order, later ones overriding earlier ones. Where multiple paths are given below, settings from later paths override earlier ones. -(Unix) `<install-root>/etc/mercurial/hgrc.d/*.rc`:: -(Unix) `<install-root>/etc/mercurial/hgrc`:: +| (Unix) ``<install-root>/etc/mercurial/hgrc.d/*.rc`` +| (Unix) ``<install-root>/etc/mercurial/hgrc`` + Per-installation configuration files, searched for in the - directory where Mercurial is installed. `<install-root>` is the - parent directory of the hg executable (or symlink) being run. For - example, if installed in `/shared/tools/bin/hg`, Mercurial will look - in `/shared/tools/etc/mercurial/hgrc`. Options in these files apply + directory where Mercurial is installed. ``<install-root>`` is the + parent directory of the **hg** executable (or symlink) being run. For + example, if installed in ``/shared/tools/bin/hg``, Mercurial will look + in ``/shared/tools/etc/mercurial/hgrc``. Options in these files apply to all Mercurial commands executed by any user in any directory. -(Unix) `/etc/mercurial/hgrc.d/*.rc`:: -(Unix) `/etc/mercurial/hgrc`:: +| (Unix) ``/etc/mercurial/hgrc.d/*.rc`` +| (Unix) ``/etc/mercurial/hgrc`` + Per-system configuration files, for the system on which Mercurial is running. Options in these files apply to all Mercurial commands executed by any user in any directory. Options in these files override per-installation options. -(Windows) `<install-dir>\Mercurial.ini`:: - or else:: -(Windows) `HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`:: - or else:: -(Windows) `C:\Mercurial\Mercurial.ini`:: +| (Windows) ``<install-dir>\Mercurial.ini`` or else +| (Windows) ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`` or else +| (Windows) ``C:\Mercurial\Mercurial.ini`` + Per-installation/system configuration files, for the system on which Mercurial is running. Options in these files apply to all Mercurial commands executed by any user in any directory. Registry keys contain PATH-like strings, every part of which must reference - a `Mercurial.ini` file or be a directory where `*.rc` files will + a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will be read. -(Unix) `$HOME/.hgrc`:: -(Windows) `%HOME%\Mercurial.ini`:: -(Windows) `%HOME%\.hgrc`:: -(Windows) `%USERPROFILE%\Mercurial.ini`:: -(Windows) `%USERPROFILE%\.hgrc`:: +| (Unix) ``$HOME/.hgrc`` +| (Windows) ``%HOME%\Mercurial.ini`` +| (Windows) ``%HOME%\.hgrc`` +| (Windows) ``%USERPROFILE%\Mercurial.ini`` +| (Windows) ``%USERPROFILE%\.hgrc`` + Per-user configuration file(s), for the user running Mercurial. On - Windows 9x, `%HOME%` is replaced by `%APPDATA%`. Options in these + Windows 9x, ``%HOME%`` is replaced by ``%APPDATA%``. Options in these files apply to all Mercurial commands executed by this user in any directory. Options in these files override per-installation and per-system options. -(Unix, Windows) `<repo>/.hg/hgrc`:: +| (Unix, Windows) ``<repo>/.hg/hgrc`` + Per-repository configuration options that only apply in a particular repository. This file is not version-controlled, and will not get transferred during a "clone" operation. Options in @@ -75,8 +82,10 @@ SYNTAX ------ -A configuration file consists of sections, led by a "`[section]`" header -and followed by "`name: value`" entries; "`name=value`" is also accepted. +A configuration file consists of sections, led by a "``[section]``" header +and followed by "``name: value``" entries; "``name=value``" is also accepted. + +:: [spam] eggs=ham @@ -88,7 +97,7 @@ Leading whitespace is removed from values. Empty lines are skipped. -Lines beginning with "`#`" or "`;`" are ignored and may be used to provide +Lines beginning with "``#``" or "``;``" are ignored and may be used to provide comments. SECTIONS @@ -98,41 +107,39 @@ Mercurial "hgrc" file, the purpose of each section, its possible keys, and their possible values. -[[alias]] -alias:: - Defines command aliases. - Aliases allow you to define your own commands in terms of other - commands (or aliases), optionally including arguments. -+ --- -Alias definitions consist of lines of the form: +``alias`` +""""""""" +Defines command aliases. +Aliases allow you to define your own commands in terms of other +commands (or aliases), optionally including arguments. + +Alias definitions consist of lines of the form:: <alias> = <command> [<argument]... -For example, this definition: +For example, this definition:: latest = log --limit 5 -creates a new command `latest` that shows only the five most recent -changesets. You can define subsequent aliases using earlier ones: +creates a new command ``latest`` that shows only the five most recent +changesets. You can define subsequent aliases using earlier ones:: stable5 = latest -b stable NOTE: It is possible to create aliases with the same names as existing commands, which will then override the original definitions. This is almost always a bad idea! --- + -[[auth]] -auth:: +``auth`` +"""""""" Authentication credentials for HTTP authentication. Each line has -the following format: +the following format:: <name>.<argument> = <value> -+ --- + where <name> is used to group arguments into authentication entries. -Example: +Example:: foo.prefix = hg.intevation.org/mercurial foo.username = foo @@ -146,26 +153,26 @@ Supported arguments: - prefix;; - Either "\*" or a URI prefix with or without the scheme part. +``prefix`` + Either "``*``" or a URI prefix with or without the scheme part. The authentication entry with the longest matching prefix is used - (where "*" matches everything and counts as a match of length + (where "``*``" matches everything and counts as a match of length 1). If the prefix doesn't include a scheme, the match is performed against the URI with its scheme stripped as well, and the schemes argument, q.v., is then subsequently consulted. - username;; +``username`` Optional. Username to authenticate with. If not given, and the remote site requires basic or digest authentication, the user will be prompted for it. - password;; +``password`` Optional. Password to authenticate with. If not given, and the remote site requires basic or digest authentication, the user will be prompted for it. - key;; +``key`` Optional. PEM encoded client certificate key file. - cert;; +``cert`` Optional. PEM encoded client certificate chain file. - schemes;; +``schemes`` Optional. Space separated list of URI schemes to use this authentication entry with. Only used if the prefix doesn't include a scheme. Supported schemes are http and https. They will match @@ -174,20 +181,19 @@ If no suitable authentication entry is found, the user is prompted for credentials as usual if required by the remote. --- + -[[decode]] -decode/encode:: - Filters for transforming files on checkout/checkin. This would - typically be used for newline processing or other - localization/canonicalization of files. -+ --- +``decode/encode`` +""""""""""""""""" +Filters for transforming files on checkout/checkin. This would +typically be used for newline processing or other +localization/canonicalization of files. + Filters consist of a filter pattern followed by a filter command. Filter patterns are globs by default, rooted at the repository root. -For example, to match any file ending in "`.txt`" in the root -directory only, use the pattern "\*.txt". To match any file ending -in "`.c`" anywhere in the repository, use the pattern "**`.c`". +For example, to match any file ending in "``.txt``" in the root +directory only, use the pattern "``*.txt``". To match any file ending +in "``.c``" anywhere in the repository, use the pattern "``**.c``". The filter command can start with a specifier, either "pipe:" or "tempfile:". If no specifier is given, "pipe:" is used by default. @@ -195,7 +201,7 @@ A "pipe:" command must accept data on stdin and return the transformed data on stdout. -Pipe example: +Pipe example:: [encode] # uncompress gzip files on checkin to improve delta compression @@ -218,7 +224,7 @@ effects and may corrupt the contents of your files. The most common usage is for LF <-> CRLF translation on Windows. For -this, use the "smart" converters which check for binary files: +this, use the "smart" converters which check for binary files:: [extensions] hgext.win32text = @@ -227,7 +233,7 @@ [decode] ** = cleverdecode: -or if you only want to translate certain files: +or if you only want to translate certain files:: [extensions] hgext.win32text = @@ -235,16 +241,16 @@ **.txt = dumbencode: [decode] **.txt = dumbdecode: --- + + +``defaults`` +"""""""""""" -[[defaults]] -defaults:: - Use the [defaults] section to define command defaults, i.e. the - default options/arguments to pass to the specified commands. -+ --- +Use the [defaults] section to define command defaults, i.e. the +default options/arguments to pass to the specified commands. + The following example makes 'hg log' run in verbose mode, and 'hg -status' show only the modified files, by default. +status' show only the modified files, by default:: [defaults] log = -v @@ -253,57 +259,59 @@ The actual commands, instead of their aliases, must be used when defining command defaults. The command defaults will also be applied to the aliases of the commands defined. --- + + +``diff`` +"""""""" -[[diff]] -diff:: - Settings used when displaying diffs. They are all Boolean and - defaults to False. - git;; +Settings used when displaying diffs. They are all Boolean and +defaults to False. + +``git`` Use git extended diff format. - nodates;; +``nodates`` Don't include dates in diff headers. - showfunc;; +``showfunc`` Show which function each change is in. - ignorews;; +``ignorews`` Ignore white space when comparing lines. - ignorewsamount;; +``ignorewsamount`` Ignore changes in the amount of white space. - ignoreblanklines;; +``ignoreblanklines`` Ignore changes whose lines are all blank. -[[email]] -email:: - Settings for extensions that send email messages. - from;; +``email`` +""""""""" +Settings for extensions that send email messages. + +``from`` Optional. Email address to use in "From" header and SMTP envelope of outgoing messages. - to;; +``to`` Optional. Comma-separated list of recipients' email addresses. - cc;; +``cc`` Optional. Comma-separated list of carbon copy recipients' email addresses. - bcc;; +``bcc`` Optional. Comma-separated list of blind carbon copy recipients' email addresses. Cannot be set interactively. - method;; +``method`` Optional. Method to use to send email messages. If value is "smtp" (default), use SMTP (see section "[smtp]" for configuration). Otherwise, use as name of program to run that acts like sendmail (takes "-f" option for sender, list of recipients on command line, message on stdin). Normally, setting this to "sendmail" or "/usr/sbin/sendmail" is enough to use sendmail to send messages. - charsets;; +``charsets`` Optional. Comma-separated list of character sets considered convenient for recipients. Addresses, headers, and parts not containing patches of outgoing messages will be encoded in the first character set to which conversion from local encoding - (`$HGENCODING`, `ui.fallbackencoding`) succeeds. If correct + (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct conversion fails, the text in question is sent as is. Defaults to empty (explicit) list. -+ --- -Order of outgoing email character sets: + +Order of outgoing email character sets:: us-ascii always first, regardless of settings email.charsets in order given by user @@ -311,7 +319,7 @@ $HGENCODING if not in email.charsets utf-8 always last, regardless of settings -Email example: +Email example:: [email] from = Joseph User <joe.user@example.com> @@ -319,40 +327,40 @@ # charsets for western Europeans # us-ascii, utf-8 omitted, as they are tried first and last charsets = iso-8859-1, iso-8859-15, windows-1252 --- + + +``extensions`` +"""""""""""""" -[[extensions]] -extensions:: - Mercurial has an extension mechanism for adding new features. To - enable an extension, create an entry for it in this section. -+ --- +Mercurial has an extension mechanism for adding new features. To +enable an extension, create an entry for it in this section. + If you know that the extension is already in Python's search path, -you can give the name of the module, followed by "`=`", with nothing -after the "`=`". +you can give the name of the module, followed by "``=``", with nothing +after the "``=``". -Otherwise, give a name that you choose, followed by "`=`", followed by -the path to the "`.py`" file (including the file name extension) that +Otherwise, give a name that you choose, followed by "``=``", followed by +the path to the "``.py``" file (including the file name extension) that defines the extension. To explicitly disable an extension that is enabled in an hgrc of -broader scope, prepend its path with "`!`", as in -"`hgext.foo = !/ext/path`" or "`hgext.foo = !`" when path is not +broader scope, prepend its path with "``!``", as in +"``hgext.foo = !/ext/path``" or "``hgext.foo = !``" when path is not supplied. -Example for `~/.hgrc`: +Example for ``~/.hgrc``:: [extensions] # (the mq extension will get loaded from Mercurial's path) hgext.mq = # (this extension will get loaded from the file specified) myfeature = ~/.hgext/myfeature.py --- + -[[format]] -format:: +``format`` +"""""""""" - usestore;; +``usestore`` Enable or disable the "store" repository format which improves compatibility with systems that fold case or otherwise mangle filenames. Enabled by default. Disabling this option will allow @@ -360,7 +368,7 @@ compatibility and ensures that the on-disk format of newly created repositories will be compatible with Mercurial before version 0.9.4. - usefncache;; +``usefncache`` Enable or disable the "fncache" repository format which enhances the "store" repository format (which has to be enabled to use fncache) to allow longer filenames and avoids using Windows @@ -368,26 +376,27 @@ option ensures that the on-disk format of newly created repositories will be compatible with Mercurial before version 1.1. -[[merge-patterns]] -merge-patterns:: - This section specifies merge tools to associate with particular file - patterns. Tools matched here will take precedence over the default - merge tool. Patterns are globs by default, rooted at the repository - root. -+ -Example: -+ +``merge-patterns`` +"""""""""""""""""" + +This section specifies merge tools to associate with particular file +patterns. Tools matched here will take precedence over the default +merge tool. Patterns are globs by default, rooted at the repository +root. + +Example:: + [merge-patterns] **.c = kdiff3 **.jpg = myimgmerge -[[merge-tools]] -merge-tools:: - This section configures external merge tools to use for file-level - merges. -+ --- -Example `~/.hgrc`: +``merge-tools`` +""""""""""""""" + +This section configures external merge tools to use for file-level +merges. + +Example ``~/.hgrc``:: [merge-tools] # Override stock tool location @@ -404,64 +413,63 @@ Supported arguments: -priority;; +``priority`` The priority in which to evaluate this tool. Default: 0. -executable;; +``executable`` Either just the name of the executable or its pathname. Default: the tool name. -args;; +``args`` The arguments to pass to the tool executable. You can refer to the files being merged as well as the output file through these - variables: `$base`, `$local`, `$other`, `$output`. - Default: `$local $base $other` -premerge;; + variables: ``$base``, ``$local``, ``$other``, ``$output``. + Default: ``$local $base $other`` +``premerge`` Attempt to run internal non-interactive 3-way merge tool before launching external tool. Default: True -binary;; +``binary`` This tool can merge binary files. Defaults to False, unless tool was selected by file pattern match. -symlink;; +``symlink`` This tool can merge symlinks. Defaults to False, even if tool was selected by file pattern match. -checkconflicts;; +``checkconflicts`` Check whether there are conflicts even though the tool reported success. Default: False -checkchanged;; +``checkchanged`` Check whether outputs were written even though the tool reported success. Default: False -fixeol;; +``fixeol`` Attempt to fix up EOL changes caused by the merge tool. Default: False -gui;; +``gui`` This tool requires a graphical interface to run. Default: False -regkey;; +``regkey`` Windows registry key which describes install location of this tool. Mercurial will search for this key first under - `HKEY_CURRENT_USER` and then under `HKEY_LOCAL_MACHINE`. + ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``. Default: None -regname;; +``regname`` Name of value to read from specified registry key. Defaults to the unnamed (default) value. -regappend;; +``regappend`` String to append to the value read from the registry, typically the executable name of the tool. Default: None --- + -[[hooks]] -hooks:: - Commands or Python functions that get automatically executed by - various actions such as starting or finishing a commit. Multiple - hooks can be run for the same action by appending a suffix to the - action. Overriding a site-wide hook can be done by changing its - value or setting it to an empty string. -+ --- -Example `.hg/hgrc`: +``hooks`` +""""""""" +Commands or Python functions that get automatically executed by +various actions such as starting or finishing a commit. Multiple +hooks can be run for the same action by appending a suffix to the +action. Overriding a site-wide hook can be done by changing its +value or setting it to an empty string. + +Example ``.hg/hgrc``:: [hooks] # do not use the site-wide hook @@ -473,84 +481,84 @@ additional information. For each hook below, the environment variables it is passed are listed with names of the form "$HG_foo". -changegroup;; +``changegroup`` Run after a changegroup has been added via push, pull or unbundle. - ID of the first new changeset is in `$HG_NODE`. URL from which - changes came is in `$HG_URL`. -commit;; + ID of the first new changeset is in ``$HG_NODE``. URL from which + changes came is in ``$HG_URL``. +``commit`` Run after a changeset has been created in the local repository. ID - of the newly created changeset is in `$HG_NODE`. Parent changeset - IDs are in `$HG_PARENT1` and `$HG_PARENT2`. -incoming;; + of the newly created changeset is in ``$HG_NODE``. Parent changeset + IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. +``incoming`` Run after a changeset has been pulled, pushed, or unbundled into the local repository. The ID of the newly arrived changeset is in - `$HG_NODE`. URL that was source of changes came is in `$HG_URL`. -outgoing;; + ``$HG_NODE``. URL that was source of changes came is in ``$HG_URL``. +``outgoing`` Run after sending changes from local repository to another. ID of - first changeset sent is in `$HG_NODE`. Source of operation is in - `$HG_SOURCE`; see "preoutgoing" hook for description. -post-<command>;; + first changeset sent is in ``$HG_NODE``. Source of operation is in + ``$HG_SOURCE``; see "preoutgoing" hook for description. +``post-<command>`` Run after successful invocations of the associated command. The - contents of the command line are passed as `$HG_ARGS` and the result - code in `$HG_RESULT`. Hook failure is ignored. -pre-<command>;; + contents of the command line are passed as ``$HG_ARGS`` and the result + code in ``$HG_RESULT``. Hook failure is ignored. +``pre-<command>`` Run before executing the associated command. The contents of the - command line are passed as `$HG_ARGS`. If the hook returns failure, + command line are passed as ``$HG_ARGS``. If the hook returns failure, the command doesn't execute and Mercurial returns the failure code. -prechangegroup;; +``prechangegroup`` Run before a changegroup is added via push, pull or unbundle. Exit status 0 allows the changegroup to proceed. Non-zero status will cause the push, pull or unbundle to fail. URL from which changes - will come is in `$HG_URL`. -precommit;; + will come is in ``$HG_URL``. +``precommit`` Run before starting a local commit. Exit status 0 allows the commit to proceed. Non-zero status will cause the commit to fail. - Parent changeset IDs are in `$HG_PARENT1` and `$HG_PARENT2`. -preoutgoing;; + Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. +``preoutgoing`` Run before collecting changes to send from the local repository to another. Non-zero status will cause failure. This lets you prevent pull over HTTP or SSH. Also prevents against local pull, push (outbound) or bundle commands, but not effective, since you can just copy files instead then. Source of operation is in - `$HG_SOURCE`. If "serve", operation is happening on behalf of remote + ``$HG_SOURCE``. If "serve", operation is happening on behalf of remote SSH or HTTP repository. If "push", "pull" or "bundle", operation is happening on behalf of repository on same system. -pretag;; +``pretag`` Run before creating a tag. Exit status 0 allows the tag to be created. Non-zero status will cause the tag to fail. ID of - changeset to tag is in `$HG_NODE`. Name of tag is in `$HG_TAG`. Tag is - local if `$HG_LOCAL=1`, in repository if `$HG_LOCAL=0`. -pretxnchangegroup;; + changeset to tag is in ``$HG_NODE``. Name of tag is in ``$HG_TAG``. Tag is + local if ``$HG_LOCAL=1``, in repository if ``$HG_LOCAL=0``. +``pretxnchangegroup`` Run after a changegroup has been added via push, pull or unbundle, but before the transaction has been committed. Changegroup is visible to hook program. This lets you validate incoming changes before accepting them. Passed the ID of the first new changeset in - `$HG_NODE`. Exit status 0 allows the transaction to commit. Non-zero + ``$HG_NODE``. Exit status 0 allows the transaction to commit. Non-zero status will cause the transaction to be rolled back and the push, pull or unbundle will fail. URL that was source of changes is in - `$HG_URL`. -pretxncommit;; + ``$HG_URL``. +``pretxncommit`` Run after a changeset has been created but the transaction not yet committed. Changeset is visible to hook program. This lets you validate commit message and changes. Exit status 0 allows the commit to proceed. Non-zero status will cause the transaction to - be rolled back. ID of changeset is in `$HG_NODE`. Parent changeset - IDs are in `$HG_PARENT1` and `$HG_PARENT2`. -preupdate;; + be rolled back. ID of changeset is in ``$HG_NODE``. Parent changeset + IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. +``preupdate`` Run before updating the working directory. Exit status 0 allows the update to proceed. Non-zero status will prevent the update. - Changeset ID of first new parent is in `$HG_PARENT1`. If merge, ID - of second new parent is in `$HG_PARENT2`. -tag;; - Run after a tag is created. ID of tagged changeset is in `$HG_NODE`. - Name of tag is in `$HG_TAG`. Tag is local if `$HG_LOCAL=1`, in - repository if `$HG_LOCAL=0`. -update;; + Changeset ID of first new parent is in ``$HG_PARENT1``. If merge, ID + of second new parent is in ``$HG_PARENT2``. +``tag`` + Run after a tag is created. ID of tagged changeset is in ``$HG_NODE``. + Name of tag is in ``$HG_TAG``. Tag is local if ``$HG_LOCAL=1``, in + repository if ``$HG_LOCAL=0``. +``update`` Run after updating the working directory. Changeset ID of first - new parent is in `$HG_PARENT1`. If merge, ID of second new parent is - in `$HG_PARENT2`. If the update succeeded, `$HG_ERROR=0`. If the - update failed (e.g. because conflicts not resolved), `$HG_ERROR=1`. + new parent is in ``$HG_PARENT1``. If merge, ID of second new parent is + in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the + update failed (e.g. because conflicts not resolved), ``$HG_ERROR=1``. NOTE: it is generally better to use standard hooks rather than the generic pre- and post- command hooks as they are guaranteed to be @@ -559,11 +567,11 @@ generate a commit (e.g. tag) and not just the commit command. NOTE: Environment variables with empty values may not be passed to -hooks on platforms such as Windows. As an example, `$HG_PARENT2` will +hooks on platforms such as Windows. As an example, ``$HG_PARENT2`` will have an empty value under Unix-like platforms for non-merge changesets, while it will not be available at all under Windows. -The syntax for Python hooks is as follows: +The syntax for Python hooks is as follows:: hookname = python:modulename.submodule.callable hookname = python:/path/to/python/module.py:callable @@ -573,101 +581,111 @@ "ui"), a repository object (keyword "repo"), and a "hooktype" keyword that tells what kind of hook is used. Arguments listed as environment variables above are passed as keyword arguments, with no -"HG_" prefix, and names in lower case. +"``HG_``" prefix, and names in lower case. If a Python hook returns a "true" value or raises an exception, this is treated as a failure. --- + -[[http_proxy]] -http_proxy:: - Used to access web-based Mercurial repositories through a HTTP - proxy. - host;; +``http_proxy`` +"""""""""""""" +Used to access web-based Mercurial repositories through a HTTP +proxy. + +``host`` Host name and (optional) port of the proxy server, for example "myproxy:8000". - no;; +``no`` Optional. Comma-separated list of host names that should bypass the proxy. - passwd;; +``passwd`` Optional. Password to authenticate with at the proxy server. - user;; +``user`` Optional. User name to authenticate with at the proxy server. -[[smtp]] -smtp:: - Configuration for extensions that need to send email messages. - host;; +``smtp`` +"""""""" +Configuration for extensions that need to send email messages. + +``host`` Host name of mail server, e.g. "mail.example.com". - port;; +``port`` Optional. Port to connect to on mail server. Default: 25. - tls;; +``tls`` Optional. Whether to connect to mail server using TLS. True or False. Default: False. - username;; +``username`` Optional. User name to authenticate to SMTP server with. If username is specified, password must also be specified. Default: none. - password;; +``password`` Optional. Password to authenticate to SMTP server with. If username is specified, password must also be specified. Default: none. - local_hostname;; +``local_hostname`` Optional. It's the hostname that the sender can use to identify itself to the MTA. -[[patch]] -patch:: - Settings used when applying patches, for instance through the 'import' - command or with Mercurial Queues extension. - eol;; + +``patch`` +""""""""" +Settings used when applying patches, for instance through the 'import' +command or with Mercurial Queues extension. + +``eol`` When set to 'strict' patch content and patched files end of lines are preserved. When set to 'lf' or 'crlf', both files end of lines are ignored when patching and the result line endings are normalized to either LF (Unix) or CRLF (Windows). Default: strict. -[[paths]] -paths:: - Assigns symbolic names to repositories. The left side is the - symbolic name, and the right gives the directory or URL that is the - location of the repository. Default paths can be declared by setting - the following entries. - default;; + +``paths`` +""""""""" +Assigns symbolic names to repositories. The left side is the +symbolic name, and the right gives the directory or URL that is the +location of the repository. Default paths can be declared by setting +the following entries. + +``default`` Directory or URL to use when pulling if no source is specified. Default is set to repository from which the current repository was cloned. - default-push;; +``default-push`` Optional. Directory or URL to use when pushing if no destination is specified. -[[profiling]] -profiling:: - Specifies profiling format and file output. In this section - description, 'profiling data' stands for the raw data collected - during profiling, while 'profiling report' stands for a statistical - text report generated from the profiling data. The profiling is done - using lsprof. - format;; + +``profiling`` +""""""""""""" +Specifies profiling format and file output. In this section +description, 'profiling data' stands for the raw data collected +during profiling, while 'profiling report' stands for a statistical +text report generated from the profiling data. The profiling is done +using lsprof. + +``format`` Profiling format. Default: text. - text;; + + ``text`` Generate a profiling report. When saving to a file, it should be noted that only the report is saved, and the profiling data is not kept. - kcachegrind;; + ``kcachegrind`` Format profiling data for kcachegrind use: when saving to a file, the generated file can directly be loaded into kcachegrind. - output;; +``output`` File path where profiling data or report should be saved. If the file exists, it is replaced. Default: None, data is printed on stderr -[[server]] -server:: - Controls generic server settings. - uncompressed;; +``server`` +"""""""""" +Controls generic server settings. + +``uncompressed`` Whether to allow clients to clone a repository using the uncompressed streaming protocol. This transfers about 40% more data than a regular clone, but uses less memory and CPU on both @@ -677,174 +695,175 @@ about 6 Mbps), uncompressed streaming is slower, because of the extra data transfer overhead. Default is False. -[[trusted]] -trusted:: - For security reasons, Mercurial will not use the settings in the - `.hg/hgrc` file from a repository if it doesn't belong to a trusted - user or to a trusted group. The main exception is the web interface, - which automatically uses some safe settings, since it's common to - serve repositories from different users. -+ --- + +``trusted`` +""""""""""" +For security reasons, Mercurial will not use the settings in the +``.hg/hgrc`` file from a repository if it doesn't belong to a trusted +user or to a trusted group. The main exception is the web interface, +which automatically uses some safe settings, since it's common to +serve repositories from different users. + This section specifies what users and groups are trusted. The current user is always trusted. To trust everybody, list a user or a -group with name "`*`". +group with name "``*``". -users;; +``users`` Comma-separated list of trusted users. -groups;; +``groups`` Comma-separated list of trusted groups. --- + -[[ui]] -ui:: - User interface controls. -+ --- - archivemeta;; +``ui`` +"""""" + +User interface controls. + +``archivemeta`` Whether to include the .hg_archival.txt file containing meta data (hashes for the repository base and for tip) in archives created by the hg archive command or downloaded via hgweb. Default is true. - askusername;; +``askusername`` Whether to prompt for a username when committing. If True, and - neither `$HGUSER` nor `$EMAIL` has been specified, then the user will + neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will be prompted to enter a username. If no username is entered, the default USER@HOST is used instead. Default is False. - debug;; +``debug`` Print debugging information. True or False. Default is False. - editor;; - The editor to use during a commit. Default is `$EDITOR` or "vi". - fallbackencoding;; +``editor`` + The editor to use during a commit. Default is ``$EDITOR`` or "vi". +``fallbackencoding`` Encoding to try if it's not possible to decode the changelog using UTF-8. Default is ISO-8859-1. - ignore;; +``ignore`` A file to read per-user ignore patterns from. This file should be in the same format as a repository-wide .hgignore file. This option supports hook syntax, so if you want to specify multiple ignore files, you can do so by setting something like - "ignore.other = ~/.hgignore2". For details of the ignore file - format, see the hgignore(5) man page. - interactive;; + "``ignore.other = ~/.hgignore2``". For details of the ignore file + format, see the |hgignore(5)|_ man page. +``interactive`` Allow to prompt the user. True or False. Default is True. - logtemplate;; +``logtemplate`` Template string for commands that print changesets. - merge;; +``merge`` The conflict resolution program to use during a manual merge. There are some internal tools available: -+ - internal:local;; + + ``internal:local`` keep the local version - internal:other;; + ``internal:other`` use the other version - internal:merge;; + ``internal:merge`` use the internal non-interactive merge tool - internal:fail;; + ``internal:fail`` fail to merge -+ + For more information on configuring merge tools see the merge-tools section. - patch;; +``patch`` command to use to apply patches. Look for 'gpatch' or 'patch' in PATH if unset. - quiet;; +``quiet`` Reduce the amount of output printed. True or False. Default is False. - remotecmd;; +``remotecmd`` remote command to use for clone/push/pull operations. Default is 'hg'. - report_untrusted;; - Warn if a `.hg/hgrc` file is ignored due to not being owned by a +``report_untrusted`` + Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a trusted user or group. True or False. Default is True. - slash;; - Display paths using a slash ("`/`") as the path separator. This +``slash`` + Display paths using a slash ("``/``") as the path separator. This only makes a difference on systems where the default path separator is not the slash character (e.g. Windows uses the - backslash character ("`\`")). + backslash character ("``\``")). Default is False. - ssh;; +``ssh`` command to use for SSH connections. Default is 'ssh'. - strict;; +``strict`` Require exact command names, instead of allowing unambiguous abbreviations. True or False. Default is False. - style;; +``style`` Name of style to use for command output. - timeout;; +``timeout`` The timeout used when a lock is held (in seconds), a negative value means no timeout. Default is 600. - username;; +``username`` The committer of a changeset created when running "commit". Typically a person's name and email address, e.g. "Fred Widget - <fred@example.com>". Default is `$EMAIL` or username@hostname. If + <fred@example.com>". Default is ``$EMAIL`` or username@hostname. If the username in hgrc is empty, it has to be specified manually or - in a different hgrc file (e.g. `$HOME/.hgrc`, if the admin set + in a different hgrc file (e.g. ``$HOME/.hgrc``, if the admin set "username =" in the system hgrc). - verbose;; +``verbose`` Increase the amount of output printed. True or False. Default is False. --- + -[[web]] -web:: - Web interface configuration. - accesslog;; +``web`` +""""""" +Web interface configuration. + +``accesslog`` Where to output the access log. Default is stdout. - address;; +``address`` Interface address to bind to. Default is all. - allow_archive;; +``allow_archive`` List of archive format (bz2, gz, zip) allowed for downloading. Default is empty. - allowbz2;; +``allowbz2`` (DEPRECATED) Whether to allow .tar.bz2 downloading of repository revisions. Default is false. - allowgz;; +``allowgz`` (DEPRECATED) Whether to allow .tar.gz downloading of repository revisions. Default is false. - allowpull;; +``allowpull`` Whether to allow pulling from the repository. Default is true. - allow_push;; +``allow_push`` Whether to allow pushing to the repository. If empty or not set, - push is not allowed. If the special value "`*`", any remote user can + push is not allowed. If the special value "``*``", any remote user can push, including unauthenticated users. Otherwise, the remote user must have been authenticated, and the authenticated user name must be present in this list (separated by whitespace or ","). The contents of the allow_push list are examined after the deny_push list. - allow_read;; +``allow_read`` If the user has not already been denied repository access due to the contents of deny_read, this list determines whether to grant repository access to the user. If this list is not empty, and the user is unauthenticated or not present in the list (separated by whitespace or ","), then access is denied for the user. If the list is empty or not set, then access is permitted to all users by - default. Setting allow_read to the special value "`*`" is equivalent + default. Setting allow_read to the special value "``*``" is equivalent to it not being set (i.e. access is permitted to all users). The contents of the allow_read list are examined after the deny_read list. - allowzip;; +``allowzip`` (DEPRECATED) Whether to allow .zip downloading of repository revisions. Default is false. This feature creates temporary files. - baseurl;; +``baseurl`` Base URL to use when publishing URLs in other locations, so third-party tools like email notification hooks can construct URLs. Example: "http://hgserver/repos/" - contact;; +``contact`` Name or email address of the person in charge of the repository. - Defaults to ui.username or `$EMAIL` or "unknown" if unset or empty. - deny_push;; + Defaults to ui.username or ``$EMAIL`` or "unknown" if unset or empty. +``deny_push`` Whether to deny pushing to the repository. If empty or not set, - push is not denied. If the special value "`*`", all remote users are + push is not denied. If the special value "``*``", all remote users are denied push. Otherwise, unauthenticated users are all denied, and any authenticated user name present in this list (separated by whitespace or ",") is also denied. The contents of the deny_push list are examined before the allow_push list. - deny_read;; +``deny_read`` Whether to deny reading/viewing of the repository. If this list is not empty, unauthenticated users are all denied, and any authenticated user name present in this list (separated by whitespace or ",") is also denied access to the repository. If set - to the special value "`*`", all remote users are denied access + to the special value "``*``", all remote users are denied access (rarely needed ;). If deny_read is empty or not set, the determination of repository access depends on the presence and content of the allow_read list (see description). If both @@ -854,44 +873,44 @@ the list of repositories. The contents of the deny_read list have priority over (are examined before) the contents of the allow_read list. - description;; +``description`` Textual description of the repository's purpose or contents. Default is "unknown". - encoding;; +``encoding`` Character encoding name. Example: "UTF-8" - errorlog;; +``errorlog`` Where to output the error log. Default is stderr. - hidden;; +``hidden`` Whether to hide the repository in the hgwebdir index. Default is false. - ipv6;; +``ipv6`` Whether to use IPv6. Default is false. - name;; +``name`` Repository name to use in the web interface. Default is current working directory. - maxchanges;; +``maxchanges`` Maximum number of changes to list on the changelog. Default is 10. - maxfiles;; +``maxfiles`` Maximum number of files to list per changeset. Default is 10. - port;; +``port`` Port to listen on. Default is 8000. - prefix;; +``prefix`` Prefix path to serve from. Default is '' (server root). - push_ssl;; +``push_ssl`` Whether to require that inbound pushes be transported over SSL to prevent password sniffing. Default is true. - staticurl;; +``staticurl`` Base URL to use for static files. If unset, static files (e.g. the hgicon.png favicon) will be served by the CGI script itself. Use this setting to serve them directly with the HTTP server. Example: "http://hgserver/static/" - stripes;; +``stripes`` How many lines a "zebra stripe" should span in multiline output. Default is 1; set to 0 to disable. - style;; +``style`` Which template map style to use. - templates;; +``templates`` Where to find the HTML templates. Default is install path. @@ -903,7 +922,7 @@ SEE ALSO -------- -hg(1), hgignore(5) +|hg(1)|_, |hgignore(5)|_ COPYING ------- @@ -911,3 +930,5 @@ Mercurial is copyright 2005-2009 Matt Mackall. Free use of this software is granted under the terms of the GNU General Public License (GPL). + +.. include:: common.txt
--- a/hgext/convert/__init__.py Sat Jul 18 12:34:38 2009 -0500 +++ b/hgext/convert/__init__.py Sat Jul 18 12:41:49 2009 -0500 @@ -19,6 +19,7 @@ """convert a foreign SCM repository to a Mercurial one. Accepted source formats [identifiers]: + - Mercurial [hg] - CVS [cvs] - Darcs [darcs] @@ -30,6 +31,7 @@ - Perforce [p4] Accepted destination formats [identifiers]: + - Mercurial [hg] - Subversion [svn] (history on branches is not preserved) @@ -45,21 +47,23 @@ uses --sourcesort to preserve original revision numbers order. Sort modes have the following effects: - --branchsort: convert from parent to child revision when possible, which - means branches are usually converted one after the other. It generates - more compact repositories. - --datesort: sort revisions by date. Converted repositories have - good-looking changelogs but are often an order of magnitude larger than - the same ones generated by --branchsort. - --sourcesort: try to preserve source revisions order, only supported by - Mercurial sources. + --branchsort convert from parent to child revision when possible, which + means branches are usually converted one after the other. It + generates more compact repositories. + + --datesort sort revisions by date. Converted repositories have + good-looking changelogs but are often an order of magnitude + larger than the same ones generated by --branchsort. + + --sourcesort try to preserve source revisions order, only supported by + Mercurial sources. If <REVMAP> isn't given, it will be put in a default location (<dest>/.hg/shamap by default). The <REVMAP> is a simple text file that maps each source commit ID to the destination ID for that revision, like - so: + so:: - <source ID> <destination ID> + <source ID> <destination ID> If the file doesn't exist, it's automatically created. It's updated on each commit copied, so convert-repo can be interrupted and can be run @@ -72,7 +76,7 @@ The filemap is a file that allows filtering and remapping of files and directories. Comment lines start with '#'. Each line can contain one of - the following directives: + the following directives:: include path/to/file @@ -134,17 +138,17 @@ Because CVS does not have changesets, it is necessary to collect individual commits to CVS and merge them into changesets. CVS source uses its internal changeset merging code by default but can be configured to - call the external 'cvsps' program by setting: + call the external 'cvsps' program by setting:: - --config convert.cvsps='cvsps -A -u --cvs-direct -q' + --config convert.cvsps='cvsps -A -u --cvs-direct -q' This option is deprecated and will be removed in Mercurial 1.4. The options shown are the defaults. - Internal cvsps is selected by setting + Internal cvsps is selected by setting :: - --config convert.cvsps=builtin + --config convert.cvsps=builtin and has a few more configurable options:
--- a/hgext/convert/subversion.py Sat Jul 18 12:34:38 2009 -0500 +++ b/hgext/convert/subversion.py Sat Jul 18 12:41:49 2009 -0500 @@ -454,8 +454,9 @@ # Here/tags/tag.1 discarded as well as its children. # It happens with tools like cvs2svn. Such tags cannot # be represented in mercurial. - addeds = dict((p, e.copyfrom_path) for p, e - in origpaths.iteritems() if e.action == 'A') + addeds = dict((p, e.copyfrom_path) for p, e + in origpaths.iteritems() + if e.action == 'A' and e.copyfrom_path) badroots = set() for destroot in addeds: for source, sourcerev, dest in pendings:
--- a/hgext/keyword.py Sat Jul 18 12:34:38 2009 -0500 +++ b/hgext/keyword.py Sat Jul 18 12:41:49 2009 -0500 @@ -38,7 +38,7 @@ Configuration is done in the [keyword] and [keywordmaps] sections of hgrc files. -Example: +Example:: [keyword] # expand keywords in every python file except those matching "x*"
--- a/hgext/mq.py Sat Jul 18 12:34:38 2009 -0500 +++ b/hgext/mq.py Sat Jul 18 12:41:49 2009 -0500 @@ -14,19 +14,19 @@ Known patches are represented as patch files in the .hg/patches directory. Applied patches are both patch files and changesets. -Common tasks (use "hg help command" for more details): +Common tasks (use "hg help command" for more details):: -prepare repository to work with patches qinit -create new patch qnew -import existing patch qimport + prepare repository to work with patches qinit + create new patch qnew + import existing patch qimport -print patch series qseries -print applied patches qapplied -print name of top applied patch qtop + print patch series qseries + print applied patches qapplied + print name of top applied patch qtop -add known patch to applied stack qpush -remove patch from applied stack qpop -refresh contents of top applied patch qrefresh + add known patch to applied stack qpush + remove patch from applied stack qpop + refresh contents of top applied patch qrefresh ''' from mercurial.i18n import _
--- a/hgext/notify.py Sat Jul 18 12:34:38 2009 -0500 +++ b/hgext/notify.py Sat Jul 18 12:41:49 2009 -0500 @@ -10,7 +10,7 @@ Subscriptions can be managed through a hgrc file. Default mode is to print messages to stdout, for testing and configuring. -To use, configure the notify extension and enable it in hgrc like this: +To use, configure the notify extension and enable it in hgrc like this:: [extensions] hgext.notify = @@ -24,11 +24,11 @@ [notify] # config items go here -Required configuration items: +Required configuration items:: config = /path/to/file # file containing subscriptions -Optional configuration items: +Optional configuration items:: test = True # print messages to stdout for testing strip = 3 # number of slashes to strip for url paths @@ -50,6 +50,8 @@ The notify config file has same format as a regular hgrc file. It has two sections so you can express subscriptions in whatever way is handier for you. +:: + [usersubs] # key is subscriber email, value is ","-separated list of glob patterns user@host = pattern
--- a/hgext/record.py Sat Jul 18 12:34:38 2009 -0500 +++ b/hgext/record.py Sat Jul 18 12:41:49 2009 -0500 @@ -364,19 +364,19 @@ You will be prompted for whether to record changes to each modified file, and for files with multiple changes, for each change to use. For each - query, the following responses are possible: + query, the following responses are possible:: - y - record this change - n - skip this change + y - record this change + n - skip this change - s - skip remaining changes to this file - f - record remaining changes to this file + s - skip remaining changes to this file + f - record remaining changes to this file - d - done, skip remaining changes and files - a - record all changes to all remaining files - q - quit, recording no changes + d - done, skip remaining changes and files + a - record all changes to all remaining files + q - quit, recording no changes - ? - display help''' + ? - display help''' def record_committer(ui, repo, pats, opts): commands.commit(ui, repo, *pats, **opts)
--- a/mercurial/commands.py Sat Jul 18 12:34:38 2009 -0500 +++ b/mercurial/commands.py Sat Jul 18 12:41:49 2009 -0500 @@ -14,6 +14,7 @@ import archival, changegroup, cmdutil, sshserver, hbisect from hgweb import server import merge as merge_ +import minirst # Commands start here, listed alphabetically @@ -133,14 +134,14 @@ By default, the revision used is the parent of the working directory; use -r/--rev to specify a different revision. - To specify the type of archive to create, use -t/--type. Valid types are: - - "files" (default): a directory full of files - "tar": tar archive, uncompressed - "tbz2": tar archive, compressed using bzip2 - "tgz": tar archive, compressed using gzip - "uzip": zip archive, uncompressed - "zip": zip archive, compressed using deflate + To specify the type of archive to create, use -t/--type. Valid types are:: + + "files" (default): a directory full of files + "tar": tar archive, uncompressed + "tbz2": tar archive, compressed using bzip2 + "tgz": tar archive, compressed using gzip + "uzip": zip archive, uncompressed + "zip": zip archive, compressed using deflate The exact name of the destination archive or directory is given using a format string; see 'hg help export' for details. @@ -550,11 +551,11 @@ Output may be to a file, in which case the name of the file is given using a format string. The formatting rules are the same as for the export - command, with the following additions: - - %s basename of file being printed - %d dirname of file being printed, or '.' if in repository root - %p root-relative path name of file being printed + command, with the following additions:: + + %s basename of file being printed + %d dirname of file being printed, or '.' if in repository root + %p root-relative path name of file being printed """ ctx = repo[opts.get('rev')] err = 1 @@ -600,7 +601,7 @@ cases, use the --pull option to avoid hardlinking. In some cases, you can clone repositories and checked out files using full - hardlinks with + hardlinks with :: $ cp -al REPO REPOCLONE @@ -1095,16 +1096,16 @@ it will compare the merge changeset against its first parent only. Output may be to a file, in which case the name of the file is given using - a format string. The formatting rules are as follows: - - %% literal "%" character - %H changeset hash (40 bytes of hexadecimal) - %N number of patches being generated - %R changeset revision number - %b basename of the exporting repository - %h short-form changeset hash (12 bytes of hexadecimal) - %n zero-padded sequence number, starting at 1 - %r zero-padded changeset revision number + a format string. The formatting rules are as follows:: + + %% literal "%" character + %H changeset hash (40 bytes of hexadecimal) + %N number of patches being generated + %R changeset revision number + %b basename of the exporting repository + %h short-form changeset hash (12 bytes of hexadecimal) + %n zero-padded sequence number, starting at 1 + %r zero-padded changeset revision number Without the -a/--text option, export will avoid generating diffs of files it detects as binary. With -a, export will generate a diff anyway, @@ -1397,6 +1398,7 @@ Given a topic, extension, or command name, print help for that topic. """ option_lists = [] + textwidth = util.termwidth() - 2 def addglobalopts(aliases): if ui.verbose: @@ -1449,7 +1451,7 @@ doc = _("(no help text available)") if ui.quiet: doc = doc.splitlines()[0] - ui.write("\n%s\n" % doc.rstrip()) + ui.write("\n%s\n" % minirst.format(doc, textwidth)) if not ui.quiet: # options @@ -1498,7 +1500,9 @@ if name != 'shortlist': exts, maxlength = extensions.enabled() - ui.write(help.listexts(_('enabled extensions:'), exts, maxlength)) + text = help.listexts(_('enabled extensions:'), exts, maxlength) + if text: + ui.write("\n%s\n" % minirst.format(text, textwidth)) if not ui.quiet: addglobalopts(True) @@ -1516,8 +1520,8 @@ if hasattr(doc, '__call__'): doc = doc() - ui.write("%s\n" % header) - ui.write("%s\n" % doc.rstrip()) + ui.write("%s\n\n" % header) + ui.write("%s\n" % minirst.format(doc, textwidth)) def helpext(name): try: @@ -1526,12 +1530,11 @@ raise error.UnknownCommand(name) doc = gettext(mod.__doc__) or _('no help text available') - doc = doc.splitlines() - ui.write(_('%s extension - %s\n') % (name.split('.')[-1], doc[0])) - for d in doc[1:]: - ui.write(d, '\n') - - ui.status('\n') + head, tail = doc.split('\n', 1) + ui.write(_('%s extension - %s\n\n') % (name.split('.')[-1], head)) + if tail: + ui.write(minirst.format(tail, textwidth)) + ui.status('\n\n') try: ct = mod.cmdtable @@ -2329,13 +2332,13 @@ The following table details the behavior of remove for different file states (columns) and option combinations (rows). The file states are Added [A], Clean [C], Modified [M] and Missing [!] (as reported by hg status). - The actions are Warn, Remove (from branch) and Delete (from disk). - - A C M ! - none W RD W R - -f R RD RD R - -A W W W R - -Af R R R R + The actions are Warn, Remove (from branch) and Delete (from disk):: + + A C M ! + none W RD W R + -f R RD RD R + -A W W W R + -Af R R R R This command schedules the files to be removed at the next commit. To undo a remove before that, see hg revert. @@ -2410,9 +2413,10 @@ whether or not files are resolved. All files must be marked as resolved before a commit is permitted. - The codes used to show the status of files are: - U = unresolved - R = resolved + The codes used to show the status of files are:: + + U = unresolved + R = resolved """ all, mark, unmark, show = [opts.get(o) for o in 'all mark unmark list'.split()] @@ -2675,7 +2679,7 @@ Transactions are used to encapsulate the effects of all commands that create new changesets or propagate existing changesets into a repository. For example, the following commands are transactional, and their effects - can be rolled back: + can be rolled back:: commit import @@ -2783,15 +2787,16 @@ If one revision is given, it is used as the base revision. If two revisions are given, the differences between them are shown. - The codes used to show the status of files are: - M = modified - A = added - R = removed - C = clean - ! = missing (deleted by non-hg command, but still tracked) - ? = not tracked - I = ignored - = origin of the previous file listed as A (added) + The codes used to show the status of files are:: + + M = modified + A = added + R = removed + C = clean + ! = missing (deleted by non-hg command, but still tracked) + ? = not tracked + I = ignored + = origin of the previous file listed as A (added) """ node1, node2 = cmdutil.revpair(repo, opts.get('rev'))
--- a/mercurial/help.py Sat Jul 18 12:34:38 2009 -0500 +++ b/mercurial/help.py Sat Jul 18 12:41:49 2009 -0500 @@ -43,10 +43,11 @@ '''return a text listing of the given extensions''' if not exts: return '' - result = '\n%s\n\n' % header + # TODO: literal block is wrong, should be a field list or a simple table. + result = '\n%s\n\n ::\n\n' % header for name, desc in sorted(exts.iteritems()): - desc = util.wrap(desc, maxlength + 4) - result += ' %s %s\n' % (name.ljust(maxlength), desc) + desc = util.wrap(desc, maxlength + 5) + result += ' %s %s\n' % (name.ljust(maxlength), desc) return result def extshelp(): @@ -63,18 +64,18 @@ to activate extensions as needed. To enable the "foo" extension, either shipped with Mercurial or in the - Python search path, create an entry for it in your hgrc, like this: + Python search path, create an entry for it in your hgrc, like this:: [extensions] foo = - You may also specify the full path to an extension: + You may also specify the full path to an extension:: [extensions] myfeature = ~/.hgext/myfeature.py To explicitly disable an extension enabled in an hgrc of broader scope, - prepend its path with !: + prepend its path with !:: [extensions] # disabling extension bar residing in /path/to/extension/bar.py @@ -95,24 +96,25 @@ (["dates"], _("Date Formats"), _(r''' Some commands allow the user to specify a date, e.g.: - * backout, commit, import, tag: Specify the commit date. - * log, revert, update: Select revision(s) by date. - Many date formats are valid. Here are some examples: + - backout, commit, import, tag: Specify the commit date. + - log, revert, update: Select revision(s) by date. + + Many date formats are valid. Here are some examples:: - "Wed Dec 6 13:18:29 2006" (local timezone assumed) - "Dec 6 13:18 -0600" (year assumed, time offset provided) - "Dec 6 13:18 UTC" (UTC and GMT are aliases for +0000) - "Dec 6" (midnight) - "13:18" (today assumed) - "3:39" (3:39AM assumed) - "3:39pm" (15:39) - "2006-12-06 13:18:29" (ISO 8601 format) - "2006-12-6 13:18" - "2006-12-6" - "12-6" - "12/6" - "12/6/6" (Dec 6 2006) + "Wed Dec 6 13:18:29 2006" (local timezone assumed) + "Dec 6 13:18 -0600" (year assumed, time offset provided) + "Dec 6 13:18 UTC" (UTC and GMT are aliases for +0000) + "Dec 6" (midnight) + "13:18" (today assumed) + "3:39" (3:39AM assumed) + "3:39pm" (15:39) + "2006-12-06 13:18:29" (ISO 8601 format) + "2006-12-6 13:18" + "2006-12-6" + "12-6" + "12/6" + "12/6/6" (Dec 6 2006) Lastly, there is Mercurial's internal format: @@ -123,12 +125,12 @@ offset of the local timezone, in seconds west of UTC (negative if the timezone is east of UTC). - The log command also accepts date ranges: + The log command also accepts date ranges:: - "<{datetime}" - at or before a given date/time - ">{datetime}" - on or after a given date/time - "{datetime} to {datetime}" - a date range, inclusive - "-{days}" - within a given number of days of today + "<{datetime}" - at or before a given date/time + ">{datetime}" - on or after a given date/time + "{datetime} to {datetime}" - a date range, inclusive + "-{days}" - within a given number of days of today ''')), (["patterns"], _("File Name Patterns"), @@ -146,109 +148,110 @@ repository root. To use an extended glob, start a name with "glob:". Globs are rooted at - the current directory; a glob such as "*.c" will only match files in the + the current directory; a glob such as "``*.c``" will only match files in the current directory ending with ".c". - The supported glob syntax extensions are "**" to match any string across + The supported glob syntax extensions are "``**``" to match any string across path separators and "{a,b}" to mean "a or b". To use a Perl/Python regular expression, start a name with "re:". Regexp pattern matching is anchored at the root of the repository. - Plain examples: + Plain examples:: - path:foo/bar a name bar in a directory named foo in the root of - the repository - path:path:name a file or directory named "path:name" + path:foo/bar a name bar in a directory named foo in the root of + the repository + path:path:name a file or directory named "path:name" - Glob examples: + Glob examples:: - glob:*.c any name ending in ".c" in the current directory - *.c any name ending in ".c" in the current directory - **.c any name ending in ".c" in any subdirectory of the current - directory including itself. - foo/*.c any name ending in ".c" in the directory foo - foo/**.c any name ending in ".c" in any subdirectory of foo - including itself. + glob:*.c any name ending in ".c" in the current directory + *.c any name ending in ".c" in the current directory + **.c any name ending in ".c" in any subdirectory of the + current directory including itself. + foo/*.c any name ending in ".c" in the directory foo + foo/**.c any name ending in ".c" in any subdirectory of foo + including itself. - Regexp examples: + Regexp examples:: - re:.*\.c$ any name ending in ".c", anywhere in the repository + re:.*\.c$ any name ending in ".c", anywhere in the repository ''')), (['environment', 'env'], _('Environment Variables'), _(r''' -HG:: +HG Path to the 'hg' executable, automatically passed when running hooks, extensions or external tools. If unset or empty, this is the hg executable's name if it's frozen, or an executable named 'hg' (with %PATHEXT% [defaulting to COM/EXE/BAT/CMD] extensions on Windows) is searched. -HGEDITOR:: +HGEDITOR This is the name of the editor to run when committing. See EDITOR. (deprecated, use .hgrc) -HGENCODING:: +HGENCODING This overrides the default locale setting detected by Mercurial. This setting is used to convert data including usernames, changeset descriptions, tag names, and branches. This setting can be overridden with the --encoding command-line option. -HGENCODINGMODE:: +HGENCODINGMODE This sets Mercurial's behavior for handling unknown characters while transcoding user input. The default is "strict", which causes Mercurial to abort if it can't map a character. Other settings include "replace", which replaces unknown characters, and "ignore", which drops them. This setting can be overridden with the --encodingmode command-line option. -HGMERGE:: +HGMERGE An executable to use for resolving merge conflicts. The program will be executed with three arguments: local file, remote file, ancestor file. (deprecated, use .hgrc) -HGRCPATH:: +HGRCPATH A list of files or directories to search for hgrc files. Item separator is ":" on Unix, ";" on Windows. If HGRCPATH is not set, platform default search path is used. If empty, only the .hg/hgrc from the current repository is read. For each element in HGRCPATH: - * if it's a directory, all files ending with .rc are added - * otherwise, the file itself will be added -HGUSER:: + - if it's a directory, all files ending with .rc are added + - otherwise, the file itself will be added + +HGUSER This is the string used as the author of a commit. If not set, available values will be considered in this order: - * HGUSER (deprecated) - * hgrc files from the HGRCPATH - * EMAIL - * interactive prompt - * LOGNAME (with '@hostname' appended) + - HGUSER (deprecated) + - hgrc files from the HGRCPATH + - EMAIL + - interactive prompt + - LOGNAME (with '@hostname' appended) (deprecated, use .hgrc) -EMAIL:: +EMAIL May be used as the author of a commit; see HGUSER. -LOGNAME:: +LOGNAME May be used as the author of a commit; see HGUSER. -VISUAL:: +VISUAL This is the name of the editor to use when committing. See EDITOR. -EDITOR:: +EDITOR Sometimes Mercurial needs to open a text file in an editor for a user to modify, for example when writing commit messages. The editor it uses is determined by looking at the environment variables HGEDITOR, VISUAL and EDITOR, in that order. The first non-empty one is chosen. If all of them are empty, the editor defaults to 'vi'. -PYTHONPATH:: +PYTHONPATH This is used by Python to find imported modules and may need to be set appropriately if this Mercurial is not installed system-wide. ''')), @@ -359,18 +362,18 @@ - author: String. The unmodified author of the changeset. - branches: String. The name of the branch on which the changeset was - committed. Will be empty if the branch name was default. + committed. Will be empty if the branch name was default. - date: Date information. The date when the changeset was committed. - desc: String. The text of the changeset description. - diffstat: String. Statistics of changes with the following format: - "modified files: +added/-removed lines" + "modified files: +added/-removed lines" - files: List of strings. All files modified, added, or removed by this - changeset. + changeset. - file_adds: List of strings. Files added by this changeset. - file_mods: List of strings. Files modified by this changeset. - file_dels: List of strings. Files removed by this changeset. - node: String. The changeset identification hash, as a 40-character - hexadecimal string. + hexadecimal string. - parents: List of strings. The parents of the changeset. - rev: Integer. The repository-local changeset revision number. - tags: List of strings. Any tags associated with the changeset. @@ -386,52 +389,51 @@ List of filters: - addbreaks: Any text. Add an XHTML "<br />" tag before the end of every - line except the last. + line except the last. - age: Date. Returns a human-readable date/time difference between the - given date/time and the current date/time. + given date/time and the current date/time. - basename: Any text. Treats the text as a path, and returns the last - component of the path after splitting by the path separator - (ignoring trailing separators). For example, "foo/bar/baz" becomes - "baz" and "foo/bar//" becomes "bar". + component of the path after splitting by the path separator (ignoring + trailing separators). For example, "foo/bar/baz" becomes "baz" and + "foo/bar//" becomes "bar". - stripdir: Treat the text as path and strip a directory level, if - possible. For example, "foo" and "foo/bar" becomes "foo". + possible. For example, "foo" and "foo/bar" becomes "foo". - date: Date. Returns a date in a Unix date format, including the - timezone: "Mon Sep 04 15:13:13 2006 0700". + timezone: "Mon Sep 04 15:13:13 2006 0700". - domain: Any text. Finds the first string that looks like an email - address, and extracts just the domain component. Example: 'User - <user@example.com>' becomes 'example.com'. + address, and extracts just the domain component. Example: 'User + <user@example.com>' becomes 'example.com'. - email: Any text. Extracts the first string that looks like an email - address. Example: 'User <user@example.com>' becomes - 'user@example.com'. + address. Example: 'User <user@example.com>' becomes 'user@example.com'. - escape: Any text. Replaces the special XML/XHTML characters "&", "<" and - ">" with XML entities. + ">" with XML entities. - fill68: Any text. Wraps the text to fit in 68 columns. - fill76: Any text. Wraps the text to fit in 76 columns. - firstline: Any text. Returns the first line of text. - nonempty: Any text. Returns '(none)' if the string is empty. - hgdate: Date. Returns the date as a pair of numbers: "1157407993 25200" - (Unix timestamp, timezone offset). + (Unix timestamp, timezone offset). - isodate: Date. Returns the date in ISO 8601 format. - localdate: Date. Converts a date to local date. - obfuscate: Any text. Returns the input text rendered as a sequence of - XML entities. + XML entities. - person: Any text. Returns the text before an email address. - rfc822date: Date. Returns a date using the same format used in email - headers. + headers. - short: Changeset hash. Returns the short form of a changeset hash, i.e. - a 12-byte hexadecimal string. + a 12-byte hexadecimal string. - shortdate: Date. Returns a date like "2006-09-18". - strip: Any text. Strips all leading and trailing whitespace. - tabindent: Any text. Returns the text, with every line except the first - starting with a tab character. + starting with a tab character. - urlescape: Any text. Escapes all "special" characters. For example, "foo - bar" becomes "foo%20bar". + bar" becomes "foo%20bar". - user: Any text. Returns the user portion of an email address. ''')), (['urls'], _('URL Paths'), _(r''' - Valid URLs are of the form: + Valid URLs are of the form:: local/filesystem/path[#revision] file://local/filesystem/path[#revision] @@ -450,26 +452,32 @@ server. Some notes about using SSH with Mercurial: + - SSH requires an accessible shell account on the destination machine and a copy of hg in the remote path or specified with as remotecmd. - path is relative to the remote user's home directory by default. Use an - extra slash at the start of a path to specify an absolute path: + extra slash at the start of a path to specify an absolute path:: + ssh://example.com//tmp/repository + - Mercurial doesn't use its own compression via SSH; the right thing to do - is to configure it in your ~/.ssh/config, e.g.: + is to configure it in your ~/.ssh/config, e.g.:: + Host *.mylocalnetwork.example.com Compression no Host * Compression yes + Alternatively specify "ssh -C" as your ssh command in your hgrc or with the --ssh command line option. These URLs can all be stored in your hgrc with path aliases under the - [paths] section like so: - [paths] - alias1 = URL1 - alias2 = URL2 - ... + [paths] section like so:: + + [paths] + alias1 = URL1 + alias2 = URL2 + ... You can then use the alias for any command that uses a URL (for example 'hg pull alias1' would pull from the 'alias1' path).
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mercurial/minirst.py Sat Jul 18 12:41:49 2009 -0500 @@ -0,0 +1,299 @@ +# minirst.py - minimal reStructuredText parser +# +# Copyright 2009 Matt Mackall <mpm@selenic.com> and others +# +# This software may be used and distributed according to the terms of the +# GNU General Public License version 2, incorporated herein by reference. + +"""simplified reStructuredText parser. + +This parser knows just enough about reStructuredText to parse the +Mercurial docstrings. + +It cheats in a major way: nested blocks are not really nested. They +are just indented blocks that look like they are nested. This relies +on the user to keep the right indentation for the blocks. + +It only supports a small subset of reStructuredText: + +- paragraphs + +- definition lists (must use ' ' to indent definitions) + +- lists (items must start with '-') + +- literal blocks + +- option lists (supports only long options without arguments) + +- inline markup is not recognized at all. +""" + +import re, sys, textwrap + + +def findblocks(text): + """Find continuous blocks of lines in text. + + Returns a list of dictionaries representing the blocks. Each block + has an 'indent' field and a 'lines' field. + """ + blocks = [[]] + lines = text.splitlines() + for line in lines: + if line.strip(): + blocks[-1].append(line) + elif blocks[-1]: + blocks.append([]) + if not blocks[-1]: + del blocks[-1] + + for i, block in enumerate(blocks): + indent = min((len(l) - len(l.lstrip())) for l in block) + blocks[i] = dict(indent=indent, lines=[l[indent:] for l in block]) + return blocks + + +def findliteralblocks(blocks): + """Finds literal blocks and adds a 'type' field to the blocks. + + Literal blocks are given the type 'literal', all other blocks are + given type the 'paragraph'. + """ + i = 0 + while i < len(blocks): + # Searching for a block that looks like this: + # + # +------------------------------+ + # | paragraph | + # | (ends with "::") | + # +------------------------------+ + # +---------------------------+ + # | indented literal block | + # +---------------------------+ + blocks[i]['type'] = 'paragraph' + if blocks[i]['lines'][-1].endswith('::') and i+1 < len(blocks): + indent = blocks[i]['indent'] + adjustment = blocks[i+1]['indent'] - indent + + if blocks[i]['lines'] == ['::']: + # Expanded form: remove block + del blocks[i] + i -= 1 + elif blocks[i]['lines'][-1].endswith(' ::'): + # Partially minimized form: remove space and both + # colons. + blocks[i]['lines'][-1] = blocks[i]['lines'][-1][:-3] + else: + # Fully minimized form: remove just one colon. + blocks[i]['lines'][-1] = blocks[i]['lines'][-1][:-1] + + # List items are formatted with a hanging indent. We must + # correct for this here while we still have the original + # information on the indentation of the subsequent literal + # blocks available. + if blocks[i]['lines'][0].startswith('- '): + indent += 2 + adjustment -= 2 + + # Mark the following indented blocks. + while i+1 < len(blocks) and blocks[i+1]['indent'] > indent: + blocks[i+1]['type'] = 'literal' + blocks[i+1]['indent'] -= adjustment + i += 1 + i += 1 + return blocks + + +def findsections(blocks): + """Finds sections. + + The blocks must have a 'type' field, i.e., they should have been + run through findliteralblocks first. + """ + for block in blocks: + # Searching for a block that looks like this: + # + # +------------------------------+ + # | Section title | + # | ------------- | + # +------------------------------+ + if (block['type'] == 'paragraph' and + len(block['lines']) == 2 and + block['lines'][1] == '-' * len(block['lines'][0])): + block['type'] = 'section' + return blocks + + +def findbulletlists(blocks): + """Finds bullet lists. + + The blocks must have a 'type' field, i.e., they should have been + run through findliteralblocks first. + """ + i = 0 + while i < len(blocks): + # Searching for a paragraph that looks like this: + # + # +------+-----------------------+ + # | "- " | list item | + # +------| (body elements)+ | + # +-----------------------+ + if (blocks[i]['type'] == 'paragraph' and + blocks[i]['lines'][0].startswith('- ')): + items = [] + for line in blocks[i]['lines']: + if line.startswith('- '): + items.append(dict(type='bullet', lines=[], + indent=blocks[i]['indent'] + 2)) + line = line[2:] + items[-1]['lines'].append(line) + blocks[i:i+1] = items + i += len(items) - 1 + i += 1 + return blocks + + +_optionre = re.compile(r'^(--[a-z-]+)((?:[ =][a-zA-Z][\w-]*)? +)(.*)$') +def findoptionlists(blocks): + """Finds option lists. + + The blocks must have a 'type' field, i.e., they should have been + run through findliteralblocks first. + """ + i = 0 + while i < len(blocks): + # Searching for a paragraph that looks like this: + # + # +----------------------------+-------------+ + # | "--" option " " | description | + # +-------+--------------------+ | + # | (body elements)+ | + # +----------------------------------+ + if (blocks[i]['type'] == 'paragraph' and + _optionre.match(blocks[i]['lines'][0])): + options = [] + for line in blocks[i]['lines']: + m = _optionre.match(line) + if m: + option, arg, rest = m.groups() + width = len(option) + len(arg) + options.append(dict(type='option', lines=[], + indent=blocks[i]['indent'], + width=width)) + options[-1]['lines'].append(line) + blocks[i:i+1] = options + i += len(options) - 1 + i += 1 + return blocks + + +def finddefinitionlists(blocks): + """Finds definition lists. + + The blocks must have a 'type' field, i.e., they should have been + run through findliteralblocks first. + """ + i = 0 + while i < len(blocks): + # Searching for a paragraph that looks like this: + # + # +----------------------------+ + # | term | + # +--+-------------------------+--+ + # | definition | + # | (body elements)+ | + # +----------------------------+ + if (blocks[i]['type'] == 'paragraph' and + len(blocks[i]['lines']) > 1 and + not blocks[i]['lines'][0].startswith(' ') and + blocks[i]['lines'][1].startswith(' ')): + definitions = [] + for line in blocks[i]['lines']: + if not line.startswith(' '): + definitions.append(dict(type='definition', lines=[], + indent=blocks[i]['indent'])) + definitions[-1]['lines'].append(line) + definitions[-1]['hang'] = len(line) - len(line.lstrip()) + blocks[i:i+1] = definitions + i += len(definitions) - 1 + i += 1 + return blocks + + +def addmargins(blocks): + """Adds empty blocks for vertical spacing. + + This groups bullets, options, and definitions together with no vertical + space between them, and adds an empty block between all other blocks. + """ + i = 1 + while i < len(blocks): + if (blocks[i]['type'] == blocks[i-1]['type'] and + blocks[i]['type'] in ('bullet', 'option', 'definition')): + i += 1 + else: + blocks.insert(i, dict(lines=[''], indent=0, type='margin')) + i += 2 + return blocks + + +def formatblock(block, width): + """Format a block according to width.""" + indent = ' ' * block['indent'] + if block['type'] == 'margin': + return '' + elif block['type'] in ('literal', 'section'): + return indent + ('\n' + indent).join(block['lines']) + elif block['type'] == 'definition': + term = indent + block['lines'][0] + defindent = indent + block['hang'] * ' ' + text = ' '.join(map(str.strip, block['lines'][1:])) + return "%s\n%s" % (term, textwrap.fill(text, width=width, + initial_indent=defindent, + subsequent_indent=defindent)) + else: + initindent = subindent = indent + text = ' '.join(map(str.strip, block['lines'])) + if block['type'] == 'bullet': + initindent = indent[:-2] + '- ' + subindent = indent + elif block['type'] == 'option': + subindent = indent + block['width'] * ' ' + + return textwrap.fill(text, width=width, + initial_indent=initindent, + subsequent_indent=subindent) + + +def format(text, width): + """Parse and format the text according to width.""" + blocks = findblocks(text) + blocks = findliteralblocks(blocks) + blocks = findsections(blocks) + blocks = findbulletlists(blocks) + blocks = findoptionlists(blocks) + blocks = finddefinitionlists(blocks) + blocks = addmargins(blocks) + return '\n'.join(formatblock(b, width) for b in blocks) + + +if __name__ == "__main__": + from pprint import pprint + + def debug(func, blocks): + blocks = func(blocks) + print "*** after %s:" % func.__name__ + pprint(blocks) + print + return blocks + + text = open(sys.argv[1]).read() + blocks = debug(findblocks, text) + blocks = debug(findliteralblocks, blocks) + blocks = debug(findsections, blocks) + blocks = debug(findbulletlists, blocks) + blocks = debug(findoptionlists, blocks) + blocks = debug(finddefinitionlists, blocks) + blocks = debug(addmargins, blocks) + print '\n'.join(formatblock(b, 30) for b in blocks)
--- a/mercurial/util.py Sat Jul 18 12:34:38 2009 -0500 +++ b/mercurial/util.py Sat Jul 18 12:41:49 2009 -0500 @@ -1272,7 +1272,9 @@ pass return 80 -def wrap(line, hangindent, width=78): +def wrap(line, hangindent, width=None): + if width is None: + width = termwidth() - 2 padding = '\n' + ' ' * hangindent return padding.join(textwrap.wrap(line, width=width - hangindent))
--- a/tests/test-convert.out Sat Jul 18 12:34:38 2009 -0500 +++ b/tests/test-convert.out Sat Jul 18 12:41:49 2009 -0500 @@ -3,6 +3,7 @@ convert a foreign SCM repository to a Mercurial one. Accepted source formats [identifiers]: + - Mercurial [hg] - CVS [cvs] - Darcs [darcs] @@ -14,6 +15,7 @@ - Perforce [p4] Accepted destination formats [identifiers]: + - Mercurial [hg] - Subversion [svn] (history on branches is not preserved) @@ -29,14 +31,14 @@ uses --sourcesort to preserve original revision numbers order. Sort modes have the following effects: - --branchsort: convert from parent to child revision when possible, which - means branches are usually converted one after the other. It generates - more compact repositories. - --datesort: sort revisions by date. Converted repositories have - good-looking changelogs but are often an order of magnitude larger than - the same ones generated by --branchsort. - --sourcesort: try to preserve source revisions order, only supported by - Mercurial sources. + --branchsort convert from parent to child revision when possible, which + means branches are usually converted one after the other. It + generates more compact repositories. + --datesort sort revisions by date. Converted repositories have good- + looking changelogs but are often an order of magnitude + larger than the same ones generated by --branchsort. + --sourcesort try to preserve source revisions order, only supported by + Mercurial sources. If <REVMAP> isn't given, it will be put in a default location (<dest>/.hg/shamap by default). The <REVMAP> is a simple text file that @@ -58,11 +60,11 @@ directories. Comment lines start with '#'. Each line can contain one of the following directives: - include path/to/file + include path/to/file - exclude path/to/file + exclude path/to/file - rename from/file to/file + rename from/file to/file The 'include' directive causes a file, or all files under a directory, to be included in the destination repository, and the exclusion of all other
--- a/tests/test-help.out Sat Jul 18 12:34:38 2009 -0500 +++ b/tests/test-help.out Sat Jul 18 12:41:49 2009 -0500 @@ -267,6 +267,7 @@ revisions are given, the differences between them are shown. The codes used to show the status of files are: + M = modified A = added R = removed
--- a/tests/test-keyword.out Sat Jul 18 12:34:38 2009 -0500 +++ b/tests/test-keyword.out Sat Jul 18 12:41:49 2009 -0500 @@ -13,10 +13,10 @@ Example: - [keyword] - # expand keywords in every python file except those matching "x*" - **.py = - x* = ignore +[keyword] +# expand keywords in every python file except those matching "x*" +**.py = +x* = ignore NOTE: the more specific you are in your filename patterns the less you lose speed in huge repositories.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-minirst.py Sat Jul 18 12:41:49 2009 -0500 @@ -0,0 +1,138 @@ +#!/usr/bin/env python + +from mercurial import minirst + +def debugformat(title, text, width): + print "%s formatted to fit within %d characters:" % (title, width) + print "-" * 70 + print minirst.format(text, width) + print "-" * 70 + print + +paragraphs = """ +This is some text in the first paragraph. + + An indented paragraph + with just two lines. + + +The third paragraph. It is followed by some +random lines with spurious spaces. + + + + + +No indention + here, despite +the uneven left + margin. + + Only the + left-most line + (this line!) + is significant + for the indentation + +""" + +debugformat('paragraphs', paragraphs, 60) +debugformat('paragraphs', paragraphs, 30) + + +definitions = """ +A Term + Definition. The indented + lines make up the definition. +Another Term + Another definition. The final line in the + definition determines the indentation, so + this will be indented with four spaces. + + A Nested/Indented Term + Definition. +""" + +debugformat('definitions', definitions, 60) +debugformat('definitions', definitions, 30) + + +literals = r""" +The fully minimized form is the most +convenient form:: + + Hello + literal + world + +In the partially minimized form a paragraph +simply ends with space-double-colon. :: + + //////////////////////////////////////// + long un-wrapped line in a literal block + \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ + +:: + + This literal block is started with '::', + the so-called expanded form. The paragraph + with '::' disappears in the final output. +""" + +debugformat('literals', literals, 60) +debugformat('literals', literals, 30) + + +lists = """ +- This is the first list item. + + Second paragraph in the first list item. + +- List items need not be separated + by a blank line. +- And will be rendered without + one in any case. + +We can have indented lists: + + - This is an indented list item + + - Another indented list item:: + + - A literal block in the middle + of an indented list. + + (The above is not a list item since we are in the literal block.) + +:: + + Literal block with no indentation. +""" + +debugformat('lists', lists, 60) +debugformat('lists', lists, 30) + + +options = """ +There is support for simple option lists, +but only with long options: + +--all Output all. +--both Output both (this description is + quite long). +--long Output all day long. + +--par This option has two paragraphs in its description. + This is the first. + + This is the second. Blank lines may be omitted between + options (as above) or left in (as here). + +The next paragraph looks like an option list, but lacks the two-space +marker after the option. It is treated as a normal paragraph: + +--foo bar baz +""" + +debugformat('options', options, 60) +debugformat('options', options, 30)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-minirst.py.out Sat Jul 18 12:41:49 2009 -0500 @@ -0,0 +1,209 @@ +paragraphs formatted to fit within 60 characters: +---------------------------------------------------------------------- +This is some text in the first paragraph. + + An indented paragraph with just two lines. + +The third paragraph. It is followed by some random lines +with spurious spaces. + +No indention here, despite the uneven left margin. + + Only the left-most line (this line!) is significant for + the indentation +---------------------------------------------------------------------- + +paragraphs formatted to fit within 30 characters: +---------------------------------------------------------------------- +This is some text in the first +paragraph. + + An indented paragraph with + just two lines. + +The third paragraph. It is +followed by some random lines +with spurious spaces. + +No indention here, despite the +uneven left margin. + + Only the left-most line + (this line!) is significant + for the indentation +---------------------------------------------------------------------- + +definitions formatted to fit within 60 characters: +---------------------------------------------------------------------- +A Term + Definition. The indented lines make up the definition. +Another Term + Another definition. The final line in the definition + determines the indentation, so this will be indented + with four spaces. + A Nested/Indented Term + Definition. +---------------------------------------------------------------------- + +definitions formatted to fit within 30 characters: +---------------------------------------------------------------------- +A Term + Definition. The indented + lines make up the + definition. +Another Term + Another definition. The + final line in the + definition determines the + indentation, so this will + be indented with four + spaces. + A Nested/Indented Term + Definition. +---------------------------------------------------------------------- + +literals formatted to fit within 60 characters: +---------------------------------------------------------------------- +The fully minimized form is the most convenient form: + +Hello + literal + world + +In the partially minimized form a paragraph simply ends with +space-double-colon. + +//////////////////////////////////////// +long un-wrapped line in a literal block +\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ + +This literal block is started with '::', + the so-called expanded form. The paragraph + with '::' disappears in the final output. +---------------------------------------------------------------------- + +literals formatted to fit within 30 characters: +---------------------------------------------------------------------- +The fully minimized form is +the most convenient form: + +Hello + literal + world + +In the partially minimized +form a paragraph simply ends +with space-double-colon. + +//////////////////////////////////////// +long un-wrapped line in a literal block +\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ + +This literal block is started with '::', + the so-called expanded form. The paragraph + with '::' disappears in the final output. +---------------------------------------------------------------------- + +lists formatted to fit within 60 characters: +---------------------------------------------------------------------- +- This is the first list item. + + Second paragraph in the first list item. + +- List items need not be separated by a blank line. +- And will be rendered without one in any case. + +We can have indented lists: + + - This is an indented list item + - Another indented list item: + + - A literal block in the middle + of an indented list. + + (The above is not a list item since we are in the literal block.) + +Literal block with no indentation. +---------------------------------------------------------------------- + +lists formatted to fit within 30 characters: +---------------------------------------------------------------------- +- This is the first list item. + + Second paragraph in the + first list item. + +- List items need not be + separated by a blank line. +- And will be rendered without + one in any case. + +We can have indented lists: + + - This is an indented list + item + - Another indented list + item: + + - A literal block in the middle + of an indented list. + + (The above is not a list item since we are in the literal block.) + +Literal block with no indentation. +---------------------------------------------------------------------- + +options formatted to fit within 60 characters: +---------------------------------------------------------------------- +There is support for simple option lists, but only with long +options: + +--all Output all. +--both Output both (this description is quite long). +--long Output all day long. +--par This option has two paragraphs in its + description. This is the first. + + This is the second. Blank lines may be omitted + between options (as above) or left in (as here). + +The next paragraph looks like an option list, but lacks the +two-space marker after the option. It is treated as a normal +paragraph: + +--foo bar baz +---------------------------------------------------------------------- + +options formatted to fit within 30 characters: +---------------------------------------------------------------------- +There is support for simple +option lists, but only with +long options: + +--all Output all. +--both Output both (this + description is + quite long). +--long Output all day + long. +--par This option has two + paragraphs in its + description. This + is the first. + + This is the second. + Blank lines may be + omitted between + options (as above) + or left in (as + here). + +The next paragraph looks like +an option list, but lacks the +two-space marker after the +option. It is treated as a +normal paragraph: + +--foo bar baz +---------------------------------------------------------------------- +
--- a/tests/test-notify.out Sat Jul 18 12:34:38 2009 -0500 +++ b/tests/test-notify.out Sat Jul 18 12:41:49 2009 -0500 @@ -5,51 +5,51 @@ To use, configure the notify extension and enable it in hgrc like this: - [extensions] - hgext.notify = +[extensions] +hgext.notify = - [hooks] - # one email for each incoming changeset - incoming.notify = python:hgext.notify.hook - # batch emails when many changesets incoming at one time - changegroup.notify = python:hgext.notify.hook +[hooks] +# one email for each incoming changeset +incoming.notify = python:hgext.notify.hook +# batch emails when many changesets incoming at one time +changegroup.notify = python:hgext.notify.hook - [notify] - # config items go here +[notify] +# config items go here Required configuration items: - config = /path/to/file # file containing subscriptions +config = /path/to/file # file containing subscriptions Optional configuration items: - test = True # print messages to stdout for testing - strip = 3 # number of slashes to strip for url paths - domain = example.com # domain to use if committer missing domain - style = ... # style file to use when formatting email - template = ... # template to use when formatting email - incoming = ... # template to use when run as incoming hook - changegroup = ... # template when run as changegroup hook - maxdiff = 300 # max lines of diffs to include (0=none, -1=all) - maxsubject = 67 # truncate subject line longer than this - diffstat = True # add a diffstat before the diff content - sources = serve # notify if source of incoming changes in this list - # (serve == ssh or http, push, pull, bundle) - [email] - from = user@host.com # email address to send as if none given - [web] - baseurl = http://hgserver/... # root of hg web site for browsing commits +test = True # print messages to stdout for testing +strip = 3 # number of slashes to strip for url paths +domain = example.com # domain to use if committer missing domain +style = ... # style file to use when formatting email +template = ... # template to use when formatting email +incoming = ... # template to use when run as incoming hook +changegroup = ... # template when run as changegroup hook +maxdiff = 300 # max lines of diffs to include (0=none, -1=all) +maxsubject = 67 # truncate subject line longer than this +diffstat = True # add a diffstat before the diff content +sources = serve # notify if source of incoming changes in this list + # (serve == ssh or http, push, pull, bundle) +[email] +from = user@host.com # email address to send as if none given +[web] +baseurl = http://hgserver/... # root of hg web site for browsing commits The notify config file has same format as a regular hgrc file. It has two sections so you can express subscriptions in whatever way is handier for you. - [usersubs] - # key is subscriber email, value is ","-separated list of glob patterns - user@host = pattern +[usersubs] +# key is subscriber email, value is ","-separated list of glob patterns +user@host = pattern - [reposubs] - # key is glob pattern, value is ","-separated list of subscriber emails - pattern = user@host +[reposubs] +# key is glob pattern, value is ","-separated list of subscriber emails +pattern = user@host Glob patterns are matched against path to repository root.