comparison hgext/evolve.py @ 196:dea67dae27a4

amend: add a warning after amend added unstablility
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Wed, 28 Mar 2012 21:13:46 +0200
parents 3f18a6580d14
children 69a37d56c7fb
comparison
equal deleted inserted replaced
195:ccbadfae1d06 196:dea67dae27a4
372 wlock = repo.wlock() 372 wlock = repo.wlock()
373 try: 373 try:
374 if not old.phase(): 374 if not old.phase():
375 raise util.Abort(_("can not rewrite immutable changeset %s") % old) 375 raise util.Abort(_("can not rewrite immutable changeset %s") % old)
376 376
377 # store the amount of unstable prior update
378 if old.children():
379 priorunstables = len(repo.revs('unstable()'))
380 else:
381 #no children mean no change for unstable changeset
382 priorunstables = None
383
377 # commit current changes as update 384 # commit current changes as update
378 # code copied from commands.commit to avoid noisy messages 385 # code copied from commands.commit to avoid noisy messages
379 ciopts = dict(opts) 386 ciopts = dict(opts)
380 ciopts.pop('message', None) 387 ciopts.pop('message', None)
381 ciopts.pop('logfile', None) 388 ciopts.pop('logfile', None)
399 break 406 break
400 else: 407 else:
401 raise error.Abort(_('no updates found')) 408 raise error.Abort(_('no updates found'))
402 updates = [repo[n] for n in updatenodes] 409 updates = [repo[n] for n in updatenodes]
403 410
411
412
404 # perform amend 413 # perform amend
405 if opts.get('edit'): 414 if opts.get('edit'):
406 opts['force_editor'] = True 415 opts['force_editor'] = True
407 newid = rewrite(repo, old, updates, head, 416 newid = rewrite(repo, old, updates, head,
408 [old.p1().node(), old.p2().node()], opts) 417 [old.p1().node(), old.p2().node()], opts)
409 418
410 # reroute the working copy parent to the new changeset 419 # reroute the working copy parent to the new changeset
411 phases.retractboundary(repo, old.phase(), [newid]) 420 phases.retractboundary(repo, old.phase(), [newid])
412 repo.dirstate.setparents(newid, node.nullid) 421 repo.dirstate.setparents(newid, node.nullid)
422
423 if priorunstables is not None:
424 newunstables = len(repo.revs('unstable()')) - priorunstables
425 if newunstables > 0:
426 ui.warn(_('%i new unstables changesets\n') % newunstables)
413 finally: 427 finally:
414 wlock.release() 428 wlock.release()
415 finally: 429 finally:
416 lock.release() 430 lock.release()
417 431