changeset 130:b70fadbccc2a

evolution: add a --new argument for kill
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Wed, 11 Jan 2012 17:01:06 +0100
parents 3ad25876ee68
children 3124889cad55
files hgext/evolution.py
diffstat 1 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/evolution.py	Tue Jan 10 19:52:44 2012 +0100
+++ b/hgext/evolution.py	Wed Jan 11 17:01:06 2012 +0100
@@ -222,9 +222,11 @@
 
 
 @command('^kill',
-    [],
+    [
+    ('n', 'new', [], _("New changeset that justify this one to be killed"))
+    ],
     '<revs>')
-def kill(ui, repo, *revs):
+def kill(ui, repo, *revs, **opts):
     """mark a changeset as obsolete
 
     This update the parent directory to a not-killed parent if the current
@@ -236,9 +238,16 @@
     """
     wlock = repo.wlock()
     try:
+        new = opts['new']
         targetnodes = set(noderange(repo, revs))
+        if not new:
+            new = [node.nullid]
         for n in targetnodes:
-            repo.addobsolete(node.nullid, n)
+            if not repo[n].mutable():
+                ui.warn(_("Can't kill immutable changeset %s") % repo[n])
+            else:
+                for ne in new:
+                    repo.addobsolete(ne, n)
         # update to an unkilled parent
         wdp = repo['.']
         newnode = wdp