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)
This commit is contained in:
Brodie Rao 2010-10-09 17:02:28 -05:00
parent 954949fd67
commit 2187fcb2bb
4 changed files with 10 additions and 10 deletions

View File

@ -502,11 +502,11 @@ def update(repo, node, branchmerge, force, partial):
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

View File

@ -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

View File

@ -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)

View File

@ -77,7 +77,7 @@ Cases are run as shown in that table, row by row.
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, row by row.
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