hgext/inhibit.py
changeset 1488 3dec62fc266e
parent 1474 8e6de39b724d
parent 1486 e8ebb2441e60
child 1491 8f469f81129c
equal deleted inserted replaced
1485:1ba64be11bf8 1488:3dec62fc266e
   164         _deinhibitmarkers(repo, precs)
   164         _deinhibitmarkers(repo, precs)
   165         tr.close()
   165         tr.close()
   166     finally:
   166     finally:
   167         lockmod.release(tr, lock)
   167         lockmod.release(tr, lock)
   168 
   168 
   169 def transactioncallback(orig, repo, *args, **kwargs):
   169 def transactioncallback(orig, repo, desc, *args, **kwargs):
   170     """ Wrap localrepo.transaction to inhibit new obsolete changes """
   170     """ Wrap localrepo.transaction to inhibit new obsolete changes """
   171     def inhibitposttransaction(transaction):
   171     def inhibitposttransaction(transaction):
   172         # At the end of the transaction we catch all the new visible and
   172         # At the end of the transaction we catch all the new visible and
   173         # obsolete commit to inhibit them
   173         # obsolete commit to inhibit them
   174         visibleobsolete = repo.revs('obsolete() - hidden()')
   174         visibleobsolete = repo.revs('obsolete() - hidden()')
   175         ignoreset = set(getattr(repo, '_rebaseset', []))
   175         ignoreset = set(getattr(repo, '_rebaseset', []))
   176         visibleobsolete = list(r for r in visibleobsolete if r not in ignoreset)
   176         visibleobsolete = list(r for r in visibleobsolete if r not in ignoreset)
   177         if visibleobsolete:
   177         if visibleobsolete:
   178             _inhibitmarkers(repo, [repo[r].node() for r in visibleobsolete])
   178             _inhibitmarkers(repo, [repo[r].node() for r in visibleobsolete])
   179     transaction = orig(repo, *args, **kwargs)
   179     transaction = orig(repo, desc, *args, **kwargs)
   180     transaction.addpostclose('inhibitposttransaction', inhibitposttransaction)
   180     if desc != 'strip':
       
   181         transaction.addpostclose('inhibitposttransaction', inhibitposttransaction)
   181     return transaction
   182     return transaction
   182 
   183 
   183 def extsetup(ui):
   184 def extsetup(ui):
   184     # lets wrap the computation of the obsolete set
   185     # lets wrap the computation of the obsolete set
   185     # We apply inhibition there
   186     # We apply inhibition there