--- a/hgext/evolution.py Thu Dec 22 15:26:42 2011 +0100
+++ b/hgext/evolution.py Wed Dec 28 12:38:01 2011 +0100
@@ -18,6 +18,7 @@
from mercurial import bookmarks
from mercurial import phases
from mercurial import context
+from mercurial import commands
from mercurial import util
from mercurial.i18n import _
from mercurial.commands import walkopts, commitopts, commitopts2, logopts
@@ -300,3 +301,19 @@
finally:
wlock.release()
+
+def commitwrapper(orig, ui, repo, *arg, **kwargs):
+ obsoleted = kwargs.get('obsolete', [])
+ if obsoleted:
+ obsoleted = repo.set('%lr', obsoleted)
+ result = orig(ui, repo, *arg, **kwargs)
+ if not result: # commit successed
+ new = repo['-1']
+ for old in obsoleted:
+ repo.addobsolete(new.node(), old.node())
+ return result
+
+def extsetup(ui):
+ entry = extensions.wrapcommand(commands.table, 'commit', commitwrapper)
+ entry[1].append(('o', 'obsolete', [], _("this commit obsolet this revision")))
+