ui: output the number of file updated/merged/removed/... on update
authorBenoit Boissinot <benoit.boissinot@ens-lyon.org>
Mon, 13 Mar 2006 08:56:59 +0100
changeset 1922 6d50d6189269
parent 1921 acce3f7e1779
child 1932 82995896d5af
ui: output the number of file updated/merged/removed/... on update add a note for people to remember commiting after a merge.
mercurial/localrepo.py
tests/test-filebranch.out
tests/test-flags.out
tests/test-merge7.out
tests/test-up-local-change.out
tests/test-update-reverse.out
--- a/mercurial/localrepo.py	Sun Mar 12 20:34:09 2006 +0100
+++ b/mercurial/localrepo.py	Mon Mar 13 08:56:59 2006 +0100
@@ -1634,6 +1634,7 @@
                     self.dirstate.update([f], 'n')
 
         # merge the tricky bits
+        failedmerge = []
         files = merge.keys()
         files.sort()
         xp1 = hex(p1)
@@ -1644,6 +1645,7 @@
             ret = self.merge3(f, my, other, xp1, xp2)
             if ret:
                 err = True
+                failedmerge.append(f)
             util.set_exec(self.wjoin(f), flag)
             if moddirstate:
                 if branch_merge:
@@ -1677,6 +1679,16 @@
 
         if moddirstate:
             self.dirstate.setparents(p1, p2)
+
+        stat = ((len(get), _("updated")),
+                (len(merge) - len(failedmerge), _("merged")),
+                (len(remove), _("removed")),
+                (len(failedmerge), _("unresolved")))
+        note = ", ".join([_("%d files %s") % s for s in stat])
+        self.ui.note("%s\n" % note)
+        if moddirstate and branch_merge:
+            self.ui.note(_("(branch merge, don't forget to commit)\n"))
+
         return err
 
     def merge3(self, fn, my, other, p1, p2):
--- a/tests/test-filebranch.out	Sun Mar 12 20:34:09 2006 +0100
+++ b/tests/test-filebranch.out	Mon Mar 13 08:56:59 2006 +0100
@@ -19,6 +19,8 @@
 getting bar
 merging foo
 resolving foo
+1 files updated, 1 files merged, 0 files removed, 0 files unresolved
+(branch merge, don't forget to commit)
 we shouldn't have anything but foo in merge state here
 m 644          3 foo
 main: we should have a merge here
--- a/tests/test-flags.out	Sun Mar 12 20:34:09 2006 +0100
+++ b/tests/test-flags.out	Mon Mar 13 08:56:59 2006 +0100
@@ -44,5 +44,7 @@
 resolving manifests
 merging a
 resolving a
+0 files updated, 1 files merged, 0 files removed, 0 files unresolved
+(branch merge, don't forget to commit)
 -rwxr-x---
 -rwxr-x---
--- a/tests/test-merge7.out	Sun Mar 12 20:34:09 2006 +0100
+++ b/tests/test-merge7.out	Mon Mar 13 08:56:59 2006 +0100
@@ -24,6 +24,8 @@
 resolving test.txt
 file test.txt: my fc3148072371 other d40249267ae3 ancestor 8fe46a3eb557
 merging test.txt failed!
+0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+(branch merge, don't forget to commit)
 one
 <<<<<<<
 two-point-five
--- a/tests/test-up-local-change.out	Sun Mar 12 20:34:09 2006 +0100
+++ b/tests/test-up-local-change.out	Mon Mar 13 08:56:59 2006 +0100
@@ -21,6 +21,7 @@
 merging a
 resolving a
 file a: my b789fdd96dc2 other d730145abbf9 ancestor b789fdd96dc2
+1 files updated, 1 files merged, 0 files removed, 0 files unresolved
 changeset:   1:1e71731e6fbb
 tag:         tip
 user:        test
@@ -32,6 +33,7 @@
  ancestor a0c8bcbbb45c local 1165e8bd193e remote a0c8bcbbb45c
 remote deleted b
 removing b
+0 files updated, 0 files merged, 1 files removed, 0 files unresolved
 changeset:   0:c19d34741b0a
 user:        test
 date:        Thu Jan  1 00:00:00 1970 +0000
@@ -53,6 +55,7 @@
 merging a
 resolving a
 file a: my b789fdd96dc2 other d730145abbf9 ancestor b789fdd96dc2
+1 files updated, 1 files merged, 0 files removed, 0 files unresolved
 changeset:   1:1e71731e6fbb
 tag:         tip
 user:        test
@@ -113,6 +116,8 @@
 merging b
 resolving b
 file b: my 1e88685f5dde other 61de8c7723ca ancestor 000000000000
+0 files updated, 2 files merged, 0 files removed, 0 files unresolved
+(branch merge, don't forget to commit)
 changeset:   1:1e71731e6fbb
 user:        test
 date:        Thu Jan  1 00:00:00 1970 +0000
--- a/tests/test-update-reverse.out	Sun Mar 12 20:34:09 2006 +0100
+++ b/tests/test-update-reverse.out	Mon Mar 13 08:56:59 2006 +0100
@@ -47,6 +47,7 @@
 getting main
 removing side1
 removing side2
+1 files updated, 0 files merged, 2 files removed, 0 files unresolved
 Should only show a main
 a
 main