Show More
@@ -2764,17 +2764,17 b' def update(ui, repo, node=None, rev=None' | |||
|
2764 | 2764 | |
|
2765 | 2765 | Update the working directory to the specified revision, or the |
|
2766 | 2766 | tip of the current branch if none is specified. |
|
2767 | See 'hg help dates' for a list of formats valid for -d/--date. | |
|
2768 | ||
|
2769 |
|
|
|
2770 | result is the requested version. | |
|
2771 | ||
|
2772 | If the requested version is a descendant of the working directory | |
|
2773 | and there are outstanding changes, those changes will be merged | |
|
2774 | into the result. | |
|
2775 | ||
|
2776 | By default, update will refuse to run if there are outstanding | |
|
2777 | changes and the update spans branches. | |
|
2767 | ||
|
2768 | If the requested revision is a descendant of the working | |
|
2769 | directory, any outstanding changes in the working directory will | |
|
2770 | be merged into the result. If it is not directly descended but is | |
|
2771 | on the same named branch, update aborts with a suggestion to use | |
|
2772 | merge or update -C instead. | |
|
2773 | ||
|
2774 | If the requested revision is on a different named branch and the | |
|
2775 | working directory is clean, update quietly switches branches. | |
|
2776 | ||
|
2777 | See 'hg help dates' for a list of formats valid for --date. | |
|
2778 | 2778 | """ |
|
2779 | 2779 | if rev and node: |
|
2780 | 2780 | raise util.Abort(_("please specify just one revision")) |
@@ -346,7 +346,6 b' def update(repo, node, branchmerge, forc' | |||
|
346 | 346 | else: |
|
347 | 347 | raise util.Abort(_("branch %s not found") % wc.branch()) |
|
348 | 348 | overwrite = force and not branchmerge |
|
349 | forcemerge = force and branchmerge | |
|
350 | 349 | pl = wc.parents() |
|
351 | 350 | p1, p2 = pl[0], repo.changectx(node) |
|
352 | 351 | pa = p1.ancestor(p2) |
@@ -356,22 +355,32 b' def update(repo, node, branchmerge, forc' | |||
|
356 | 355 | ### check phase |
|
357 | 356 | if not overwrite and len(pl) > 1: |
|
358 | 357 | raise util.Abort(_("outstanding uncommitted merges")) |
|
359 | if pa == p1 or pa == p2: # is there a linear path from p1 to p2? | |
|
360 |
if |
|
|
361 | if p1.branch() != p2.branch() and pa != p2: | |
|
358 | if branchmerge: | |
|
359 | if pa == p2: | |
|
360 | raise util.Abort(_("can't merge with ancestor")) | |
|
361 | elif pa == p1: | |
|
362 | if p1.branch() != p2.branch(): | |
|
362 | 363 | fastforward = True |
|
363 | 364 | else: |
|
364 |
raise util.Abort(_(" |
|
|
365 |
" |
|
|
366 | elif not (overwrite or branchmerge): | |
|
367 | if wc.files() or wc.deleted(): | |
|
368 | raise util.Abort(_("update spans branches, use 'hg merge' " | |
|
369 | "or 'hg update -C' to lose changes")) | |
|
370 | # Allow jumping branches if there are no changes | |
|
371 | overwrite = True | |
|
372 | if branchmerge and not forcemerge: | |
|
373 | if wc.files() or wc.deleted(): | |
|
365 | raise util.Abort(_("nothing to merge (use 'hg update'" | |
|
366 | " or check 'hg heads')")) | |
|
367 | if not force and (wc.files() or wc.deleted()): | |
|
374 | 368 | raise util.Abort(_("outstanding uncommitted changes")) |
|
369 | elif not overwrite: | |
|
370 | if pa == p1 or pa == p2: # linear | |
|
371 | pass # all good | |
|
372 | elif p1.branch() == p2.branch(): | |
|
373 | if wc.files() or wc.deleted(): | |
|
374 | raise util.Abort(_("crosses branches (use 'hg merge' or " | |
|
375 | "'hg update -C' to discard changes)")) | |
|
376 | raise util.Abort(_("crosses branches (use 'hg merge'" | |
|
377 | "or 'hg update -C')")) | |
|
378 | elif wc.files() or wc.deleted(): | |
|
379 | raise util.Abort(_("crosses named branches (use " | |
|
380 | "'hg update -C' to discard changes)")) | |
|
381 | else: | |
|
382 | # Allow jumping branches if there are no changes | |
|
383 | overwrite = True | |
|
375 | 384 | |
|
376 | 385 | ### calculate phase |
|
377 | 386 | action = [] |
@@ -6,5 +6,5 b' fast-forward' | |||
|
6 | 6 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
7 | 7 | (branch merge, don't forget to commit) |
|
8 | 8 | bogus fast-forward should fail |
|
9 | abort: there is nothing to merge, just use 'hg update' or look at 'hg heads' | |
|
9 | abort: can't merge with ancestor | |
|
10 | 10 | done |
@@ -2,6 +2,6 b' 1 files updated, 0 files merged, 0 files' | |||
|
2 | 2 | removing b |
|
3 | 3 | created new head |
|
4 | 4 | % should abort |
|
5 |
abort: |
|
|
5 | abort: crosses branches (use 'hg merge' or 'hg update -C' to discard changes) | |
|
6 | 6 | % should succeed |
|
7 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
7 | abort: crosses branches (use 'hg merge'or 'hg update -C') |
@@ -103,7 +103,7 b' user: test' | |||
|
103 | 103 | date: Mon Jan 12 13:46:40 1970 +0000 |
|
104 | 104 | summary: 2 |
|
105 | 105 | |
|
106 |
abort: |
|
|
106 | abort: crosses branches (use 'hg merge' or 'hg update -C' to discard changes) | |
|
107 | 107 | failed |
|
108 | 108 | abort: outstanding uncommitted changes |
|
109 | 109 | failed |
General Comments 0
You need to be logged in to leave comments.
Login now