changeset 42:eb6a06d7eae3

Make rebase set-obsolete relation
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Thu, 08 Sep 2011 12:08:33 +0200
parents 99c131e97bb3
children 20fca307d9f0
files obsolete.py
diffstat 1 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/obsolete.py	Wed Sep 07 18:39:02 2011 +0200
+++ b/obsolete.py	Thu Sep 08 12:08:33 2011 +0200
@@ -10,6 +10,7 @@
 from mercurial import context
 from mercurial import revset
 from mercurial import scmutil
+from mercurial import extensions
 from mercurial.node import hex, bin
 
 # Patch changectx
@@ -45,6 +46,12 @@
 
 def extsetup(ui):
     revset.symbols["obsolete"] = revsetobsolete
+    try:
+        rebase = extensions.find('rebase')
+        if rebase:
+            extensions.wrapfunction(rebase, 'concludenode', concludenode)
+    except KeyError:
+        pass # rebase not found
 
 # New commands
 #############################
@@ -139,3 +146,13 @@
     repo.__class__ = obsoletingrepo
 
 
+### Other Extension compat
+############################
+
+def concludenode(orig, repo, rev, *args, **kwargs):
+    newrev = orig(repo, rev, *args, **kwargs)
+    oldnode = repo[rev].node()
+    newnode = repo[newrev].node()
+    repo.addobsolete(newnode, oldnode)
+    return newrev
+