##// END OF EJS Templates
phase: when phase cannot be reduced, hint at --force and return 1 (BC)...
Patrick Mezard -
r16097:8dc573a9 default
parent child Browse files
Show More
@@ -4210,7 +4210,8 b' def phase(ui, repo, *revs, **opts):'
4210
4210
4211 public < draft < secret
4211 public < draft < secret
4212
4212
4213 Return 0 on success, 1 if no phases were changed.
4213 Return 0 on success, 1 if no phases were changed or some could not
4214 be changed.
4214 """
4215 """
4215 # search for a unique phase argument
4216 # search for a unique phase argument
4216 targetphase = None
4217 targetphase = None
@@ -4252,8 +4253,18 b' def phase(ui, repo, *revs, **opts):'
4252 changes = 0
4253 changes = 0
4253 newdata = repo._phaserev
4254 newdata = repo._phaserev
4254 changes = sum(o != newdata[i] for i, o in enumerate(olddata))
4255 changes = sum(o != newdata[i] for i, o in enumerate(olddata))
4256 rejected = [n for n in nodes
4257 if newdata[repo[n].rev()] < targetphase]
4258 if rejected:
4259 ui.warn(_('cannot move %i changesets to a more permissive '
4260 'phase, use --force\n') % len(rejected))
4261 ret = 1
4255 if changes:
4262 if changes:
4256 ui.note(_('phase change for %i changesets\n') % changes)
4263 msg = _('phase changed for %i changesets\n') % changes
4264 if ret:
4265 ui.status(msg)
4266 else:
4267 ui.note(msg)
4257 else:
4268 else:
4258 ui.warn(_('no phases changed\n'))
4269 ui.warn(_('no phases changed\n'))
4259 ret = 1
4270 ret = 1
@@ -402,3 +402,34 b' move changeset forward and backward'
402 |
402 |
403 o 0 public A
403 o 0 public A
404
404
405 test partial failure
406
407 $ hg phase --public 7
408 $ hg phase --draft '5 or 7'
409 cannot move 1 changesets to a more permissive phase, use --force
410 phase changed for 1 changesets
411 [1]
412 $ hg log -G --template "{rev} {phase} {desc}\n"
413 @ 7 public merge B' and E
414 |\
415 | o 6 public B'
416 | |
417 +---o 5 draft H
418 | |
419 o | 4 public E
420 | |
421 o | 3 public D
422 | |
423 o | 2 public C
424 |/
425 o 1 public B
426 |
427 o 0 public A
428
429
430 test complete failure
431
432 $ hg phase --draft 7
433 cannot move 1 changesets to a more permissive phase, use --force
434 no phases changed
435 [1]
General Comments 0
You need to be logged in to leave comments. Login now