1. Pierre-Yves David
  2. mutable-history

Commits

Pierre-Yves David  committed eb6a06d

Make rebase set-obsolete relation

  • Participants
  • Parent commits 99c131e
  • Branches default

Comments (0)

Files changed (1)

File obsolete.py

View file
  • Ignore whitespace
 from mercurial import context
 from mercurial import revset
 from mercurial import scmutil
+from mercurial import extensions
 from mercurial.node import hex, bin
 
 # Patch changectx
 
 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
 #############################
     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
+