##// END OF EJS Templates
update: no -C needed to switch branches without outstanding changes
Matt Mackall -
r6350:6aa4a3fa default
parent child Browse files
Show More
@@ -2750,15 +2750,15 b' def update(ui, repo, node=None, rev=None'
2750 2750 tip of the current branch if none is specified.
2751 2751 See 'hg help dates' for a list of formats valid for -d/--date.
2752 2752
2753 If there are no outstanding changes in the working directory and
2754 there is a linear relationship between the current version and the
2755 requested version, the result is the requested version.
2756
2757 To merge the working directory with another revision, use the
2758 merge command.
2759
2760 By default, update will refuse to run if doing so would require
2761 discarding local changes.
2753 If there are no outstanding changes in the working directory, the
2754 result is the requested version.
2755
2756 If the requested version is a descendant of the working directory
2757 and there are outstanding changes, those changes will be merged
2758 into the result.
2759
2760 By default, update will refuse to run if there are outstanding
2761 changes and the update spans branches.
2762 2762 """
2763 2763 if rev and node:
2764 2764 raise util.Abort(_("please specify just one revision"))
@@ -364,8 +364,11 b' def update(repo, node, branchmerge, forc'
364 364 raise util.Abort(_("there is nothing to merge, just use "
365 365 "'hg update' or look at 'hg heads'"))
366 366 elif not (overwrite or branchmerge):
367 if wc.files() or wc.deleted():
367 368 raise util.Abort(_("update spans branches, use 'hg merge' "
368 369 "or 'hg update -C' to lose changes"))
370 # Allow jumping branches if there are no changes
371 overwrite = True
369 372 if branchmerge and not forcemerge:
370 373 if wc.files() or wc.deleted():
371 374 raise util.Abort(_("outstanding uncommitted changes"))
@@ -12,9 +12,14 b' hg commit -m"comment #1" -d "1000000 0"'
12 12 hg update 0
13 13 rm b
14 14 hg commit -A -m"comment #2" -d "1000000 0"
15 mv a c
15 16 # in theory, we shouldn't need the "-y" below, but it prevents
16 17 # this test from hanging when "hg update" erroneously prompts the
17 18 # user for "keep or delete"
19 echo % should abort
20 hg update -y 1
21 mv c a
22 echo % should succeed
18 23 hg update -y 1
19 24
20 25 exit 0
@@ -1,4 +1,7 b''
1 1 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
2 2 removing b
3 3 created new head
4 % should abort
4 5 abort: update spans branches, use 'hg merge' or 'hg update -C' to lose changes
6 % should succeed
7 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
General Comments 0
You need to be logged in to leave comments. Login now