# HG changeset patch # User Siddharth Agarwal # Date 1379992132 25200 # Node ID 4894e0d9462dc91b90a2637f56d661e14a201f8d # Parent ab3e42225dbc16b20086313100d6e7b7ba01525b update: improve error message for dirty non-linear update with rev diff -r ab3e42225dbc -r 4894e0d9462d mercurial/merge.py --- a/mercurial/merge.py Mon Sep 23 20:07:30 2013 -0700 +++ b/mercurial/merge.py Mon Sep 23 20:08:52 2013 -0700 @@ -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 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 -r ab3e42225dbc -r 4894e0d9462d tests/test-up-local-change.t --- a/tests/test-up-local-change.t Mon Sep 23 20:07:30 2013 -0700 +++ b/tests/test-up-local-change.t Mon Sep 23 20:08:52 2013 -0700 @@ -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 -r ab3e42225dbc -r 4894e0d9462d tests/test-update-branches.t --- a/tests/test-update-branches.t Mon Sep 23 20:07:30 2013 -0700 +++ b/tests/test-update-branches.t Mon Sep 23 20:08:52 2013 -0700 @@ -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)