@@ -4927,16 +4927,17 @@ def resolve(ui, repo, *pats, **opts):
'use --all to remerge all files'))
ms = mergemod.mergestate(repo)
if not ms.active():
raise util.Abort(_('no merge in progress; '
'resolve command not applicable'))
+ oldunresolved = set(ms.unresolved())
m = scmutil.match(repo[None], pats, opts)
ret = 0
didwork = False
for f in ms:
if not m(f):
continue
@@ -4973,16 +4974,28 @@ def resolve(ui, repo, *pats, **opts):
# replace filemerge's .orig file with our resolve file
util.rename(a + ".resolve", a + ".orig")
ms.commit()
if not didwork and pats:
ui.warn(_("no work performed. specified path(s) invalid?\n"))
+ newunresolved = set(ms.unresolved())
+
+ # Nudge users into finishing an unfinished operation. We don't print
+ # this with the list/show operation because we want list/show to remain
+ # machine readable.
+ if not newunresolved and not show:
+ if oldunresolved:
+ ui.write(_('no more unresolved files'))
+ else:
+ ui.write(_('no unresolved files'))
+ ui.write(_('; you may continue your unfinished operation\n'))
+
return ret
@command('revert',
[('a', 'all', None, _('revert all changes when no arguments given')),
('d', 'date', '', _('tipmost revision matching date'), _('DATE')),
('r', 'rev', '', _('revert to the specified revision'), _('REV')),
('C', 'no-backup', None, _('do not save backup copies of files')),
] + walkopts + dryrunopts,
@@ -252,16 +252,23 @@ class mergestate(object):
def files(self):
return self._state.keys()
def mark(self, dfile, state):
self._state[dfile][0] = state
self._dirty = True
+ def unresolved(self):
+ """Obtain the paths of unresolved files."""
+
+ for f, entry in self._state.items():
+ if entry[0] == 'u':
+ yield f
+
def resolve(self, dfile, wctx):
"""rerun merge process for file path `dfile`"""
if self[dfile] == 'r':
return 0
stateentry = self._state[dfile]
state, hash, lfile, afile, anode, ofile, onode, flags = stateentry
octx = self._repo[self._other]
fcd = wctx[dfile]
@@ -102,16 +102,17 @@ should fail
should fail
$ hg add a
a already tracked!
$ hg st
M a
? a.orig
$ hg resolve -m a
+ no more unresolved files; you may continue your unfinished operation
$ hg ci -m merge
Issue683: peculiarity with hg revert of an removed then added file
$ hg forget a
$ hg add a
$ hg st
? a.orig
@@ -485,16 +485,17 @@ Test usage of `hg resolve` in case of co
branch: default
commit: 1 unresolved (clean)
update: (current)
$ hg resolve --all --debug
picked tool 'internal:merge' for foo (binary False symlink False)
merging foo
my foo@b71750c4b0fd+ other foo@a30dd8addae3 ancestor foo@913609522437
premerge successful
+ no more unresolved files; you may continue your unfinished operation
$ hg status
M foo
? foo.orig
$ hg resolve -l
R foo
$ hg summary
parent: 2:b71750c4b0fd tip
capital ten
@@ -581,16 +581,17 @@ Amend a merge changeset (with renames an
$ echo dd > cc
$ hg add cc
$ hg ci -m aa
$ hg merge -q bar
warning: conflicts during merge.
merging cc incomplete! (edit conflicts, then use 'hg resolve --mark')
[1]
$ hg resolve -m cc
+ no more unresolved files; you may continue your unfinished operation
$ hg ci -m 'merge bar'
$ hg log --config diff.git=1 -pr .
changeset: 23:d51446492733
tag: tip
parent: 22:30d96aeaf27b
parent: 21:1aa437659d19
user: test
date: Thu Jan 01 00:00:00 1970 +0000
@@ -36,11 +36,12 @@ Correct the conflict without marking the
$ echo "ABCD" > A
$ hg commit -m "Merged"
abort: unresolved merge conflicts (see hg help resolve)
[255]
Mark the conflict as resolved and commit
$ hg resolve -m A
+ no more unresolved files; you may continue your unfinished operation
$ hg commit -m "Merged"
$ cd ..
@@ -347,16 +347,17 @@ Branchy history
merging b
warning: conflicts during merge.
merging b incomplete! (edit conflicts, then use 'hg resolve --mark')
2 files updated, 0 files merged, 0 files removed, 1 files unresolved
use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
[1]
$ hg --cwd b revert -r 2 b
$ hg --cwd b resolve -m b
+ no more unresolved files; you may continue your unfinished operation
$ hg --cwd b ci -d '5 0' -m 'merge'
Expect 4 changes
$ hg convert -d svn b
assuming destination b-hg
initializing svn repository 'b-hg'
initializing svn working copy 'b-hg-wc'
@@ -149,16 +149,17 @@ Test merge states
* files updated, 0 files merged, * files removed, 1 files unresolved (glob)
use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
[1]
$ fileset 'resolved()'
$ fileset 'unresolved()'
b2
$ echo e > b2
$ hg resolve -m b2
+ no more unresolved files; you may continue your unfinished operation
$ fileset 'resolved()'
b2
$ fileset 'unresolved()'
$ hg ci -m merge
Test subrepo predicate
$ hg init sub
@@ -215,16 +215,17 @@ Continue without resolve should fail:
grafting revision 4
abort: unresolved merge conflicts (see hg help resolve)
[255]
Fix up:
$ echo b > e
$ hg resolve -m e
+ no more unresolved files; you may continue your unfinished operation
Continue with a revision should fail:
$ hg graft -c 6
abort: can't specify --continue and revisions
[255]
$ hg graft -c -r 6
@@ -349,16 +350,17 @@ Resolve conflicted graft
$ hg ci -m 9
$ hg graft 1 --tool internal:fail
grafting revision 1
abort: unresolved conflicts, can't continue
(use hg resolve and hg graft --continue)
[255]
$ hg resolve --all
merging a
+ no more unresolved files; you may continue your unfinished operation
$ hg graft -c
grafting revision 1
$ hg export tip --git
# HG changeset patch
# User bar
# Date 0 0
# Thu Jan 01 00:00:00 1970 +0000
# Node ID 64ecd9071ce83c6e62f538d8ce7709d53f32ebf7
@@ -377,16 +379,17 @@ Resolve conflicted graft with rename
$ hg ci -m 10
$ hg graft 2 --tool internal:fail
grafting revision 2
abort: unresolved conflicts, can't continue
(use hg resolve and hg graft --continue)
[255]
$ hg resolve --all
merging a and b to b
+ no more unresolved files; you may continue your unfinished operation
$ hg graft -c
grafting revision 2
$ hg export tip --git
# HG changeset patch
# User test
# Date 0 0
# Thu Jan 01 00:00:00 1970 +0000
# Node ID 2e80e1351d6ed50302fe1e05f8bd1d4d412b6e11
@@ -90,16 +90,17 @@ edit the history
merging e
warning: conflicts during merge.
merging e incomplete! (edit conflicts, then use 'hg resolve --mark')
Fix up the change and run hg histedit --continue
fix up
$ echo 'I can haz no commute' > e
$ hg resolve --mark e
+ no more unresolved files; you may continue your unfinished operation
$ cat > cat.py <<EOF
> import sys
> print open(sys.argv[1]).read()
> print
> print
> EOF
$ HGEDITOR="python cat.py" hg histedit --continue 2>&1 | fixbundle | grep -v '2 files removed'
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -124,16 +125,17 @@ fix up
merging e
warning: conflicts during merge.
merging e incomplete! (edit conflicts, then use 'hg resolve --mark')
Fix up the change and run hg histedit --continue
just continue this time
$ hg revert -r 'p1()' e
$ hg resolve --mark e
+ no more unresolved files; you may continue your unfinished operation
$ hg histedit --continue 2>&1 | fixbundle
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
log after edit
$ hg log --graph
@ changeset: 5:d9cf42e54966
| tag: tip
@@ -212,16 +212,17 @@ There were conflicts, we keep P1 content
should effectively drop the changes from +6.
$ hg status
M file
? file.orig
$ hg resolve -l
U file
$ hg revert -r 'p1()' file
$ hg resolve --mark file
+ no more unresolved files; you may continue your unfinished operation
$ hg histedit --continue
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
saved backup bundle to $TESTTMP/*-backup.hg (glob)
$ hg logt --graph
@ 1:617f94f13c0f +4
|
o 0:0189ba417d34 1+2+3
@@ -271,16 +272,17 @@ dropped revision.
$ cat > file << EOF
> 1
> 2
> 3
> 4
> 5
> EOF
$ hg resolve --mark file
+ no more unresolved files; you may continue your unfinished operation
$ hg commit -m '+5.2'
created new head
$ echo 6 >> file
$ HGEDITOR=cat hg histedit --continue
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+4
***
+5.2
@@ -149,29 +149,31 @@ edit the history
merging e
warning: conflicts during merge.
merging e incomplete! (edit conflicts, then use 'hg resolve --mark')
Fix up the change and run hg histedit --continue
fix up
$ echo 'I can haz no commute' > e
$ hg resolve --mark e
+ no more unresolved files; you may continue your unfinished operation
$ hg histedit --continue 2>&1 | fixbundle
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
merging e
warning: conflicts during merge.
merging e incomplete! (edit conflicts, then use 'hg resolve --mark')
Fix up the change and run hg histedit --continue
This failure is caused by 7b4e2f4b7bcd "e" not rebasing the non commutative
former children.
just continue this time
$ hg revert -r 'p1()' e
$ hg resolve --mark e
+ no more unresolved files; you may continue your unfinished operation
$ hg histedit --continue 2>&1 | fixbundle
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
log after edit
$ hg log --graph
@ changeset: 6:7efe1373e4bc
| tag: tip
@@ -234,25 +236,27 @@ edit the history, this time with a fold
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
merging e
warning: conflicts during merge.
merging e incomplete! (edit conflicts, then use 'hg resolve --mark')
Fix up the change and run hg histedit --continue
$ echo 'I can haz no commute' > e
$ hg resolve --mark e
+ no more unresolved files; you may continue your unfinished operation
$ hg histedit --continue 2>&1 | fixbundle
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
merging e
warning: conflicts during merge.
merging e incomplete! (edit conflicts, then use 'hg resolve --mark')
Fix up the change and run hg histedit --continue
second edit also fails, but just continue
$ hg revert -r 'p1()' e
$ hg resolve --mark e
+ no more unresolved files; you may continue your unfinished operation
$ hg histedit --continue 2>&1 | fixbundle
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
post message fix
$ hg log --graph
@ changeset: 6:7efe1373e4bc
| tag: tip
@@ -1053,16 +1053,17 @@ conflict: keyword should stay outside co
bar
=======
foo
>>>>>>> other
resolve to local
$ HGMERGE=internal:local hg resolve -a
+ no more unresolved files; you may continue your unfinished operation
$ hg commit -m localresolve
$ cat m
$Id: m 800511b3a22d Thu, 01 Jan 1970 00:00:00 +0000 test $
bar
Test restricted mode with transplant -b
$ hg update 6
@@ -127,16 +127,17 @@ add some changesets to rename/remove/mer
warning: $TESTTMP/bigfile-repo/stuff/maybelarge.dat looks like a binary file. (glob)
merging stuff/maybelarge.dat incomplete! (edit conflicts, then use 'hg resolve --mark')
merging sub/normal2 and stuff/normal2 to stuff/normal2
0 files updated, 1 files merged, 0 files removed, 1 files unresolved
use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
[1]
$ hg cat -r . sub/maybelarge.dat > stuff/maybelarge.dat
$ hg resolve -m stuff/maybelarge.dat
+ no more unresolved files; you may continue your unfinished operation
$ hg commit -m"merge"
$ hg log -G --template "{rev}:{node|short} {desc|firstline}\n"
@ 5:4884f215abda merge
|\
| o 4:7285f817b77e remove large, normal3
| |
| o 3:67e3892e3534 add normal3, modify sub/*
| |
@@ -985,27 +985,29 @@ log -p -R repo
merging foo
warning: conflicts during merge.
merging foo incomplete! (edit conflicts, then use 'hg resolve --mark')
0 files updated, 0 files merged, 0 files removed, 1 files unresolved
use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
[1]
$ echo 'merge 1' > foo
$ hg resolve -m foo
+ no more unresolved files; you may continue your unfinished operation
$ hg ci -m "First merge, related"
$ hg merge 4
merging foo
warning: conflicts during merge.
merging foo incomplete! (edit conflicts, then use 'hg resolve --mark')
1 files updated, 0 files merged, 0 files removed, 1 files unresolved
use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
[1]
$ echo 'merge 2' > foo
$ hg resolve -m foo
+ no more unresolved files; you may continue your unfinished operation
$ hg ci -m "Last merge, related"
$ hg log --graph
@ changeset: 10:4dae8563d2c5
|\ tag: tip
| | parent: 9:7b35701b003e
| | parent: 4:88176d361b69
| | user: test
@@ -45,16 +45,17 @@ Symlink is local parent, executable is o
0 files updated, 0 files merged, 0 files removed, 1 files unresolved
use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
[1]
$ tellmeabout a
a is a symlink:
a -> symlink
$ hg resolve a --tool internal:other
+ no more unresolved files; you may continue your unfinished operation
$ tellmeabout a
a is an executable file with content:
a
$ hg st
M a
? a.orig
Symlink is other parent, executable is local:
@@ -52,16 +52,17 @@ now pull and merge from test-a
resolve conflict
$ cat >test.txt <<"EOF"
> one
> two-point-five
> three
> EOF
$ rm -f *.orig
$ hg resolve -m test.txt
+ no more unresolved files; you may continue your unfinished operation
$ hg commit -m "Merge 1"
change test-a again
$ cd ../test-a
$ cat >test.txt <<"EOF"
> one
> two-point-one
> three
@@ -153,16 +153,17 @@ plain headers
adding a
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
created new head
merging a
warning: conflicts during merge.
merging a incomplete! (edit conflicts, then use 'hg resolve --mark')
0 files updated, 0 files merged, 0 files removed, 1 files unresolved
use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
+ no more unresolved files; you may continue your unfinished operation
abort: cannot manage merge changesets
$ rm -r sandbox
hg headers
$ echo "plain=false" >> $HGRCPATH
$ mkdir sandbox
$ (cd sandbox ; runtest)
@@ -226,16 +227,17 @@ hg headers
adding a
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
created new head
merging a
warning: conflicts during merge.
merging a incomplete! (edit conflicts, then use 'hg resolve --mark')
0 files updated, 0 files merged, 0 files removed, 1 files unresolved
use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
+ no more unresolved files; you may continue your unfinished operation
abort: cannot manage merge changesets
$ rm -r sandbox
Test saving last-message.txt
$ hg init repo
$ cd repo
@@ -163,16 +163,17 @@ rebase --continue with bookmarks present
$ hg rebase
merging c
warning: conflicts during merge.
merging c incomplete! (edit conflicts, then use 'hg resolve --mark')
unresolved conflicts (see hg resolve, then hg rebase --continue)
[1]
$ echo 'c' > c
$ hg resolve --mark c
+ no more unresolved files; you may continue your unfinished operation
$ hg rebase --continue
saved backup bundle to $TESTTMP/a3/.hg/strip-backup/3d5fa227f4b5-backup.hg (glob)
$ hg tglog
@ 4: 'C' bookmarks: Y Z
|
o 3: 'other C' bookmarks:
|
o 2: 'B' bookmarks: X
@@ -71,16 +71,17 @@ Rebasing B onto E - check keep: and phas
unresolved conflicts (see hg resolve, then hg rebase --continue)
[1]
Solve the conflict and go on:
$ echo 'conflict solved' > A
$ rm A.orig
$ hg resolve -m A
+ no more unresolved files; you may continue your unfinished operation
$ hg rebase --continue
$ hg tglog
o 7:secret 'C'
|
o 6:draft 'B'
|
| @ 5:draft 'F' notdefault
@@ -124,16 +125,17 @@ Rebase F onto E - check keepbranches:
unresolved conflicts (see hg resolve, then hg rebase --continue)
[1]
Solve the conflict and go on:
$ echo 'conflict solved' > A
$ rm A.orig
$ hg resolve -m A
+ no more unresolved files; you may continue your unfinished operation
$ hg rebase --continue
saved backup bundle to $TESTTMP/a2/.hg/strip-backup/*-backup.hg (glob)
$ hg tglog
@ 5:draft 'F' notdefault
|
o 4:draft 'E'
|
@@ -72,16 +72,17 @@ Try to continue without solving the conf
$ hg rebase --continue
abort: unresolved merge conflicts (see hg help resolve)
[255]
Conclude rebase:
$ echo 'resolved merge' >common
$ hg resolve -m common
+ no more unresolved files; you may continue your unfinished operation
$ hg rebase --continue
saved backup bundle to $TESTTMP/a/.hg/strip-backup/*-backup.hg (glob)
$ hg tglog
@ 5:secret 'L3' mybook
|
o 4:secret 'L2'
|
@@ -369,16 +369,17 @@ Ensure --continue restores a correct sta
$ hg phase --force --secret 8
$ hg rebase -s 8 -d 7 --config ui.merge=internal:fail
merging H
warning: conflicts during merge.
merging H incomplete! (edit conflicts, then use 'hg resolve --mark')
unresolved conflicts (see hg resolve, then hg rebase --continue)
[1]
$ hg resolve --all -t internal:local
+ no more unresolved files; you may continue your unfinished operation
$ hg rebase -c
saved backup bundle to $TESTTMP/a7/.hg/strip-backup/6215fafa5447-backup.hg (glob)
$ hg log -G --template "{rev}:{phase} '{desc}' {branches}\n"
@ 7:draft 'H'
|
| o 6:draft 'G'
|/|
o | 5:draft 'F'
@@ -99,16 +99,17 @@ Resume the rebasing:
unresolved conflicts (see hg resolve, then hg rebase --continue)
[1]
Solve the conflict and go on:
$ echo 'conflict solved' > A
$ rm A.orig
$ hg resolve -m A
+ no more unresolved files; you may continue your unfinished operation
$ hg rebase --continue
warning: new changesets detected on source branch, not stripping
$ hg tglogp
o 7:draft 'C'
|
| o 6:secret 'Extra'
@@ -106,16 +106,17 @@ already has one local mq patch
$ hg up -q qtip
$ HGMERGE=internal:fail hg rebase
unresolved conflicts (see hg resolve, then hg rebase --continue)
[1]
$ HGMERGE=internal:local hg resolve --all
+ no more unresolved files; you may continue your unfinished operation
$ hg rebase --continue
saved backup bundle to $TESTTMP/b/.hg/strip-backup/*-backup.hg (glob)
$ hg tglog
@ 8: 'r5' tags: 5.diff qtip tip
|
o 7: 'r2' tags: 2.diff qbase
@@ -64,27 +64,29 @@ Rebase - generate a conflict:
merging f incomplete! (edit conflicts, then use 'hg resolve --mark')
unresolved conflicts (see hg resolve, then hg rebase --continue)
[1]
Fix the 1st conflict:
$ echo mq1r1 > f
$ hg resolve -m f
+ no more unresolved files; you may continue your unfinished operation
$ hg rebase -c
merging f
warning: conflicts during merge.
merging f incomplete! (edit conflicts, then use 'hg resolve --mark')
unresolved conflicts (see hg resolve, then hg rebase --continue)
[1]
Fix the 2nd conflict:
$ echo mq1r1mq2 > f
$ hg resolve -m f
+ no more unresolved files; you may continue your unfinished operation
$ hg rebase -c
saved backup bundle to $TESTTMP/a/.hg/strip-backup/*-backup.hg (glob)
$ hg tglog
@ 3: 'P1' tags: f2.patch qtip tip
|
o 2: 'P0' tags: f.patch qbase
|
@@ -449,13 +449,14 @@ Test --tool parameter:
commit: 1 modified, 1 unresolved (merge)
update: (current)
rebase: 0 rebased, 1 remaining (rebase --continue)
$ hg resolve -l
U c2
$ hg resolve -m c2
+ no more unresolved files; you may continue your unfinished operation
$ hg rebase -c --tool internal:fail
tool option will be ignored
saved backup bundle to $TESTTMP/b3/.hg/strip-backup/*-backup.hg (glob)
$ cd ..
@@ -34,16 +34,17 @@ resolve -l should contain an unresolved
resolving an unknown path emits a warning
$ hg resolve -m does-not-exist
no work performed. specified path(s) invalid?
resolve the failure
$ echo resolved > file
$ hg resolve -m file
+ no more unresolved files; you may continue your unfinished operation
$ hg commit -m 'resolved'
resolve -l should error since no merge in progress
$ hg resolve -l
abort: no merge in progress; resolve command not applicable
[255]
@@ -289,16 +289,17 @@ attempt to continue
$ hg unshelve -c
abort: unresolved conflicts, can't continue
(see 'hg resolve', then 'hg unshelve --continue')
[255]
$ hg revert -r . a/a
$ hg resolve -m a/a
+ no more unresolved files; you may continue your unfinished operation
$ hg commit -m 'commit while unshelve in progress'
abort: unshelve already in progress
(use 'hg unshelve --continue' or 'hg unshelve --abort')
[255]
$ hg unshelve -c
unshelve of 'default' complete