i18n: merge with main

This commit is contained in:
Martin Geisler 2010-10-23 16:24:07 +02:00
commit c923b05ea4
14 changed files with 117 additions and 68 deletions

View File

@ -98,7 +98,7 @@ i18n/hg.pot: $(PYTHON_FILES) mercurial/help/*.txt
xgettext --package-name "Mercurial" \ xgettext --package-name "Mercurial" \
--msgid-bugs-address "<mercurial-devel@selenic.com>" \ --msgid-bugs-address "<mercurial-devel@selenic.com>" \
--copyright-holder "Matt Mackall <mpm@selenic.com> and others" \ --copyright-holder "Matt Mackall <mpm@selenic.com> 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 -d hg -p i18n -o hg.pot
$(PYTHON) i18n/posplit i18n/hg.pot $(PYTHON) i18n/posplit i18n/hg.pot

View File

@ -79,7 +79,7 @@ def show_doc(ui):
# print options # print options
section(ui, _("Options")) section(ui, _("Options"))
for optstr, desc in get_opts(globalopts): 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 # print cmds
section(ui, _("Commands")) section(ui, _("Commands"))
@ -97,7 +97,7 @@ def show_doc(ui):
ui.write("\n") ui.write("\n")
section(ui, _("Extensions")) 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 " "together with Mercurial. Help for other extensions is available "
"in the help system.")) "in the help system."))
ui.write("\n\n" ui.write("\n\n"
@ -130,8 +130,13 @@ def commandprinter(ui, cmdtable, sectionfunc):
d = get_cmd(h[f], cmdtable) d = get_cmd(h[f], cmdtable)
sectionfunc(ui, d['cmd']) sectionfunc(ui, d['cmd'])
# synopsis # synopsis
ui.write("``%s``\n" % d['synopsis'].replace("hg ","", 1)) ui.write("::\n\n")
ui.write("\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 # description
ui.write("%s\n\n" % d['desc'][1]) ui.write("%s\n\n" % d['desc'][1])
# options # options

3
hg
View File

@ -14,7 +14,8 @@ libdir = '@LIBDIR@'
if libdir != '@' 'LIBDIR' '@': if libdir != '@' 'LIBDIR' '@':
if not os.path.isabs(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) libdir = os.path.abspath(libdir)
sys.path.insert(0, libdir) sys.path.insert(0, libdir)

View File

@ -226,6 +226,8 @@ def uisetup(ui):
def extsetup(ui): def extsetup(ui):
commands.globalopts.append( commands.globalopts.append(
('', 'color', 'auto', ('', 'color', 'auto',
# i18n: 'always', 'auto', and 'never' are keywords and should
# not be translated
_("when to colorize (boolean, always, auto, or never)"), _("when to colorize (boolean, always, auto, or never)"),
_('TYPE'))) _('TYPE')))

View File

@ -51,7 +51,7 @@ The extension uses an optional ``[eol]`` section in your hgrc file
behavior. There are two settings: behavior. There are two settings:
- ``eol.native`` (default ``os.linesep``) can be set to ``LF`` or - ``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 checkout. This can be used with :hg:`archive` on Unix, say, to
generate an archive where files have line endings for Windows. generate an archive where files have line endings for Windows.

View File

@ -278,7 +278,11 @@ def backout(ui, repo, node=None, rev=None, **opts):
revert_opts['no_backup'] = None revert_opts['no_backup'] = None
revert(ui, repo, **revert_opts) revert(ui, repo, **revert_opts)
if not opts.get('merge') and op1 != node: 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 = opts.copy()
commit_opts['addremove'] = False commit_opts['addremove'] = False
@ -295,7 +299,11 @@ def backout(ui, repo, node=None, rev=None, **opts):
hg.clean(repo, op1, show_stats=False) hg.clean(repo, op1, show_stats=False)
ui.status(_('merging with changeset %s\n') ui.status(_('merging with changeset %s\n')
% nice(repo.changelog.tip())) % 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 return 0
def bisect(ui, repo, rev=None, extra=None, command=None, 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 ancestors or descendants of the starting revision. --follow-first
only follows the first parent of merge revisions. 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 --follow is set, in which case the working directory parent is
used as the starting revision. You can specify a revision set for used as the starting revision. You can specify a revision set for
log, see :hg:`help revsets` for more information. 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: 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 files, discarding any previous merge attempts. Re-merging is not
performed for files already marked as resolved. Use ``--all/-a`` performed for files already marked as resolved. Use ``--all/-a``
to selects all unresolved files. ``--tool`` can be used to specify to selects all unresolved files. ``--tool`` can be used to specify
@ -4005,6 +4013,8 @@ table = {
_('merge with old dirstate parent after backout')), _('merge with old dirstate parent after backout')),
('', 'parent', '', ('', 'parent', '',
_('parent to choose when backing out merge'), _('REV')), _('parent to choose when backing out merge'), _('REV')),
('t', 'tool', '',
_('specify merge tool')),
('r', 'rev', '', ('r', 'rev', '',
_('revision to backout'), _('REV')), _('revision to backout'), _('REV')),
] + walkopts + commitopts + commitopts2, ] + walkopts + commitopts + commitopts2,

View File

@ -45,7 +45,7 @@ class _demandmod(object):
if not self._module: if not self._module:
head, globals, locals, after, level = self._data head, globals, locals, after, level = self._data
if level is not None: if level is not None:
mod = _origimport(head, globals, locals, level=level) mod = _origimport(head, globals, locals, level)
else: else:
mod = _origimport(head, globals, locals) mod = _origimport(head, globals, locals)
# load submodules # load submodules

View File

@ -24,7 +24,7 @@ def dispatch(args):
except util.Abort, inst: except util.Abort, inst:
sys.stderr.write(_("abort: %s\n") % inst) sys.stderr.write(_("abort: %s\n") % inst)
if inst.hint: if inst.hint:
sys.stderr.write("(%s)\n" % inst.hint) sys.stderr.write(_("(%s)\n") % inst.hint)
return -1 return -1
except error.ParseError, inst: except error.ParseError, inst:
if len(inst.args) > 1: if len(inst.args) > 1:

View File

@ -5,23 +5,38 @@ file. Merge tools are given the two files and the greatest common
ancestor of the two file versions, so they can determine the changes ancestor of the two file versions, so they can determine the changes
made on both branches. 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 Usually, the merge tool tries to automatically reconcile the files by
non-overlapping changes that occurred separately in the two different combining all non-overlapping changes that occurred separately in
evolutions of the same initial base file. Furthermore, some the two different evolutions of the same initial base file. Furthermore, some
interactive merge programs make it easier to manually resolve interactive merge programs make it easier to manually resolve
conflicting merges, either in a graphical way, or by inserting some conflicting merges, either in a graphical way, or by inserting some
conflict markers. Mercurial does not include any interactive merge conflict markers. Mercurial does not include any interactive merge
programs but relies on external tools for that. External merge tools programs but relies on external tools for that.
and their properties and usage is configured in merge-tools section -
see hgrc(5). 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 There are a some internal merge tools which can be used. The internal
merge tools are: merge tools are:
``internal:merge`` ``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`` ``internal:fail``
Rather than attempting to merge files that were modified on both 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. Uses the local version of files as the merged version.
``internal:other`` ``internal:other``
Uses the remote version of files as the merged version. Uses the other version of files as the merged version.
``internal:prompt`` ``internal:prompt``
Asks the user which of the local or the other version to keep as Asks the user which of the local or the other version to keep as
@ -41,45 +56,54 @@ merge tools are:
``internal:dump`` ``internal:dump``
Creates three versions of the files to merge, containing the Creates three versions of the files to merge, containing the
contents of local, other and base. These files can then be used to 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``, perform a merge manually. If the file to be merged is named
these files will accordingly be named ``a.txt.local``, ``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 ``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``.
How Mercurial decides which merge program to use Internal tools are always available and do not require a GUI but will by default
not handle symlinks or binary files.
1. If the ``HGMERGE`` environment variable is present, it is used. If Choosing a merge tool
specified it must be either an executable path or the name of an """""""""""""""""""""
application in your executable search path.
2. If the filename of the file to be merged matches any of the Mercurial uses these rules when decing which merge tool to use:
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.
3. If ui.merge is set, it is used. 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.
4. If any merge tools are present in the merge-tools configuration 1. If the ``HGMERGE`` environment variable is present, its value is used and
section, and any of the tools can be found on the system, the must be executable by the shell.
priority settings are used to determine which one to use. Binary,
symlink and GUI capabilities do also have to match.
5. If a program named ``hgmerge`` exists on the system, it is used. 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 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 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`` 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 6. If the file to be merged is not binary and is not a symlink, then
``internal:merge`` is used. ``internal:merge`` is used.
7. The merge fails. 7. The merge of the file fails and must be resolved before commit.
.. note:: .. note::
After selecting a merge program, Mercurial will by default attempt After selecting a merge program, Mercurial will by default attempt
to merge the files using a simple merge algorithm first, to see if to merge the files using a simple merge algorithm first. Only if it doesn't
they can be merged without conflicts. Only if there are conflicting succeed because of conflicting changes Mercurial will actually execute the
changes Mercurial will actually execute the merge program. Whether merge program. Whether to use the simple merge algorithm first can be
to use the simple merge algorithm first can be controlled be the controlled by the premerge setting of the merge tool. Premerge is enabled by
premerge setting of the merge tool, which is enabled by default default unless the file is binary or a symlink.
unless the file is binary or 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. configuration of merge tools.

View File

@ -178,26 +178,26 @@ Some sample queries:
- Changesets on the default branch:: - 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):: - 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:: - 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 - Changesets between tags 1.3 and 1.5 mentioning "bug" that affect
``hgext/*``:: ``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:: - 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 - Changesets mentioning "bug" or "issue" that are not in a tagged
release:: 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())"

View File

@ -490,7 +490,7 @@ class svnsubrepo(abstractsubrepo):
doc = xml.dom.minidom.parseString(output) doc = xml.dom.minidom.parseString(output)
entries = doc.getElementsByTagName('entry') entries = doc.getElementsByTagName('entry')
if not entries: if not entries:
return 0 return '0'
return str(entries[0].getAttribute('revision')) or '0' return str(entries[0].getAttribute('revision')) or '0'
def _wcchanged(self): def _wcchanged(self):

View File

@ -1,5 +1,3 @@
$ HGMERGE=true; export HGMERGE
$ hg init basic $ hg init basic
$ cd basic $ cd basic
@ -20,7 +18,7 @@ basic operation
$ echo b >> a $ echo b >> a
$ hg commit -d '1 0' -m b $ hg commit -d '1 0' -m b
$ hg backout -d '2 0' tip $ hg backout -d '2 0' tip --tool=true
reverting a reverting a
changeset 2:2929462c3dff backs out changeset 1:a820f4f40a57 changeset 2:2929462c3dff backs out changeset 1:a820f4f40a57
$ cat a $ cat a
@ -39,7 +37,7 @@ file that was removed is recreated
$ hg rm a $ hg rm a
$ hg commit -d '1 0' -m b $ hg commit -d '1 0' -m b
$ hg backout -d '2 0' tip $ hg backout -d '2 0' tip --tool=true
adding a adding a
changeset 2:de31bdc76c0d backs out changeset 1:76862dcce372 changeset 2:de31bdc76c0d backs out changeset 1:76862dcce372
$ cat a $ cat a
@ -47,7 +45,7 @@ file that was removed is recreated
backout of backout is as if nothing happened 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 removing a
changeset 3:7f6d0f120113 backs out changeset 2:de31bdc76c0d changeset 3:7f6d0f120113 backs out changeset 2:de31bdc76c0d
$ cat a 2>/dev/null || echo cat: a: No such file or directory $ cat a 2>/dev/null || echo cat: a: No such file or directory
@ -102,7 +100,7 @@ remove line 1
$ echo line 3 >> a $ echo line 3 >> a
$ hg commit -d '2 0' -m c $ 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 reverting a
created new head created new head
changeset 3:26b8ccb9ad91 backs out changeset 1:5a50a024c182 changeset 3:26b8ccb9ad91 backs out changeset 1:5a50a024c182
@ -133,7 +131,7 @@ backout should not back out subsequent changesets
adding b adding b
without --merge without --merge
$ hg backout -d '3 0' 1 $ hg backout -d '3 0' 1 --tool=true
reverting a reverting a
1 files updated, 0 files merged, 0 files removed, 0 files unresolved 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg locate b $ hg locate b
@ -144,7 +142,7 @@ without --merge
b b
with --merge with --merge
$ hg backout --merge -d '3 0' 1 $ hg backout --merge -d '3 0' 1 --tool=true
reverting a reverting a
created new head created new head
changeset 3:3202beb76721 backs out changeset 1:22bca4c721e5 changeset 3:3202beb76721 backs out changeset 1:22bca4c721e5
@ -201,7 +199,7 @@ backout of non-merge with parent should fail
backout with valid parent should be ok 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 removing d
changeset 5:10e5328c8435 backs out changeset 4:b2f3bb92043e changeset 5:10e5328c8435 backs out changeset 4:b2f3bb92043e
@ -210,7 +208,7 @@ backout with valid parent should be ok
$ hg update -C $ hg update -C
1 files updated, 0 files merged, 0 files removed, 0 files unresolved 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 removing c
changeset 5:033590168430 backs out changeset 4:b2f3bb92043e changeset 5:033590168430 backs out changeset 4:b2f3bb92043e
@ -236,7 +234,7 @@ named branches
adding file2 adding file2
without --merge without --merge
$ hg backout -r 1 $ hg backout -r 1 --tool=true
removing file1 removing file1
1 files updated, 0 files merged, 0 files removed, 0 files unresolved 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg branch $ hg branch
@ -248,7 +246,7 @@ without --merge
with --merge with --merge
$ hg update -qC $ 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 removing file1
created new head created new head
changeset 3:d4e8f6db59fb backs out changeset 1:bf1602f437f3 changeset 3:d4e8f6db59fb backs out changeset 1:bf1602f437f3

View File

@ -196,7 +196,7 @@ Show all commands + options
update: clean, check, date, rev update: clean, check, date, rev
addremove: similarity, include, exclude, dry-run addremove: similarity, include, exclude, dry-run
archive: no-decode, prefix, rev, type, subrepos, include, exclude 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 bisect: reset, good, bad, skip, command, noupdate
branch: force, clean branch: force, clean
branches: active, closed branches: active, closed

View File

@ -59,6 +59,15 @@ rebase b onto r1
1 r2 1 r2
0 r1 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 $ hg clone ../t ../prune
updating to branch default updating to branch default
4 files updated, 0 files merged, 0 files removed, 0 files unresolved 4 files updated, 0 files merged, 0 files removed, 0 files unresolved