# HG changeset patch # User Brodie Rao # Date 2010-10-09 22:02:28 # Node ID bc13e17067d95ae3bc617354b73dd8c2799844e3 # Parent d664547ef54014b1a12cb8070bed0522b547b653 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) diff --git a/mercurial/merge.py b/mercurial/merge.py --- a/mercurial/merge.py +++ b/mercurial/merge.py @@ -502,11 +502,11 @@ def update(repo, node, branchmerge, forc 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 diff --git a/tests/test-merge5.t b/tests/test-merge5.t --- a/tests/test-merge5.t +++ b/tests/test-merge5.t @@ -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 @@ 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 (merge branches or use --clean to discard changes) [255] $ mv c a 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,7 @@ create a second head 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) 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 @@ -77,7 +77,7 @@ Cases are run as shown in that table, ro 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 @@ Cases are run as shown in that table, ro 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