[PATCH 4 of 9] update: improve error message for dirty non-linear update with rev
Siddharth Agarwal
sid0 at fb.com
Mon Sep 23 23:51:01 CDT 2013
# HG changeset patch
# User Siddharth Agarwal <sid0 at fb.com>
# Date 1379992132 25200
# Mon Sep 23 20:08:52 2013 -0700
# Node ID f12996d75571ec2568906159e39277ade0579681
# Parent 3c9d933940fabae7052a1bdad0eb9b47e61fb455
update: improve error message for dirty non-linear update with rev
diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -666,8 +666,8 @@
x = can't happen
* = don't-care
1 = abort: not a linear update (merge or update --check to force update)
- 2 = abort: crosses branches (use 'hg merge' to merge or
- use 'hg update -C' to discard changes)
+ 2 = abort: uncommitted changes (commit and merge, or update --clean to
+ discard changes)
3 = abort: uncommitted changes (commit or update --clean to discard changes)
4 = abort: uncommitted local changes
5 = incompatible options (checked in commands.py)
@@ -728,13 +728,14 @@
# note: the <node> variable contains a random identifier
if repo[node].node() in foreground:
pa = p1 # allow updating to successors
- elif dirty and onode is None:
- msg = _("crosses branches (merge branches or use"
- " --clean to discard changes)")
- raise util.Abort(msg)
elif dirty:
msg = _("uncommitted changes")
- hint = _("commit or update --clean to discard changes")
+ if onode is None:
+ hint = _("commit and merge, or update --clean to"
+ " discard changes")
+ else:
+ hint = _("commit or update --clean to discard"
+ " changes")
raise util.Abort(msg, hint=hint)
else: # node is none
msg = _("not a linear update")
diff --git a/tests/test-up-local-change.t b/tests/test-up-local-change.t
--- a/tests/test-up-local-change.t
+++ b/tests/test-up-local-change.t
@@ -167,7 +167,8 @@
summary: 2
$ hg --debug up
- abort: crosses branches (merge branches or use --clean to discard changes)
+ abort: uncommitted changes
+ (commit and merge, or update --clean to discard changes)
[255]
$ hg --debug merge
abort: outstanding uncommitted changes
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
@@ -140,6 +140,12 @@
parent=3
M foo
+ $ norevtest 'none dirty cross' dirty 2
+ abort: uncommitted changes
+ (commit and merge, or update --clean to discard changes)
+ parent=2
+ M foo
+
$ revtest 'none dirtysub cross' dirtysub 3 4
abort: uncommitted changes
(commit or update --clean to discard changes)
More information about the Mercurial-devel
mailing list