Patchwork D8646: update: suggest --merge while `hg up` across topo branches

login
register
mail settings
Submitter phabricator
Date June 22, 2020, 2:12 a.m.
Message ID <differential-rev-PHID-DREV-c5kkawswqsbc25igp2ux-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/46543/
State New
Headers show

Comments

phabricator - June 22, 2020, 2:12 a.m.
khanchi97 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Before this patch, during `hg up` across topological branches with
  dirty working directory we suggested the user to "commit or update
  --clean to discard"
  
  I think suggesting --merge is better than --clean (which discard
  changes with no backup). We can keep all the three options, but
  probably then we will have sacrifice length of message.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D8646

AFFECTED FILES
  mercurial/merge.py
  tests/test-merge5.t
  tests/test-update-branches.t

CHANGE DETAILS




To: khanchi97, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/tests/test-update-branches.t b/tests/test-update-branches.t
--- a/tests/test-update-branches.t
+++ b/tests/test-update-branches.t
@@ -129,19 +129,19 @@ 
 
   $ revtest 'none dirty same'   dirty 2 3
   abort: uncommitted changes
-  (commit or update --clean to discard changes)
+  (commit or update --merge to take along changes)
   parent=2
   M foo
 
   $ revtest 'none dirtysub same'   dirtysub 2 3
   abort: uncommitted changes
-  (commit or update --clean to discard changes)
+  (commit or update --merge to take along changes)
   parent=2
   M sub/suba
 
   $ revtest 'none dirty cross'  dirty 3 4
   abort: uncommitted changes
-  (commit or update --clean to discard changes)
+  (commit or update --merge to take along changes)
   parent=3
   M foo
 
@@ -154,7 +154,7 @@ 
 
   $ revtest 'none dirtysub cross'  dirtysub 3 4
   abort: uncommitted changes
-  (commit or update --clean to discard changes)
+  (commit or update --merge to take along changes)
   parent=3
   M sub/suba
 
@@ -368,7 +368,7 @@ 
 
   $ revtest 'dirty cross'  dirty 3 4
   abort: uncommitted changes
-  (commit or update --clean to discard changes)
+  (commit or update --merge to take along changes)
   parent=3
   M foo
 
@@ -572,7 +572,7 @@ 
   $ echo conflict > a
   $ hg up --hidden 3
   abort: uncommitted changes
-  (commit or update --clean to discard changes)
+  (commit or update --merge to take along changes)
   [255]
 
 Test that we still warn also when there are conflicts
@@ -673,7 +673,7 @@ 
   $ hg up --quiet 2
   $ hg up 5
   abort: uncommitted changes
-  (commit or update --clean to discard changes)
+  (commit or update --merge to take along changes)
   [255]
 
 Test that we don't crash when updating from a pruned changeset (i.e. has no
diff --git a/tests/test-merge5.t b/tests/test-merge5.t
--- a/tests/test-merge5.t
+++ b/tests/test-merge5.t
@@ -26,7 +26,7 @@ 
 
   $ hg update 1
   abort: uncommitted changes
-  (commit or update --clean to discard changes)
+  (commit or update --merge to take along changes)
   [255]
   $ mv c a
 
diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -1644,7 +1644,7 @@ 
                         pass  # allow updating to successors
                     else:
                         msg = _(b"uncommitted changes")
-                        hint = _(b"commit or update --clean to discard changes")
+                        hint = _(b"commit or update --merge to take along changes")
                         raise error.UpdateAbort(msg, hint=hint)
                 else:
                     # Allow jumping branches if clean and specific rev given