inhibit: handle inhibit marker on stripped revision
authorPierre-Yves David <pierre-yves.david@fb.com>
Thu, 14 May 2015 15:59:06 -0700
changeset 1338 77cbf9121e8a
parent 1336 10d2ef1f7ed4
child 1339 0e2eb196923a
inhibit: handle inhibit marker on stripped revision If a revision disappear from the repo, we should not crash.
hgext/inhibit.py
tests/test-inhibit.t
--- a/hgext/inhibit.py	Wed May 13 09:03:11 2015 -0700
+++ b/hgext/inhibit.py	Thu May 14 15:59:06 2015 -0700
@@ -160,7 +160,8 @@
     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)))
+    return (n for n in repo._obsinhibit
+            if getrev(n) is not None and getphase(repo, getrev(n)))
 
 def _inhibitmarkers(repo, nodes):
     """add marker inhibitor for all obsolete revision under <nodes>
--- a/tests/test-inhibit.t	Wed May 13 09:03:11 2015 -0700
+++ b/tests/test-inhibit.t	Thu May 14 15:59:06 2015 -0700
@@ -548,6 +548,20 @@
   @  14:d66ccb8c5871 add cL foo
   |
 
+check that pruning and inhibited node does not confuse anything
+
+  $ hg up --hidden 210589181b14
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg strip --bundle 210589181b14
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  saved backup bundle to $TESTTMP/inhibit/.hg/strip-backup/210589181b14-e09c7b88-backup.hg (glob)
+  $ hg unbundle .hg/strip-backup/210589181b14-e09c7b88-backup.hg # restore state
+  adding changesets
+  adding manifests
+  adding file changes
+  added 2 changesets with 1 changes to 2 files (+1 heads)
+  (run 'hg heads' to see heads, 'hg merge' to merge)
+
 Only allow direct access and check that evolve works like before
   $ cat >> $HGRCPATH <<EOF
   > [inhibit]