--- a/mercurial/commands.py Fri Dec 19 22:32:08 2008 +0100
+++ b/mercurial/commands.py Sat Dec 20 13:09:05 2008 +0100
@@ -156,7 +156,7 @@
ctx = repo[opts.get('rev')]
if not ctx:
- raise util.Abort(_('repository has no revisions'))
+ raise util.Abort(_('no working directory: please specify a revision'))
node = ctx.node()
dest = cmdutil.make_filename(repo, dest, node)
if os.path.realpath(dest) == repo.root:
@@ -2330,32 +2330,40 @@
del wlock
def resolve(ui, repo, *pats, **opts):
- """resolve file merges from a branch merge or update
-
- This command will attempt to resolve unresolved merges from the
- last update or merge command. This will use the local file
- revision preserved at the last update or merge to cleanly retry
- the file merge attempt. With no file or options specified, this
- command will attempt to resolve all unresolved files.
+ """retry file merges from a merge or update
+
+ This command will cleanly retry unresolved file merges using file
+ revisions preserved from the last update or merge. To attempt to
+ resolve all unresolved files, use the -a switch.
+
+ This command will also allow listing resolved files and manually
+ marking and unmarking files as resolved.
The codes used to show the status of files are:
U = unresolved
R = resolved
"""
- if len([x for x in opts if opts[x]]) > 1:
+ all, mark, unmark, show = [opts.get(o) for o in 'all mark unmark list'.split()]
+
+ if (show and (mark or unmark)) or (mark and unmark):
raise util.Abort(_("too many options specified"))
+ if pats and all:
+ raise util.Abort(_("can't specify --all and patterns"))
+ if not (all or pats or show or mark or unmark):
+ raise util.Abort(_('no files or directories specified; '
+ 'use --all to remerge all files'))
ms = merge_.mergestate(repo)
m = cmdutil.match(repo, pats, opts)
for f in ms:
if m(f):
- if opts.get("list"):
+ if show:
ui.write("%s %s\n" % (ms[f].upper(), f))
- elif opts.get("mark"):
+ elif mark:
ms.mark(f, "r")
- elif opts.get("unmark"):
+ elif unmark:
ms.mark(f, "u")
else:
wctx = repo[None]
@@ -3315,7 +3323,8 @@
_('[OPTION]... SOURCE... DEST')),
"resolve":
(resolve,
- [('l', 'list', None, _('list state of files needing merge')),
+ [('a', 'all', None, _('remerge all unresolved files')),
+ ('l', 'list', None, _('list state of files needing merge')),
('m', 'mark', None, _('mark files as resolved')),
('u', 'unmark', None, _('unmark files as resolved'))],
_('[OPTION]... [FILE]...')),
--- a/tests/run-tests.py Fri Dec 19 22:32:08 2008 +0100
+++ b/tests/run-tests.py Sat Dec 20 13:09:05 2008 +0100
@@ -400,8 +400,8 @@
fail("output changed and returned error code %d" % ret)
else:
fail("output changed")
- if not nodiff:
- show_diff(ref_out, out)
+ if not nodiff:
+ show_diff(ref_out, out)
ret = 1
elif ret:
mark = '!'
--- a/tests/test-archive.out Fri Dec 19 22:32:08 2008 +0100
+++ b/tests/test-archive.out Sat Dec 20 13:09:05 2008 +0100
@@ -60,4 +60,4 @@
abort: unknown archive type 'bogus'
% server errors
% empty repo
-abort: repository has no revisions
+abort: no working directory: please specify a revision
--- a/tests/test-globalopts.out Fri Dec 19 22:32:08 2008 +0100
+++ b/tests/test-globalopts.out Sat Dec 20 13:09:05 2008 +0100
@@ -183,7 +183,7 @@
recover roll back an interrupted transaction
remove remove the specified files on the next commit
rename rename files; equivalent of copy + remove
- resolve resolve file merges from a branch merge or update
+ resolve retry file merges from a merge or update
revert restore individual files or dirs to an earlier state
rollback roll back the last transaction
root print the root (top) of the current working dir
@@ -246,7 +246,7 @@
recover roll back an interrupted transaction
remove remove the specified files on the next commit
rename rename files; equivalent of copy + remove
- resolve resolve file merges from a branch merge or update
+ resolve retry file merges from a merge or update
revert restore individual files or dirs to an earlier state
rollback roll back the last transaction
root print the root (top) of the current working dir
--- a/tests/test-help.out Fri Dec 19 22:32:08 2008 +0100
+++ b/tests/test-help.out Sat Dec 20 13:09:05 2008 +0100
@@ -74,7 +74,7 @@
recover roll back an interrupted transaction
remove remove the specified files on the next commit
rename rename files; equivalent of copy + remove
- resolve resolve file merges from a branch merge or update
+ resolve retry file merges from a merge or update
revert restore individual files or dirs to an earlier state
rollback roll back the last transaction
root print the root (top) of the current working dir
@@ -133,7 +133,7 @@
recover roll back an interrupted transaction
remove remove the specified files on the next commit
rename rename files; equivalent of copy + remove
- resolve resolve file merges from a branch merge or update
+ resolve retry file merges from a merge or update
revert restore individual files or dirs to an earlier state
rollback roll back the last transaction
root print the root (top) of the current working dir
--- a/tests/test-keyword Fri Dec 19 22:32:08 2008 +0100
+++ b/tests/test-keyword Sat Dec 20 13:09:05 2008 +0100
@@ -322,7 +322,7 @@
echo % keyword stays outside conflict zone
cat m
echo % resolve to local
-HGMERGE=internal:local hg resolve
+HGMERGE=internal:local hg resolve -a
hg commit -m localresolve
cat m
--- a/tests/test-merge9 Fri Dec 19 22:32:08 2008 +0100
+++ b/tests/test-merge9 Sat Dec 20 13:09:05 2008 +0100
@@ -44,8 +44,11 @@
echo % after
hg resolve -l
+echo % resolve all warning
+hg resolve
+
echo % resolve all
-hg resolve
+hg resolve -a
echo % after
hg resolve -l
--- a/tests/test-merge9.out Fri Dec 19 22:32:08 2008 +0100
+++ b/tests/test-merge9.out Sat Dec 20 13:09:05 2008 +0100
@@ -28,6 +28,8 @@
% after
U bar
R baz
+% resolve all warning
+abort: no files or directories specified; use --all to remerge all files
% resolve all
merging bar
warning: conflicts during merge.