hgext/inhibit.py
changeset 1225 577f5340be6f
parent 1224 859a854cedc3
child 1232 37c00aeb4762
--- a/hgext/inhibit.py	Fri Mar 06 21:25:44 2015 -0800
+++ b/hgext/inhibit.py	Sat Mar 07 02:32:43 2015 -0800
@@ -51,6 +51,14 @@
     tr.addfilegenerator('obsinhibit', ('obsinhibit',), writer)
     tr.hookargs['obs_inbihited'] = '1'
 
+def _filterpublic(repo, nodes):
+    """filter out inhibitor on public changeset
+
+    Public changesets are already immune to obsolescence"""
+    getrev = repo.changelog.nodemap.get
+    getphase = repo._phasecache.phase
+    return (n for n in repo._obsinhibit if getphase(repo, getrev(n)))
+
 def _inhibitmarkers(repo, nodes):
     """add marker inhibitor for all obsolete revision under <nodes>
 
@@ -62,7 +70,7 @@
         tr = repo.transaction('obsinhibit')
         try:
             repo._obsinhibit.update(c.node() for c in newinhibit)
-            _schedulewrite(tr, repo._obsinhibit)
+            _schedulewrite(tr, _filterpublic(repo, repo._obsinhibit))
             repo.invalidatevolatilesets()
             tr.close()
         finally:
@@ -79,7 +87,7 @@
         tr = repo.transaction('obsinhibit')
         try:
             repo._obsinhibit -= deinhibited
-            _schedulewrite(tr, repo._obsinhibit)
+            _schedulewrite(tr, _filterpublic(repo, repo._obsinhibit))
             repo.invalidatevolatilesets()
             tr.close()
         finally: