changeset 12681:bc13e17067d9

update: use higher level wording for "crosses branches" error When using "hg update" to update to a revision on another branch, if the user has uncommitted changes in the working directory, hg aborts with the following message: abort: crosses branches (use 'hg merge' to merge or use 'hg update -C' to discard changes) If the user isn't trying to update to tip and they follow the command examples verbatim, they would end up updating to the wrong revision. This patch removes the command examples in favor of just telling the user to either merge or use --clean: abort: crosses branches (merge branches or use --clean to discard changes) hg also aborts if the user tries to use "hg update" to get to tip (without specifying a revision) and tip is on another branch: abort: crosses branches (use 'hg merge' or use 'hg update -c') This message is changed in the same fashion: abort: crosses branches (merge branches or use --check to force update)
author Brodie Rao <brodie@bitheap.org>
date Sat, 09 Oct 2010 17:02:28 -0500
parents d664547ef540
children 58a3e2608ae4
files mercurial/merge.py tests/test-merge5.t tests/test-up-local-change.t tests/test-update-branches.t
diffstat 4 files changed, 10 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/merge.py	Sat Oct 09 17:58:48 2010 -0500
+++ b/mercurial/merge.py	Sat Oct 09 17:02:28 2010 -0500
@@ -502,11 +502,11 @@
             if pa == p1 or pa == p2: # linear
                 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)"))
+                raise util.Abort(_("crosses branches (merge branches or use"
+                                   " --clean to discard changes)"))
             elif onode is None:
-                raise util.Abort(_("crosses branches (use 'hg merge' or use "
-                                   "'hg update -c')"))
+                raise util.Abort(_("crosses branches (merge branches or use"
+                                   " --check to force update)"))
             else:
                 # Allow jumping branches if clean and specific rev given
                 overwrite = True
--- a/tests/test-merge5.t	Sat Oct 09 17:58:48 2010 -0500
+++ b/tests/test-merge5.t	Sat Oct 09 17:02:28 2010 -0500
@@ -14,7 +14,7 @@
   $ hg update 1
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg update
-  abort: crosses branches (use 'hg merge' or use 'hg update -c')
+  abort: crosses branches (merge branches or use --check to force update)
   [255]
   $ hg update -c
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
@@ -27,7 +27,7 @@
 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 (merge branches or use --clean to discard changes)
   [255]
   $ mv c a
 
--- a/tests/test-up-local-change.t	Sat Oct 09 17:58:48 2010 -0500
+++ b/tests/test-up-local-change.t	Sat Oct 09 17:02:28 2010 -0500
@@ -167,7 +167,7 @@
   summary:     2
   
   $ hg --debug up
-  abort: crosses branches (use 'hg merge' to merge or use 'hg update -C' to discard changes)
+  abort: crosses branches (merge branches or use --clean to discard changes)
   [255]
   $ hg --debug merge
   abort: outstanding uncommitted changes (use 'hg status' to list changes)
--- a/tests/test-update-branches.t	Sat Oct 09 17:58:48 2010 -0500
+++ b/tests/test-update-branches.t	Sat Oct 09 17:02:28 2010 -0500
@@ -77,7 +77,7 @@
   parent=5
 
   $ norevtest 'none clean same'   clean 2
-  abort: crosses branches (use 'hg merge' or use 'hg update -c')
+  abort: crosses branches (merge branches or use --check to force update)
   parent=2
 
 
@@ -100,12 +100,12 @@
   M foo
 
   $ revtest 'none dirty same'   dirty 2 3
-  abort: crosses branches (use 'hg merge' to merge or use 'hg update -C' to discard changes)
+  abort: crosses branches (merge branches or use --clean to discard changes)
   parent=2
   M foo
 
   $ revtest 'none dirty cross'  dirty 3 4
-  abort: crosses branches (use 'hg merge' to merge or use 'hg update -C' to discard changes)
+  abort: crosses branches (merge branches or use --clean to discard changes)
   parent=3
   M foo