resolve: print message when no unresolved files remain (issue4214)
authorGregory Szorc <gregory.szorc@gmail.com>
Fri, 18 Apr 2014 22:19:25 -0700
changeset 21266 19d6fec60b81
parent 21265 232de244ab6f
child 21267 e4f451c8c05c
resolve: print message when no unresolved files remain (issue4214) When using resolve, users often have to consult with the output of |hg resolve -l| to see if any unresolved files remain. This step is tedious and adds overhead to resolving. This patch will notify a user if there are no unresolved files remaining after executing |hg resolve|:: no unresolved files; you may continue your unfinished operation The patch stops short of telling the user exactly what command should be executed to continue the unfinished operation. That is because this information is not currently captured anywhere. This would make a compelling follow-up feature.
mercurial/commands.py
mercurial/merge.py
tests/test-add.t
tests/test-backout.t
tests/test-commit-amend.t
tests/test-commit-unresolved.t
tests/test-convert-svn-sink.t
tests/test-fileset.t
tests/test-graft.t
tests/test-histedit-fold-non-commute.t
tests/test-histedit-fold.t
tests/test-histedit-non-commute.t
tests/test-keyword.t
tests/test-lfconvert.t
tests/test-log.t
tests/test-merge-types.t
tests/test-merge7.t
tests/test-mq-qnew.t
tests/test-rebase-bookmarks.t
tests/test-rebase-check-restore.t
tests/test-rebase-conflicts.t
tests/test-rebase-detach.t
tests/test-rebase-interruptions.t
tests/test-rebase-mq-skip.t
tests/test-rebase-mq.t
tests/test-rebase-parameters.t
tests/test-resolve.t
tests/test-shelve.t
--- a/mercurial/commands.py	Fri Apr 18 18:56:26 2014 -0700
+++ b/mercurial/commands.py	Fri Apr 18 22:19:25 2014 -0700
@@ -4977,6 +4977,13 @@
     if not didwork and pats:
         ui.warn(_("arguments do not match paths that need resolved\n"))
 
+    # 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 list(ms.unresolved()) and not show:
+        ui.write(_('no unresolved files; '))
+        ui.write(_('you may continue your unfinished operation\n'))
+
     return ret
 
 @command('revert',
--- a/mercurial/merge.py	Fri Apr 18 18:56:26 2014 -0700
+++ b/mercurial/merge.py	Fri Apr 18 22:19:25 2014 -0700
@@ -260,6 +260,13 @@
         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':
--- a/tests/test-add.t	Fri Apr 18 18:56:26 2014 -0700
+++ b/tests/test-add.t	Fri Apr 18 22:19:25 2014 -0700
@@ -107,6 +107,7 @@
   M a
   ? a.orig
   $ hg resolve -m a
+  no unresolved files; you may continue your unfinished operation
   $ hg ci -m merge
 
 Issue683: peculiarity with hg revert of an removed then added file
--- a/tests/test-backout.t	Fri Apr 18 18:56:26 2014 -0700
+++ b/tests/test-backout.t	Fri Apr 18 22:19:25 2014 -0700
@@ -490,6 +490,7 @@
   merging foo
   my foo@b71750c4b0fd+ other foo@a30dd8addae3 ancestor foo@913609522437
    premerge successful
+  no unresolved files; you may continue your unfinished operation
   $ hg status
   M foo
   ? foo.orig
--- a/tests/test-commit-amend.t	Fri Apr 18 18:56:26 2014 -0700
+++ b/tests/test-commit-amend.t	Fri Apr 18 22:19:25 2014 -0700
@@ -586,6 +586,7 @@
   merging cc incomplete! (edit conflicts, then use 'hg resolve --mark')
   [1]
   $ hg resolve -m cc
+  no unresolved files; you may continue your unfinished operation
   $ hg ci -m 'merge bar'
   $ hg log --config diff.git=1 -pr .
   changeset:   23:d51446492733
--- a/tests/test-commit-unresolved.t	Fri Apr 18 18:56:26 2014 -0700
+++ b/tests/test-commit-unresolved.t	Fri Apr 18 22:19:25 2014 -0700
@@ -41,6 +41,7 @@
 Mark the conflict as resolved and commit
 
   $ hg resolve -m A
+  no unresolved files; you may continue your unfinished operation
   $ hg commit -m "Merged"
 
   $ cd ..
--- a/tests/test-convert-svn-sink.t	Fri Apr 18 18:56:26 2014 -0700
+++ b/tests/test-convert-svn-sink.t	Fri Apr 18 22:19:25 2014 -0700
@@ -352,6 +352,7 @@
   [1]
   $ hg --cwd b revert -r 2 b
   $ hg --cwd b resolve -m b
+  no unresolved files; you may continue your unfinished operation
   $ hg --cwd b ci -d '5 0' -m 'merge'
 
 Expect 4 changes
--- a/tests/test-fileset.t	Fri Apr 18 18:56:26 2014 -0700
+++ b/tests/test-fileset.t	Fri Apr 18 22:19:25 2014 -0700
@@ -154,6 +154,7 @@
   b2
   $ echo e > b2
   $ hg resolve -m b2
+  no unresolved files; you may continue your unfinished operation
   $ fileset 'resolved()'
   b2
   $ fileset 'unresolved()'
--- a/tests/test-graft.t	Fri Apr 18 18:56:26 2014 -0700
+++ b/tests/test-graft.t	Fri Apr 18 22:19:25 2014 -0700
@@ -220,6 +220,7 @@
 
   $ echo b > e
   $ hg resolve -m e
+  no unresolved files; you may continue your unfinished operation
 
 Continue with a revision should fail:
 
@@ -354,6 +355,7 @@
   [255]
   $ hg resolve --all
   merging a
+  no unresolved files; you may continue your unfinished operation
   $ hg graft -c
   grafting revision 1
   $ hg export tip --git
@@ -382,6 +384,7 @@
   [255]
   $ hg resolve --all
   merging a and b to b
+  no unresolved files; you may continue your unfinished operation
   $ hg graft -c
   grafting revision 2
   $ hg export tip --git
--- a/tests/test-histedit-fold-non-commute.t	Fri Apr 18 18:56:26 2014 -0700
+++ b/tests/test-histedit-fold-non-commute.t	Fri Apr 18 22:19:25 2014 -0700
@@ -95,6 +95,7 @@
 fix up
   $ echo 'I can haz no commute' > e
   $ hg resolve --mark e
+  no unresolved files; you may continue your unfinished operation
   $ cat > cat.py <<EOF
   > import sys
   > print open(sys.argv[1]).read()
@@ -129,6 +130,7 @@
 just continue this time
   $ hg revert -r 'p1()' e
   $ hg resolve --mark e
+  no 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
--- a/tests/test-histedit-fold.t	Fri Apr 18 18:56:26 2014 -0700
+++ b/tests/test-histedit-fold.t	Fri Apr 18 22:19:25 2014 -0700
@@ -217,6 +217,7 @@
   U file
   $ hg revert -r 'p1()' file
   $ hg resolve --mark file
+  no 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)
@@ -276,6 +277,7 @@
   > 5
   > EOF
   $ hg resolve --mark file
+  no unresolved files; you may continue your unfinished operation
   $ hg commit -m '+5.2'
   created new head
   $ echo 6 >> file
--- a/tests/test-histedit-non-commute.t	Fri Apr 18 18:56:26 2014 -0700
+++ b/tests/test-histedit-non-commute.t	Fri Apr 18 22:19:25 2014 -0700
@@ -154,6 +154,7 @@
 fix up
   $ echo 'I can haz no commute' > e
   $ hg resolve --mark e
+  no 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
@@ -167,6 +168,7 @@
 just continue this time
   $ hg revert -r 'p1()' e
   $ hg resolve --mark e
+  no 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
@@ -239,6 +241,7 @@
 
   $ echo 'I can haz no commute' > e
   $ hg resolve --mark e
+  no 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
@@ -248,6 +251,7 @@
 second edit also fails, but just continue
   $ hg revert -r 'p1()' e
   $ hg resolve --mark e
+  no 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
--- a/tests/test-keyword.t	Fri Apr 18 18:56:26 2014 -0700
+++ b/tests/test-keyword.t	Fri Apr 18 22:19:25 2014 -0700
@@ -1058,6 +1058,7 @@
 resolve to local
 
   $ HGMERGE=internal:local hg resolve -a
+  no 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 $
--- a/tests/test-lfconvert.t	Fri Apr 18 18:56:26 2014 -0700
+++ b/tests/test-lfconvert.t	Fri Apr 18 22:19:25 2014 -0700
@@ -132,6 +132,7 @@
   [1]
   $ hg cat -r . sub/maybelarge.dat > stuff/maybelarge.dat
   $ hg resolve -m stuff/maybelarge.dat
+  no 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
--- a/tests/test-log.t	Fri Apr 18 18:56:26 2014 -0700
+++ b/tests/test-log.t	Fri Apr 18 22:19:25 2014 -0700
@@ -990,6 +990,7 @@
   [1]
   $ echo 'merge 1' > foo
   $ hg resolve -m foo
+  no unresolved files; you may continue your unfinished operation
   $ hg ci -m "First merge, related"
 
   $ hg merge 4
@@ -1001,6 +1002,7 @@
   [1]
   $ echo 'merge 2' > foo
   $ hg resolve -m foo
+  no unresolved files; you may continue your unfinished operation
   $ hg ci -m "Last merge, related"
 
   $ hg log --graph
--- a/tests/test-merge-types.t	Fri Apr 18 18:56:26 2014 -0700
+++ b/tests/test-merge-types.t	Fri Apr 18 22:19:25 2014 -0700
@@ -50,6 +50,7 @@
   a is a symlink:
   a -> symlink
   $ hg resolve a --tool internal:other
+  no unresolved files; you may continue your unfinished operation
   $ tellmeabout a
   a is an executable file with content:
   a
--- a/tests/test-merge7.t	Fri Apr 18 18:56:26 2014 -0700
+++ b/tests/test-merge7.t	Fri Apr 18 22:19:25 2014 -0700
@@ -57,6 +57,7 @@
   > EOF
   $ rm -f *.orig
   $ hg resolve -m test.txt
+  no unresolved files; you may continue your unfinished operation
   $ hg commit -m "Merge 1"
 
 change test-a again
--- a/tests/test-mq-qnew.t	Fri Apr 18 18:56:26 2014 -0700
+++ b/tests/test-mq-qnew.t	Fri Apr 18 22:19:25 2014 -0700
@@ -158,6 +158,7 @@
   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 unresolved files; you may continue your unfinished operation
   abort: cannot manage merge changesets
   $ rm -r sandbox
 
@@ -231,6 +232,7 @@
   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 unresolved files; you may continue your unfinished operation
   abort: cannot manage merge changesets
   $ rm -r sandbox
 
--- a/tests/test-rebase-bookmarks.t	Fri Apr 18 18:56:26 2014 -0700
+++ b/tests/test-rebase-bookmarks.t	Fri Apr 18 22:19:25 2014 -0700
@@ -168,6 +168,7 @@
   [1]
   $ echo 'c' > c
   $ hg resolve --mark c
+  no 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
--- a/tests/test-rebase-check-restore.t	Fri Apr 18 18:56:26 2014 -0700
+++ b/tests/test-rebase-check-restore.t	Fri Apr 18 22:19:25 2014 -0700
@@ -76,6 +76,7 @@
   $ echo 'conflict solved' > A
   $ rm A.orig
   $ hg resolve -m A
+  no unresolved files; you may continue your unfinished operation
   $ hg rebase --continue
 
   $ hg tglog
@@ -129,6 +130,7 @@
   $ echo 'conflict solved' > A
   $ rm A.orig
   $ hg resolve -m A
+  no unresolved files; you may continue your unfinished operation
   $ hg rebase --continue
   saved backup bundle to $TESTTMP/a2/.hg/strip-backup/*-backup.hg (glob)
 
--- a/tests/test-rebase-conflicts.t	Fri Apr 18 18:56:26 2014 -0700
+++ b/tests/test-rebase-conflicts.t	Fri Apr 18 22:19:25 2014 -0700
@@ -77,6 +77,7 @@
 
   $ echo 'resolved merge' >common
   $ hg resolve -m common
+  no unresolved files; you may continue your unfinished operation
   $ hg rebase --continue
   saved backup bundle to $TESTTMP/a/.hg/strip-backup/*-backup.hg (glob)
 
--- a/tests/test-rebase-detach.t	Fri Apr 18 18:56:26 2014 -0700
+++ b/tests/test-rebase-detach.t	Fri Apr 18 22:19:25 2014 -0700
@@ -374,6 +374,7 @@
   unresolved conflicts (see hg resolve, then hg rebase --continue)
   [1]
   $ hg resolve --all -t internal:local
+  no 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"
--- a/tests/test-rebase-interruptions.t	Fri Apr 18 18:56:26 2014 -0700
+++ b/tests/test-rebase-interruptions.t	Fri Apr 18 22:19:25 2014 -0700
@@ -104,6 +104,7 @@
   $ echo 'conflict solved' > A
   $ rm A.orig
   $ hg resolve -m A
+  no unresolved files; you may continue your unfinished operation
 
   $ hg rebase --continue
   warning: new changesets detected on source branch, not stripping
--- a/tests/test-rebase-mq-skip.t	Fri Apr 18 18:56:26 2014 -0700
+++ b/tests/test-rebase-mq-skip.t	Fri Apr 18 22:19:25 2014 -0700
@@ -111,6 +111,7 @@
   [1]
 
   $ HGMERGE=internal:local hg resolve --all
+  no unresolved files; you may continue your unfinished operation
 
   $ hg rebase --continue
   saved backup bundle to $TESTTMP/b/.hg/strip-backup/*-backup.hg (glob)
--- a/tests/test-rebase-mq.t	Fri Apr 18 18:56:26 2014 -0700
+++ b/tests/test-rebase-mq.t	Fri Apr 18 22:19:25 2014 -0700
@@ -69,6 +69,7 @@
 
   $ echo mq1r1 > f
   $ hg resolve -m f
+  no unresolved files; you may continue your unfinished operation
   $ hg rebase -c
   merging f
   warning: conflicts during merge.
@@ -80,6 +81,7 @@
 
   $ echo mq1r1mq2 > f
   $ hg resolve -m f
+  no unresolved files; you may continue your unfinished operation
   $ hg rebase -c
   saved backup bundle to $TESTTMP/a/.hg/strip-backup/*-backup.hg (glob)
 
--- a/tests/test-rebase-parameters.t	Fri Apr 18 18:56:26 2014 -0700
+++ b/tests/test-rebase-parameters.t	Fri Apr 18 22:19:25 2014 -0700
@@ -454,6 +454,7 @@
   U c2
 
   $ hg resolve -m c2
+  no 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)
--- a/tests/test-resolve.t	Fri Apr 18 18:56:26 2014 -0700
+++ b/tests/test-resolve.t	Fri Apr 18 22:19:25 2014 -0700
@@ -39,6 +39,7 @@
 
   $ echo resolved > file
   $ hg resolve -m file
+  no unresolved files; you may continue your unfinished operation
   $ hg commit -m 'resolved'
 
 resolve -l should error since no merge in progress
--- a/tests/test-shelve.t	Fri Apr 18 18:56:26 2014 -0700
+++ b/tests/test-shelve.t	Fri Apr 18 22:19:25 2014 -0700
@@ -294,6 +294,7 @@
 
   $ hg revert -r . a/a
   $ hg resolve -m a/a
+  no unresolved files; you may continue your unfinished operation
 
   $ hg commit -m 'commit while unshelve in progress'
   abort: unshelve already in progress