Mercurial > evolve
changeset 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 | ccbadfae1d06 |
children | c2d692c8f599 |
files | hgext/evolve.py tests/test-evolve.t |
diffstat | 2 files changed, 80 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/evolve.py Thu Mar 29 17:18:43 2012 +0200 +++ b/hgext/evolve.py Wed Mar 28 21:13:46 2012 +0200 @@ -374,6 +374,13 @@ if not old.phase(): raise util.Abort(_("can not rewrite immutable changeset %s") % old) + # store the amount of unstable prior update + if old.children(): + priorunstables = len(repo.revs('unstable()')) + else: + #no children mean no change for unstable changeset + priorunstables = None + # commit current changes as update # code copied from commands.commit to avoid noisy messages ciopts = dict(opts) @@ -401,6 +408,8 @@ raise error.Abort(_('no updates found')) updates = [repo[n] for n in updatenodes] + + # perform amend if opts.get('edit'): opts['force_editor'] = True @@ -410,6 +419,11 @@ # reroute the working copy parent to the new changeset phases.retractboundary(repo, old.phase(), [newid]) repo.dirstate.setparents(newid, node.nullid) + + if priorunstables is not None: + newunstables = len(repo.revs('unstable()')) - priorunstables + if newunstables > 0: + ui.warn(_('%i new unstables changesets\n') % newunstables) finally: wlock.release() finally:
--- a/tests/test-evolve.t Thu Mar 29 17:18:43 2012 +0200 +++ b/tests/test-evolve.t Wed Mar 28 21:13:46 2012 +0200 @@ -203,6 +203,7 @@ $ sed -i'' -e s/Eins/Un/ main-file-1 $ hg amend --note 'french looks better' + 1 new unstables changesets $ hg log 6 feature-A: a nifty feature - test 4 feature-B: another feature - test @@ -246,3 +247,68 @@ 8 feature-B: another feature that rox - test 6 feature-A: a nifty feature - test 0 : base - test + $ cd .. + +enable general delta + + $ cat << EOF >> $HGRCPATH + > [format] + > generaldelta=1 + > EOF + + + + $ hg init alpha + $ cd alpha + $ echo 'base' > firstfile + $ hg add firstfile + $ hg ci -m 'base' + + $ cd .. + $ hg clone -Ur 0 alpha beta + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + $ cd alpha + + $ cat << EOF > A + > We + > need + > some + > kind + > of + > file + > big + > enough + > to + > prevent + > snapshot + > . + > yes + > new + > lines + > are + > useless + > . + > EOF + $ hg add A + $ hg commit -m 'adding A' + $ hg mv A B + $ echo '.' >> B + $ hg amend -m 'add B' + $ cd .. + +Clone just this branch + + $ cd beta + $ hg pull -r tip ../alpha + pulling from ../alpha + searching for changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + (run 'hg update' to get a working copy) + $ hg up + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved