hgext/inhibit.py
changeset 1542 333e056b3034
parent 1541 23a34dce5131
child 1551 40e496bc7b54
--- a/hgext/inhibit.py	Tue Nov 24 17:16:27 2015 -0800
+++ b/hgext/inhibit.py	Mon Nov 30 16:48:40 2015 -0800
@@ -181,6 +181,16 @@
     finally:
         lockmod.release(tr, lock)
 
+def _computeobsoletenotrebasedwrap(orig, repo, rebasesetrevs, dest):
+    repo._notinhibited = rebasesetrevs
+    try:
+       repo.invalidatevolatilesets()
+       r = orig(repo, rebasesetrevs, dest)
+    finally:
+       del repo._notinhibited
+       repo.invalidatevolatilesets()
+    return r
+
 def transactioncallback(orig, repo, desc, *args, **kwargs):
     """ Wrap localrepo.transaction to inhibit new obsolete changes """
     def inhibitposttransaction(transaction):
@@ -207,8 +217,10 @@
         obs = obsfunc(repo)
         if _inhibitenabled(repo):
             getrev = repo.changelog.nodemap.get
+            blacklist = getattr(repo, '_notinhibited', set())
             for n in repo._obsinhibit:
-                obs.discard(getrev(n))
+                if getrev(n) not in blacklist:
+                    obs.discard(getrev(n))
         return obs
     try:
         extensions.find('directaccess')
@@ -233,6 +245,14 @@
     # wrap update to make sure that no obsolete commit is visible after an
     # update
     extensions.wrapcommand(commands.table, 'update', _update)
+    try:
+        rebase = extensions.find('rebase')
+        if rebase:
+            extensions.wrapfunction(rebase,
+                                    '_computeobsoletenotrebased',
+                                    _computeobsoletenotrebasedwrap)
+    except KeyError:
+        pass
     # Add bookmark -D option
     entry = extensions.wrapcommand(commands.table, 'bookmark', _bookmark)
     entry[1].append(('D','prune',None,