comparison hgext/inhibit.py @ 1362:73e5b5280c1c

inhibit: improve performance of transaction wrapping Before this patch, transaction wrapping was the most expensive part of inhibit computation wise. This patch changes the revset that we use in the transaction wrapping to make it ~50x faster to compute: revset #0: obsolete() - hidden() 0) wall 0.000214 comb 0.000000 user 0.000000 sys 0.000000 (best of 11209) vs revset #0: (not hidden()) and obsolete() 0) wall 0.010965 comb 0.010000 user 0.010000 sys 0.000000 (best of 237)
author Laurent Charignon <lcharignon@fb.com>
date Sat, 13 Jun 2015 11:14:27 -0700
parents 9a1415f8b21b
children 9c3ba42c582a
comparison
equal deleted inserted replaced
1361:043e5ca9322f 1362:73e5b5280c1c
170 def transactioncallback(orig, repo, *args, **kwargs): 170 def transactioncallback(orig, repo, *args, **kwargs):
171 """ Wrap localrepo.transaction to inhibit new obsolete changes """ 171 """ Wrap localrepo.transaction to inhibit new obsolete changes """
172 def inhibitposttransaction(transaction): 172 def inhibitposttransaction(transaction):
173 # At the end of the transaction we catch all the new visible and 173 # At the end of the transaction we catch all the new visible and
174 # obsolete commit to inhibit them 174 # obsolete commit to inhibit them
175 visibleobsolete = repo.revs('(not hidden()) and obsolete()') 175 visibleobsolete = repo.revs('obsolete() - hidden()')
176 ignoreset = set(getattr(repo, '_rebaseset', [])) 176 ignoreset = set(getattr(repo, '_rebaseset', []))
177 visibleobsolete = list(r for r in visibleobsolete if r not in ignoreset) 177 visibleobsolete = list(r for r in visibleobsolete if r not in ignoreset)
178 if visibleobsolete: 178 if visibleobsolete:
179 _inhibitmarkers(repo, [repo[r].node() for r in visibleobsolete]) 179 _inhibitmarkers(repo, [repo[r].node() for r in visibleobsolete])
180 transaction = orig(repo, *args, **kwargs) 180 transaction = orig(repo, *args, **kwargs)