##// END OF EJS Templates
update: allow branch crossing without -c or -C, with no uncommitted changes...
Stuart W Marks -
r9717:68a1b9d0 default
parent child Browse files
Show More
@@ -412,24 +412,23 b' def update(repo, node, branchmerge, forc'
412
412
413 -c -C dirty rev | linear same cross
413 -c -C dirty rev | linear same cross
414 n n n n | ok (1) x
414 n n n n | ok (1) x
415 n n n y | ok (1) ok
415 n n n y | ok ok ok
416 n n y * | merge (2) (3)
416 n n y * | merge (2) (2)
417 n y * * | --- discard ---
417 n y * * | --- discard ---
418 y n y * | --- (4) ---
418 y n y * | --- (3) ---
419 y n n * | --- ok ---
419 y n n * | --- ok ---
420 y y * * | --- (5) ---
420 y y * * | --- (4) ---
421
421
422 x = can't happen
422 x = can't happen
423 * = don't-care
423 * = don't-care
424 1 = abort: crosses branches (use 'hg merge' or 'hg update -C')
424 1 = abort: crosses branches (use 'hg merge' or 'hg update -c')
425 2 = abort: crosses branches (use 'hg merge' or 'hg update -C'
425 2 = abort: crosses branches (use 'hg merge' to merge or
426 to discard changes)
426 use 'hg update -C' to discard changes)
427 3 = abort: crosses named branches (use 'hg update -C' to
427 3 = abort: uncommitted local changes
428 discard changes)
428 4 = incompatible options (checked in commands.py)
429 4 = abort: uncommitted local changes
430 5 = incompatible options (checked in commands.py)
431 """
429 """
432
430
431 onode = node
433 wlock = repo.wlock()
432 wlock = repo.wlock()
434 try:
433 try:
435 wc = repo[None]
434 wc = repo[None]
@@ -467,17 +466,14 b' def update(repo, node, branchmerge, forc'
467 elif not overwrite:
466 elif not overwrite:
468 if pa == p1 or pa == p2: # linear
467 if pa == p1 or pa == p2: # linear
469 pass # all good
468 pass # all good
470 elif p1.branch() == p2.branch():
471 if wc.files() or wc.deleted():
472 raise util.Abort(_("crosses branches (use 'hg merge' or "
473 "'hg update -C' to discard changes)"))
474 raise util.Abort(_("crosses branches (use 'hg merge' "
475 "or 'hg update -C')"))
476 elif wc.files() or wc.deleted():
469 elif wc.files() or wc.deleted():
477 raise util.Abort(_("crosses named branches (use "
470 raise util.Abort(_("crosses branches (use 'hg merge' to merge "
478 "'hg update -C' to discard changes)"))
471 "or use 'hg update -C' to discard changes)"))
472 elif onode is None:
473 raise util.Abort(_("crosses branches (use 'hg merge' or use "
474 "'hg update -c')"))
479 else:
475 else:
480 # Allow jumping branches if there are no changes
476 # Allow jumping branches if clean and specific rev given
481 overwrite = True
477 overwrite = True
482
478
483 ### calculate phase
479 ### calculate phase
@@ -2,6 +2,6 b' 1 files updated, 0 files merged, 0 files'
2 removing b
2 removing b
3 created new head
3 created new head
4 % should abort
4 % should abort
5 abort: crosses branches (use 'hg merge' or 'hg update -C' to discard changes)
5 abort: crosses branches (use 'hg merge' to merge or use 'hg update -C' to discard changes)
6 % should succeed
6 % should succeed
7 abort: crosses branches (use 'hg merge' or 'hg update -C')
7 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -111,7 +111,7 b' user: test'
111 date: Mon Jan 12 13:46:40 1970 +0000
111 date: Mon Jan 12 13:46:40 1970 +0000
112 summary: 2
112 summary: 2
113
113
114 abort: crosses branches (use 'hg merge' or 'hg update -C' to discard changes)
114 abort: crosses branches (use 'hg merge' to merge or use 'hg update -C' to discard changes)
115 failed
115 failed
116 abort: outstanding uncommitted changes (use 'hg status' to list changes)
116 abort: outstanding uncommitted changes (use 'hg status' to list changes)
117 failed
117 failed
@@ -16,14 +16,14 b' o 0:b608b9236435'
16 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
16 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
17 parent=5
17 parent=5
18 % norevtest none clean same 2
18 % norevtest none clean same 2
19 abort: crosses branches (use 'hg merge' or 'hg update -C')
19 abort: crosses branches (use 'hg merge' or use 'hg update -c')
20 parent=2
20 parent=2
21 % revtest none clean linear 1 2
21 % revtest none clean linear 1 2
22 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
22 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
23 parent=2
23 parent=2
24 % revtest none clean same 2 3
24 % revtest none clean same 2 3
25 abort: crosses branches (use 'hg merge' or 'hg update -C')
25 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
26 parent=2
26 parent=3
27 % revtest none clean cross 3 4
27 % revtest none clean cross 3 4
28 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
28 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
29 parent=4
29 parent=4
@@ -32,11 +32,11 b' 1 files updated, 0 files merged, 0 files'
32 parent=2
32 parent=2
33 M foo
33 M foo
34 % revtest none dirty same 2 3
34 % revtest none dirty same 2 3
35 abort: crosses branches (use 'hg merge' or 'hg update -C' to discard changes)
35 abort: crosses branches (use 'hg merge' to merge or use 'hg update -C' to discard changes)
36 parent=2
36 parent=2
37 M foo
37 M foo
38 % revtest none dirty cross 3 4
38 % revtest none dirty cross 3 4
39 abort: crosses named branches (use 'hg update -C' to discard changes)
39 abort: crosses branches (use 'hg merge' to merge or use 'hg update -C' to discard changes)
40 parent=3
40 parent=3
41 M foo
41 M foo
42 % revtest -C dirty linear 1 2
42 % revtest -C dirty linear 1 2
General Comments 0
You need to be logged in to leave comments. Login now