[PATCH] merge: suggest 'hg up -C .' for discarding changes, not 'hg up -C'

Brodie Rao brodie at bitheap.org
Wed Sep 1 15:13:20 CDT 2010


# HG changeset patch
# User Brodie Rao <brodie at bitheap.org>
# Date 1283371843 14400
# Node ID 950086b9dff8c05fbc454f7c95da23792e33c71f
# Parent  a55e3c50868fc2e827f44187c7fd3f6c4e2f3f31
merge: suggest 'hg up -C .' for discarding changes, not 'hg up -C'

Without specifying the parent revision of the working copy, users will
update to tip, which is most likely the other head they were trying to
merge, not the revision they were at before the merge.

diff -r a55e3c50868f -r 950086b9dff8 mercurial/hg.py
--- a/mercurial/hg.py	Wed Sep 01 15:23:21 2010 +0200
+++ b/mercurial/hg.py	Wed Sep 01 16:10:43 2010 -0400
@@ -400,7 +400,7 @@ def merge(repo, node, force=None, remind
     _showstats(repo, stats)
     if stats[3]:
         repo.ui.status(_("use 'hg resolve' to retry unresolved file merges "
-                         "or 'hg update -C' to abandon\n"))
+                         "or 'hg update -C .' to abandon\n"))
     elif remind:
         repo.ui.status(_("(branch merge, don't forget to commit)\n"))
     return stats[3] > 0
diff -r a55e3c50868f -r 950086b9dff8 mercurial/merge.py
--- a/mercurial/merge.py	Wed Sep 01 15:23:21 2010 +0200
+++ b/mercurial/merge.py	Wed Sep 01 16:10:43 2010 -0400
@@ -448,7 +448,7 @@ def update(repo, node, branchmerge, forc
     * = don't-care
     1 = abort: crosses branches (use 'hg merge' or 'hg update -c')
     2 = abort: crosses branches (use 'hg merge' to merge or
-                 use 'hg update -C' to discard changes)
+                 use 'hg update -C .' to discard changes)
     3 = abort: uncommitted local changes
     4 = incompatible options (checked in commands.py)
     """
@@ -494,7 +494,8 @@ def update(repo, node, branchmerge, forc
                 pass # all good
             elif wc.files() or wc.deleted():
                 raise util.Abort(_("crosses branches (use 'hg merge' to merge "
-                                 "or use 'hg update -C' to discard changes)"))
+                                   "or use 'hg update -C .' to discard "
+                                   "changes)"))
             elif onode is None:
                 raise util.Abort(_("crosses branches (use 'hg merge' or use "
                                    "'hg update -c')"))
diff -r a55e3c50868f -r 950086b9dff8 tests/test-add.t
--- a/tests/test-add.t	Wed Sep 01 15:23:21 2010 +0200
+++ b/tests/test-add.t	Wed Sep 01 16:10:43 2010 -0400
@@ -53,7 +53,7 @@ should fail
   warning: conflicts during merge.
   merging a failed!
   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
+  use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
   $ hg st
   M a
   ? a.orig
diff -r a55e3c50868f -r 950086b9dff8 tests/test-commit-unresolved.t
--- a/tests/test-commit-unresolved.t	Wed Sep 01 15:23:21 2010 +0200
+++ b/tests/test-commit-unresolved.t	Wed Sep 01 16:10:43 2010 -0400
@@ -31,7 +31,7 @@ Merging a conflict araises
   warning: conflicts during merge.
   merging A failed!
   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
+  use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
 
 Correct the conflict without marking the file as resolved
 
diff -r a55e3c50868f -r 950086b9dff8 tests/test-conflict.t
--- a/tests/test-conflict.t	Wed Sep 01 15:23:21 2010 +0200
+++ b/tests/test-conflict.t	Wed Sep 01 16:10:43 2010 -0400
@@ -15,7 +15,7 @@
   warning: conflicts during merge.
   merging a failed!
   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
+  use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
 
   $ hg id
   e7fe8eb3e180+0d24b7662d3e+ tip
diff -r a55e3c50868f -r 950086b9dff8 tests/test-convert-svn-sink.out
--- a/tests/test-convert-svn-sink.out	Wed Sep 01 15:23:21 2010 +0200
+++ b/tests/test-convert-svn-sink.out	Wed Sep 01 16:10:43 2010 -0400
@@ -265,7 +265,7 @@ merging b
 warning: conflicts during merge.
 merging b failed!
 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
+use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
 assuming destination b-hg
 initializing svn repository 'b-hg'
 initializing svn working copy 'b-hg-wc'
diff -r a55e3c50868f -r 950086b9dff8 tests/test-keyword.t
--- a/tests/test-keyword.t	Wed Sep 01 15:23:21 2010 +0200
+++ b/tests/test-keyword.t	Wed Sep 01 16:10:43 2010 -0400
@@ -817,7 +817,7 @@ conflict: keyword should stay outside co
   warning: conflicts during merge.
   merging m failed!
   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
+  use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
   $ cat m
   $Id$
   <<<<<<< local
diff -r a55e3c50868f -r 950086b9dff8 tests/test-log.t
--- a/tests/test-log.t	Wed Sep 01 15:23:21 2010 +0200
+++ b/tests/test-log.t	Wed Sep 01 16:10:43 2010 -0400
@@ -898,7 +898,7 @@ log -p -R repo
   warning: conflicts during merge.
   merging foo failed!
   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
+  use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
   $ echo 'merge 1' > foo
   $ hg resolve -m foo
   $ hg ci -m "First merge, related"
@@ -908,7 +908,7 @@ log -p -R repo
   warning: conflicts during merge.
   merging foo failed!
   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
+  use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
   $ echo 'merge 2' > foo
   $ hg resolve -m foo
   $ hg ci -m "Last merge, related"
diff -r a55e3c50868f -r 950086b9dff8 tests/test-merge-internal-tools-pattern.out
--- a/tests/test-merge-internal-tools-pattern.out	Wed Sep 01 15:23:21 2010 +0200
+++ b/tests/test-merge-internal-tools-pattern.out	Wed Sep 01 16:10:43 2010 -0400
@@ -9,7 +9,7 @@ 1 files updated, 0 files merged, 0 files
 created new head
 # merge using internal:fail tool
 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
+use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
 line 1
 line 2
 third line
diff -r a55e3c50868f -r 950086b9dff8 tests/test-merge-tools.out
--- a/tests/test-merge-tools.out	Wed Sep 01 15:23:21 2010 +0200
+++ b/tests/test-merge-tools.out	Wed Sep 01 16:10:43 2010 -0400
@@ -17,7 +17,7 @@ merging f
 warning: conflicts during merge.
 merging f failed!
 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
+use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
 # cat f
 <<<<<<< local
 revision 1
@@ -37,7 +37,7 @@ false.whatever=
 merging f
 merging f failed!
 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
+use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
 # cat f
 revision 1
 space
@@ -69,7 +69,7 @@ true.priority=1
 merging f
 merging f failed!
 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
+use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
 # cat f
 revision 1
 space
@@ -86,7 +86,7 @@ true.priority=1
 merging f
 merging f failed!
 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
+use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
 # cat f
 revision 1
 space
@@ -103,7 +103,7 @@ true.priority=1
 merging f
 merging f failed!
 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
+use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
 # cat f
 revision 1
 space
@@ -120,7 +120,7 @@ true.priority=1
 merging f
 merging f failed!
 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
+use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
 # cat f
 revision 1
 space
@@ -185,7 +185,7 @@ true.executable=cat
 merging f
 merging f failed!
 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
+use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
 # cat f
 revision 1
 space
@@ -204,7 +204,7 @@ couldn't find merge tool true specified 
 merging f
 merging f failed!
 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
+use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
 # cat f
 revision 1
 space
@@ -223,7 +223,7 @@ couldn't find merge tool true specified 
 merging f
 merging f failed!
 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
+use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
 # cat f
 revision 1
 space
@@ -244,7 +244,7 @@ true.executable=cat
 merging f
 merging f failed!
 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
+use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
 # cat f
 revision 1
 space
@@ -260,7 +260,7 @@ true.executable=cat
 # hg update -C 1
 # hg merge -r 2 --config ui.merge=internal:fail
 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
+use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
 # cat f
 revision 1
 space
@@ -323,7 +323,7 @@ true.executable=cat
 # hg merge -r 2 --config ui.merge=internal:dump
 merging f
 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
+use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
 # cat f
 revision 1
 space
@@ -354,7 +354,7 @@ true.executable=cat
 merging f
 merging f failed!
 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
+use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
 # cat f
 revision 1
 space
@@ -537,7 +537,7 @@ merging f
 was merge successful (yn)? n
 merging f failed!
 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
+use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
 # cat f
 revision 1
 space
diff -r a55e3c50868f -r 950086b9dff8 tests/test-merge5.t
--- a/tests/test-merge5.t	Wed Sep 01 15:23:21 2010 +0200
+++ b/tests/test-merge5.t	Wed Sep 01 16:10:43 2010 -0400
@@ -20,7 +20,7 @@ user for "keep or delete"
 
 should abort
   $ hg update -y 1
-  abort: crosses branches (use 'hg merge' to merge or use 'hg update -C' to discard changes)
+  abort: crosses branches (use 'hg merge' to merge or use 'hg update -C .' to discard changes)
   $ mv c a
 should succeed
   $ hg update -y 1
diff -r a55e3c50868f -r 950086b9dff8 tests/test-merge7.t
--- a/tests/test-merge7.t	Wed Sep 01 15:23:21 2010 +0200
+++ b/tests/test-merge7.t	Wed Sep 01 16:10:43 2010 -0400
@@ -47,7 +47,7 @@ now pull and merge from test-a
   warning: conflicts during merge.
   merging test.txt failed!
   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
+  use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
 resolve conflict
   $ cat >test.txt <<"EOF"
   > one
@@ -91,7 +91,7 @@ pull and merge from test-a again
   warning: conflicts during merge.
   merging test.txt failed!
   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
+  use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
 
   $ cat test.txt
   one
diff -r a55e3c50868f -r 950086b9dff8 tests/test-merge9.t
--- a/tests/test-merge9.t	Wed Sep 01 15:23:21 2010 +0200
+++ b/tests/test-merge9.t	Wed Sep 01 16:10:43 2010 -0400
@@ -30,7 +30,7 @@ test with the rename on the remote side
   merging bar failed!
   merging foo and baz to baz
   1 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
+  use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
   $ hg resolve -l
   U bar
   R baz
@@ -43,7 +43,7 @@ test with the rename on the local side
   merging bar failed!
   merging baz and foo to baz
   1 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
+  use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
 
 show unresolved
   $ hg resolve -l
diff -r a55e3c50868f -r 950086b9dff8 tests/test-mq-qnew.out
--- a/tests/test-mq-qnew.out	Wed Sep 01 15:23:21 2010 +0200
+++ b/tests/test-mq-qnew.out	Wed Sep 01 16:10:43 2010 -0400
@@ -53,7 +53,7 @@ merging a
 warning: conflicts during merge.
 merging a failed!
 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
+use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
 abort: cannot manage merge changesets
 %%% hg headers
 adding a
@@ -116,5 +116,5 @@ merging a
 warning: conflicts during merge.
 merging a failed!
 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
+use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
 abort: cannot manage merge changesets
diff -r a55e3c50868f -r 950086b9dff8 tests/test-resolve.t
--- a/tests/test-resolve.t	Wed Sep 01 15:23:21 2010 +0200
+++ b/tests/test-resolve.t	Wed Sep 01 16:10:43 2010 -0400
@@ -23,7 +23,7 @@ failing merge
 
   $ HGMERGE=internal:fail hg merge
   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
+  use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
 
   $ echo resolved > file
   $ hg resolve -m file
diff -r a55e3c50868f -r 950086b9dff8 tests/test-status-color.t
--- a/tests/test-status-color.t	Wed Sep 01 15:23:21 2010 +0200
+++ b/tests/test-status-color.t	Wed Sep 01 16:10:43 2010 -0400
@@ -267,7 +267,7 @@ test unknown color
   warning: conflicts during merge.
   merging b failed!
   0 files updated, 0 files merged, 0 files removed, 2 files unresolved
-  use 'hg resolve' to retry unresolved file merges or 'hg update -C' to abandon
+  use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
   $ hg resolve -m b
 
 hg resolve with one unresolved, one resolved:
diff -r a55e3c50868f -r 950086b9dff8 tests/test-subrepo.t
--- a/tests/test-subrepo.t	Wed Sep 01 15:23:21 2010 +0200
+++ b/tests/test-subrepo.t	Wed Sep 01 16:10:43 2010 -0400
@@ -217,7 +217,7 @@ merge tests
   warning: conflicts during merge.
   merging t failed!
   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
+  use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   (branch merge, don't forget to commit)
 
diff -r a55e3c50868f -r 950086b9dff8 tests/test-up-local-change.t
--- a/tests/test-up-local-change.t	Wed Sep 01 15:23:21 2010 +0200
+++ b/tests/test-up-local-change.t	Wed Sep 01 16:10:43 2010 -0400
@@ -167,7 +167,7 @@ create a second head
   summary:     2
   
   $ hg --debug up || echo failed
-  abort: crosses branches (use 'hg merge' to merge or use 'hg update -C' to discard changes)
+  abort: crosses branches (use 'hg merge' to merge or use 'hg update -C .' to discard changes)
   failed
   $ hg --debug merge || echo failed
   abort: outstanding uncommitted changes (use 'hg status' to list changes)
diff -r a55e3c50868f -r 950086b9dff8 tests/test-update-branches.out
--- a/tests/test-update-branches.out	Wed Sep 01 15:23:21 2010 +0200
+++ b/tests/test-update-branches.out	Wed Sep 01 16:10:43 2010 -0400
@@ -32,11 +32,11 @@ 1 files updated, 0 files merged, 0 files
 parent=2
 M foo
 % revtest none dirty same 2 3
-abort: crosses branches (use 'hg merge' to merge or use 'hg update -C' to discard changes)
+abort: crosses branches (use 'hg merge' to merge or use 'hg update -C .' to discard changes)
 parent=2
 M foo
 % revtest none dirty cross 3 4
-abort: crosses branches (use 'hg merge' to merge or use 'hg update -C' to discard changes)
+abort: crosses branches (use 'hg merge' to merge or use 'hg update -C .' to discard changes)
 parent=3
 M foo
 % revtest -C dirty linear 1 2


More information about the Mercurial-devel mailing list