diff -r 8a06b32061ce -r e1347ce2f954 hgext/inhibit.py --- a/hgext/inhibit.py Thu Apr 02 18:33:44 2015 -0700 +++ b/hgext/inhibit.py Wed Apr 01 13:51:21 2015 -0700 @@ -47,6 +47,10 @@ obsinhibit.add(raw[i:i+20]) return obsinhibit + # Wrapping this to inhibit obsolete revs resulting from a transaction + extensions.wrapfunction(localrepo.localrepository, + 'transaction', transactioncallback) + repo.__class__ = obsinhibitedrepo repo._explicitaccess = set() @@ -136,6 +140,19 @@ finally: tr.release() + +def transactioncallback(orig, repo, *args, **kwargs): + """ Wrap localrepo.transaction to inhibit new obsolete changes """ + def inhibitposttransaction(transaction): + # At the end of the transaction we catch all the new visible and + # obsolete commit to inhibit them + visibleobsolete = repo.revs('(not hidden()) and obsolete()') + if visibleobsolete: + _inhibitmarkers(repo, [repo[r].node() for r in visibleobsolete]) + transaction = orig(repo, *args, **kwargs) + transaction.addpostclose('inhibitposttransaction', inhibitposttransaction) + return transaction + def extsetup(ui): # lets wrap the computation of the obsolete set # We apply inhibition there