# HG changeset patch # User Pierre-Yves David # Date 1340702991 -7200 # Node ID de21685d22d1a0fa2237fab15f183e9ee298a5fa # Parent 23ef1c71d1648404ca2f2dca48c3646cf0337fa9 evolve: warn when latecomer changeset are created diff -r 23ef1c71d164 -r de21685d22d1 hgext/evolve.py --- a/hgext/evolve.py Mon Jun 25 15:18:47 2012 +0200 +++ b/hgext/evolve.py Tue Jun 26 11:29:51 2012 +0200 @@ -33,19 +33,23 @@ return map(repo.changelog.node, scmutil.revrange(repo, revsets)) -def warnunstable(orig, ui, repo, *args, **kwargs): +def warnobserrors(orig, ui, repo, *args, **kwargs): """display warning is the command resulted in more instable changeset""" priorunstables = len(repo.revs('unstable()')) + priorlatecomers = len(repo.revs('latecomer()')) #print orig, priorunstables #print len(repo.revs('secret() - obsolete()')) try: return orig(ui, repo, *args, **kwargs) finally: newunstables = len(repo.revs('unstable()')) - priorunstables + newlatecomers = len(repo.revs('latecomer()')) - priorlatecomers #print orig, newunstables #print len(repo.revs('secret() - obsolete()')) if newunstables > 0: ui.warn(_('%i new unstables changesets\n') % newunstables) + if newlatecomers > 0: + ui.warn(_('%i new latecomers changesets\n') % newlatecomers) ### changeset rewriting logic ############################# @@ -530,10 +534,10 @@ _("make graft obsoletes its source"))) # warning about more obsolete - for cmd in ['commit', 'push', 'pull', 'graft']: - entry = extensions.wrapcommand(commands.table, cmd, warnunstable) + for cmd in ['commit', 'push', 'pull', 'graft', 'phase', 'unbundle']: + entry = extensions.wrapcommand(commands.table, cmd, warnobserrors) for cmd in ['kill', 'amend']: - entry = extensions.wrapcommand(cmdtable, cmd, warnunstable) + entry = extensions.wrapcommand(cmdtable, cmd, warnobserrors) if rebase is not None: - entry = extensions.wrapcommand(rebase.cmdtable, 'rebase', warnunstable) + entry = extensions.wrapcommand(rebase.cmdtable, 'rebase', warnobserrors) diff -r 23ef1c71d164 -r de21685d22d1 tests/test-evolve.t --- a/tests/test-evolve.t Mon Jun 25 15:18:47 2012 +0200 +++ b/tests/test-evolve.t Tue Jun 26 11:29:51 2012 +0200 @@ -257,6 +257,12 @@ 8 feature-B: another feature that rox - test 6 feature-A: a nifty feature - test 0 : base - test + +phase change turning obsolete changeset public issue a latecomer warning + + $ hg phase --public 7 + 1 new latecomers changesets + $ cd .. enable general delta