diff --git a/Makefile b/Makefile --- a/Makefile +++ b/Makefile @@ -98,7 +98,7 @@ i18n/hg.pot: $(PYTHON_FILES) mercurial/h xgettext --package-name "Mercurial" \ --msgid-bugs-address "" \ --copyright-holder "Matt Mackall and others" \ - --from-code ISO-8859-1 --join --sort-by-file \ + --from-code ISO-8859-1 --join --sort-by-file --add-comments=i18n: \ -d hg -p i18n -o hg.pot $(PYTHON) i18n/posplit i18n/hg.pot diff --git a/doc/gendoc.py b/doc/gendoc.py --- a/doc/gendoc.py +++ b/doc/gendoc.py @@ -79,7 +79,7 @@ def show_doc(ui): # print options section(ui, _("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 section(ui, _("Commands")) @@ -97,7 +97,7 @@ def show_doc(ui): ui.write("\n") section(ui, _("Extensions")) - ui.write(_("This section contains help for extensions that is distributed " + ui.write(_("This section contains help for extensions that are distributed " "together with Mercurial. Help for other extensions is available " "in the help system.")) ui.write("\n\n" @@ -130,8 +130,13 @@ def commandprinter(ui, cmdtable, section d = get_cmd(h[f], cmdtable) sectionfunc(ui, d['cmd']) # synopsis - ui.write("``%s``\n" % d['synopsis'].replace("hg ","", 1)) - ui.write("\n") + ui.write("::\n\n") + synopsislines = d['synopsis'].splitlines() + for line in synopsislines: + # some commands (such as rebase) have a multi-line + # synopsis + ui.write(" %s\n" % line) + ui.write('\n') # description ui.write("%s\n\n" % d['desc'][1]) # options diff --git a/hg b/hg --- a/hg +++ b/hg @@ -14,7 +14,8 @@ libdir = '@LIBDIR@' if libdir != '@' 'LIBDIR' '@': if not os.path.isabs(libdir): - libdir = os.path.join(os.path.dirname(__file__), libdir) + libdir = os.path.join(os.path.dirname(os.path.realpath(__file__)), + libdir) libdir = os.path.abspath(libdir) sys.path.insert(0, libdir) diff --git a/hgext/color.py b/hgext/color.py --- a/hgext/color.py +++ b/hgext/color.py @@ -226,6 +226,8 @@ def uisetup(ui): def extsetup(ui): commands.globalopts.append( ('', 'color', 'auto', + # i18n: 'always', 'auto', and 'never' are keywords and should + # not be translated _("when to colorize (boolean, always, auto, or never)"), _('TYPE'))) diff --git a/hgext/eol.py b/hgext/eol.py --- a/hgext/eol.py +++ b/hgext/eol.py @@ -51,7 +51,7 @@ The extension uses an optional ``[eol]`` behavior. There are two settings: - ``eol.native`` (default ``os.linesep``) can be set to ``LF`` or - ``CRLF`` override the default interpretation of ``native`` for + ``CRLF`` to override the default interpretation of ``native`` for checkout. This can be used with :hg:`archive` on Unix, say, to generate an archive where files have line endings for Windows. diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -278,7 +278,11 @@ def backout(ui, repo, node=None, rev=Non revert_opts['no_backup'] = None revert(ui, repo, **revert_opts) if not opts.get('merge') and op1 != node: - return hg.update(repo, op1) + try: + ui.setconfig('ui', 'forcemerge', opts.get('tool', '')) + return hg.update(repo, op1) + finally: + ui.setconfig('ui', 'forcemerge', '') commit_opts = opts.copy() commit_opts['addremove'] = False @@ -295,7 +299,11 @@ def backout(ui, repo, node=None, rev=Non hg.clean(repo, op1, show_stats=False) ui.status(_('merging with changeset %s\n') % nice(repo.changelog.tip())) - return hg.merge(repo, hex(repo.changelog.tip())) + try: + ui.setconfig('ui', 'forcemerge', opts.get('tool', '')) + return hg.merge(repo, hex(repo.changelog.tip())) + finally: + ui.setconfig('ui', 'forcemerge', '') return 0 def bisect(ui, repo, rev=None, extra=None, command=None, @@ -2438,7 +2446,7 @@ def log(ui, repo, *pats, **opts): ancestors or descendants of the starting revision. --follow-first only follows the first parent of merge revisions. - If no revision range is specified, the default is tip:0 unless + If no revision range is specified, the default is ``tip:0`` unless --follow is set, in which case the working directory parent is used as the starting revision. You can specify a revision set for log, see :hg:`help revsets` for more information. @@ -2943,7 +2951,7 @@ def resolve(ui, repo, *pats, **opts): The resolve command can be used in the following ways: - - :hg:`resolve [--tool] FILE...`: attempt to re-merge the specified + - :hg:`resolve [--tool TOOL] FILE...`: attempt to re-merge the specified files, discarding any previous merge attempts. Re-merging is not performed for files already marked as resolved. Use ``--all/-a`` to selects all unresolved files. ``--tool`` can be used to specify @@ -4005,6 +4013,8 @@ table = { _('merge with old dirstate parent after backout')), ('', 'parent', '', _('parent to choose when backing out merge'), _('REV')), + ('t', 'tool', '', + _('specify merge tool')), ('r', 'rev', '', _('revision to backout'), _('REV')), ] + walkopts + commitopts + commitopts2, diff --git a/mercurial/demandimport.py b/mercurial/demandimport.py --- a/mercurial/demandimport.py +++ b/mercurial/demandimport.py @@ -45,7 +45,7 @@ class _demandmod(object): if not self._module: head, globals, locals, after, level = self._data if level is not None: - mod = _origimport(head, globals, locals, level=level) + mod = _origimport(head, globals, locals, level) else: mod = _origimport(head, globals, locals) # load submodules diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py --- a/mercurial/dispatch.py +++ b/mercurial/dispatch.py @@ -24,7 +24,7 @@ def dispatch(args): except util.Abort, inst: sys.stderr.write(_("abort: %s\n") % inst) if inst.hint: - sys.stderr.write("(%s)\n" % inst.hint) + sys.stderr.write(_("(%s)\n") % inst.hint) return -1 except error.ParseError, inst: if len(inst.args) > 1: diff --git a/mercurial/help/merge-tools.txt b/mercurial/help/merge-tools.txt --- a/mercurial/help/merge-tools.txt +++ b/mercurial/help/merge-tools.txt @@ -5,23 +5,38 @@ file. Merge tools are given the two file ancestor of the two file versions, so they can determine the changes made on both branches. -The merge tools are used both for :hg:`resolve` and :hg:`merge`. +Merge tools are used both for :hg:`resolve`, :hg:`merge`, :hg:`update`, +:hg:`backout` and in several extensions. -Usually, the merge tool tries to automatically, by combining all the -non-overlapping changes that occurred separately in the two different -evolutions of the same initial base file. Furthermore, some +Usually, the merge tool tries to automatically reconcile the files by +combining all non-overlapping changes that occurred separately in +the two different evolutions of the same initial base file. Furthermore, some interactive merge programs make it easier to manually resolve conflicting merges, either in a graphical way, or by inserting some conflict markers. Mercurial does not include any interactive merge -programs but relies on external tools for that. External merge tools -and their properties and usage is configured in merge-tools section - -see hgrc(5). +programs but relies on external tools for that. + +Available merge tools +""""""""""""""""""""" + +External merge tools and their properties and usage is configured in the +merge-tools configuration section - see hgrc(5) - but they can often also just +be named by their executable. + +A merge tool is generally usable if its executable can be found on the +system and if it can handle the merge. The executable can be found on the +system if it either is an absolute or relative executable path or the name of +an application in the executable search path. The tool is assumed to be able +to handle the merge if it can handle symlinks if the file is a symlink, if it +can handle binary files if the file is binary, and if a GUI is available if the +tool requires a GUI. There are a some internal merge tools which can be used. The internal merge tools are: ``internal:merge`` - Uses the internal non-interactive merge tool for merging files. + Uses the internal non-interactive simple merge algorithm for merging files. + It will fail if there are any conflicts. ``internal:fail`` Rather than attempting to merge files that were modified on both @@ -32,7 +47,7 @@ merge tools are: Uses the local version of files as the merged version. ``internal:other`` - Uses the remote version of files as the merged version. + Uses the other version of files as the merged version. ``internal:prompt`` Asks the user which of the local or the other version to keep as @@ -41,45 +56,54 @@ merge tools are: ``internal:dump`` Creates three versions of the files to merge, containing the contents of local, other and base. These files can then be used to - perform a merge manually. If the file merged is name ``a.txt``, - these files will accordingly be named ``a.txt.local``, + perform a merge manually. If the file to be merged is named + ``a.txt``, these files will accordingly be named ``a.txt.local``, ``a.txt.other`` and ``a.txt.base`` and they will be placed in the - same directory as the file to merge. + same directory as ``a.txt``. + +Internal tools are always available and do not require a GUI but will by default +not handle symlinks or binary files. -How Mercurial decides which merge program to use +Choosing a merge tool +""""""""""""""""""""" + +Mercurial uses these rules when decing which merge tool to use: -1. If the ``HGMERGE`` environment variable is present, it is used. If - specified it must be either an executable path or the name of an - application in your executable search path. +0. If a tool has been specified with the --tool option to merge or resolve, it + is used. If it is the name of a tool in the merge-tools configuration, its + configuration is used. Otherwise the specified tool must be executable by + the shell. -2. If the filename of the file to be merged matches any of the - patterns in the merge-patterns configuration section, then the - corresponding merge tool is used, unless the file to be merged is a - symlink. Here binary capabilities of the merge tool are not - considered. +1. If the ``HGMERGE`` environment variable is present, its value is used and + must be executable by the shell. + +2. If the filename of the file to be merged matches any of the patterns in the + merge-patterns configuration section, the first usable merge tool + corresponding to a matching pattern is used. Here, binary capabilities of the + merge tool are not considered. -3. If ui.merge is set, it is used. +3. If ui.merge is set it will be considered next. If the value is not the name + of a configured tool, the specified value is used and must be executable by + the shell. Otherwise the named tool is used if it is usable. -4. If any merge tools are present in the merge-tools configuration - section, and any of the tools can be found on the system, the - priority settings are used to determine which one to use. Binary, - symlink and GUI capabilities do also have to match. +4. If any usable merge tools are present in the merge-tools configuration + section, the one with the higest priority is used. -5. If a program named ``hgmerge`` exists on the system, it is used. +5. If a program named ``hgmerge`` can be found on the system, it is used - but + it will by default not be used for symlinks and binary files. 6. If the file to be merged is not binary and is not a symlink, then ``internal:merge`` is used. -7. The merge fails. +7. The merge of the file fails and must be resolved before commit. .. note:: After selecting a merge program, Mercurial will by default attempt - to merge the files using a simple merge algorithm first, to see if - they can be merged without conflicts. Only if there are conflicting - changes Mercurial will actually execute the merge program. Whether - to use the simple merge algorithm first can be controlled be the - premerge setting of the merge tool, which is enabled by default - unless the file is binary or symlink. + to merge the files using a simple merge algorithm first. Only if it doesn't + succeed because of conflicting changes Mercurial will actually execute the + merge program. Whether to use the simple merge algorithm first can be + controlled by the premerge setting of the merge tool. Premerge is enabled by + default unless the file is binary or a symlink. -See the merge-tools and ui sections of hgrc(5) for details on +See the merge-tools and ui sections of hgrc(5) for details on the configuration of merge tools. diff --git a/mercurial/help/revsets.txt b/mercurial/help/revsets.txt --- a/mercurial/help/revsets.txt +++ b/mercurial/help/revsets.txt @@ -178,26 +178,26 @@ Some sample queries: - Changesets on the default branch:: - hg log -r 'branch(default)' + hg log -r "branch(default)" - Changesets on the default branch since tag 1.5 (excluding merges):: - hg log -r 'branch(default) and 1.5:: and not merge()' + hg log -r "branch(default) and 1.5:: and not merge()" - Open branch heads:: - hg log -r 'head() and not closed()' + hg log -r "head() and not closed()" - Changesets between tags 1.3 and 1.5 mentioning "bug" that affect ``hgext/*``:: - hg log -r '1.3::1.5 and keyword(bug) and file("hgext/*")' + hg log -r "1.3::1.5 and keyword(bug) and file('hgext/*')" - Changesets in committed May 2008, sorted by user:: - hg log -r 'sort(date("May 2008"), user)' + hg log -r "sort(date('May 2008'), user)" - Changesets mentioning "bug" or "issue" that are not in a tagged release:: - hg log -r '(keyword(bug) or keyword(issue)) and not ancestors(tagged())' + hg log -r "(keyword(bug) or keyword(issue)) and not ancestors(tagged())" diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -490,7 +490,7 @@ class svnsubrepo(abstractsubrepo): doc = xml.dom.minidom.parseString(output) entries = doc.getElementsByTagName('entry') if not entries: - return 0 + return '0' return str(entries[0].getAttribute('revision')) or '0' def _wcchanged(self): diff --git a/tests/test-backout.t b/tests/test-backout.t --- a/tests/test-backout.t +++ b/tests/test-backout.t @@ -1,5 +1,3 @@ - $ HGMERGE=true; export HGMERGE - $ hg init basic $ cd basic @@ -20,7 +18,7 @@ basic operation $ echo b >> a $ hg commit -d '1 0' -m b - $ hg backout -d '2 0' tip + $ hg backout -d '2 0' tip --tool=true reverting a changeset 2:2929462c3dff backs out changeset 1:a820f4f40a57 $ cat a @@ -39,7 +37,7 @@ file that was removed is recreated $ hg rm a $ hg commit -d '1 0' -m b - $ hg backout -d '2 0' tip + $ hg backout -d '2 0' tip --tool=true adding a changeset 2:de31bdc76c0d backs out changeset 1:76862dcce372 $ cat a @@ -47,7 +45,7 @@ file that was removed is recreated backout of backout is as if nothing happened - $ hg backout -d '3 0' --merge tip + $ hg backout -d '3 0' --merge tip --tool=true removing a changeset 3:7f6d0f120113 backs out changeset 2:de31bdc76c0d $ cat a 2>/dev/null || echo cat: a: No such file or directory @@ -102,7 +100,7 @@ remove line 1 $ echo line 3 >> a $ hg commit -d '2 0' -m c - $ hg backout --merge -d '3 0' 1 + $ hg backout --merge -d '3 0' 1 --tool=true reverting a created new head changeset 3:26b8ccb9ad91 backs out changeset 1:5a50a024c182 @@ -133,7 +131,7 @@ backout should not back out subsequent c adding b without --merge - $ hg backout -d '3 0' 1 + $ hg backout -d '3 0' 1 --tool=true reverting a 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg locate b @@ -144,7 +142,7 @@ without --merge b with --merge - $ hg backout --merge -d '3 0' 1 + $ hg backout --merge -d '3 0' 1 --tool=true reverting a created new head changeset 3:3202beb76721 backs out changeset 1:22bca4c721e5 @@ -201,7 +199,7 @@ backout of non-merge with parent should backout with valid parent should be ok - $ hg backout -d '5 0' --parent 2 4 + $ hg backout -d '5 0' --parent 2 4 --tool=true removing d changeset 5:10e5328c8435 backs out changeset 4:b2f3bb92043e @@ -210,7 +208,7 @@ backout with valid parent should be ok $ hg update -C 1 files updated, 0 files merged, 0 files removed, 0 files unresolved - $ hg backout -d '6 0' --parent 3 4 + $ hg backout -d '6 0' --parent 3 4 --tool=true removing c changeset 5:033590168430 backs out changeset 4:b2f3bb92043e @@ -236,7 +234,7 @@ named branches adding file2 without --merge - $ hg backout -r 1 + $ hg backout -r 1 --tool=true removing file1 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg branch @@ -248,7 +246,7 @@ without --merge with --merge $ hg update -qC - $ hg backout --merge -d '3 0' -r 1 -m 'backout on branch1' + $ hg backout --merge -d '3 0' -r 1 -m 'backout on branch1' --tool=true removing file1 created new head changeset 3:d4e8f6db59fb backs out changeset 1:bf1602f437f3 diff --git a/tests/test-debugcomplete.t b/tests/test-debugcomplete.t --- a/tests/test-debugcomplete.t +++ b/tests/test-debugcomplete.t @@ -196,7 +196,7 @@ Show all commands + options update: clean, check, date, rev addremove: similarity, include, exclude, dry-run archive: no-decode, prefix, rev, type, subrepos, include, exclude - backout: merge, parent, rev, include, exclude, message, logfile, date, user + backout: merge, parent, tool, rev, include, exclude, message, logfile, date, user bisect: reset, good, bad, skip, command, noupdate branch: force, clean branches: active, closed diff --git a/tests/test-transplant.t b/tests/test-transplant.t --- a/tests/test-transplant.t +++ b/tests/test-transplant.t @@ -59,6 +59,15 @@ rebase b onto r1 1 r2 0 r1 +test transplanted revset + + $ hg log -r 'transplanted()' --template '{rev} {parents} {desc}\n' + 5 1:d11e3596cc1a b1 + 6 b2 + 7 b3 + $ hg help revsets | grep transplanted + "transplanted(set)" + $ hg clone ../t ../prune updating to branch default 4 files updated, 0 files merged, 0 files removed, 0 files unresolved