diff 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
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: