inhibit: wrap repo.commit to inhibit nodes
authorDurham Goode <durham@fb.com>
Mon, 06 Apr 2015 15:44:00 -0700
changeset 1292 62229e7451f7
parent 1291 1e3c607cf4a5
child 1293 dc5528e04c06
inhibit: wrap repo.commit to inhibit nodes Rebase was failing if you rebased a commit, stripped it, then rebased it again. This is because the node was still hidden and we needed repo.commit to uninhibit it.
hgext/inhibit.py
tests/test-inhibit.t
--- a/hgext/inhibit.py	Wed Apr 29 11:42:06 2015 -0700
+++ b/hgext/inhibit.py	Mon Apr 06 15:44:00 2015 -0700
@@ -48,6 +48,11 @@
                 obsinhibit.add(raw[i:i+20])
             return obsinhibit
 
+        def commit(self, *args, **kwargs):
+            newnode = super(obsinhibitedrepo, self).commit(*args, **kwargs)
+            _inhibitmarkers(repo, [newnode])
+            return newnode
+
     # Wrapping this to inhibit obsolete revs resulting from a transaction
     extensions.wrapfunction(localrepo.localrepository,
                             'transaction', transactioncallback)
--- a/tests/test-inhibit.t	Wed Apr 29 11:42:06 2015 -0700
+++ b/tests/test-inhibit.t	Mon Apr 06 15:44:00 2015 -0700
@@ -495,4 +495,35 @@
   |
   o  0:54ccbc537fc2 add cA
   
+Check that rebasing a commit twice makes the commit visible again
 
+  $ hg rebase -d 18 -r 16 --keep
+  rebasing 16:a438c045eb37 "add cN"
+  $ hg log -r 14:: -G
+  o  19:104eed5354c7 add cN
+  |
+  @  18:210589181b14 add cM
+  |
+  | o  16:a438c045eb37 add cN
+  | |
+  | o  15:2d66e189f5b5 add cM
+  |/
+  o  14:d66ccb8c5871 add cL
+  |
+  $ hg prune -r 104eed5354c7
+  1 changesets pruned
+  $ hg rebase -d 18 -r 16 --keep
+  rebasing 16:a438c045eb37 "add cN"
+  $ hg log -r 14:: -G
+  o  19:104eed5354c7 add cN
+  |
+  @  18:210589181b14 add cM
+  |
+  | o  16:a438c045eb37 add cN
+  | |
+  | o  15:2d66e189f5b5 add cM
+  |/
+  o  14:d66ccb8c5871 add cL
+  |
+  $ hg prune -r 104eed5354c7
+  1 changesets pruned