Mercurial > evolve
comparison hgext/inhibit.py @ 1472:a8a4c8b8550d stable
inhibit: add missing locking in wrapper for obsmarker creation
The develwarning for transaction without lock rightfully pointed out to this
issue. Before this patch we were not locking in the transaction for obsmarker
creation and therefore showing the warnings.
author | Laurent Charignon <lcharignon@fb.com> |
---|---|
date | Thu, 09 Jul 2015 12:42:07 -0700 |
parents | 777e5c369d99 |
children | 8e6de39b724d e8ebb2441e60 |
comparison
equal
deleted
inserted
replaced
1469:fa1a27009c76 | 1472:a8a4c8b8550d |
---|---|
153 tr.release() | 153 tr.release() |
154 | 154 |
155 def _createmarkers(orig, repo, relations, flag=0, date=None, metadata=None): | 155 def _createmarkers(orig, repo, relations, flag=0, date=None, metadata=None): |
156 """wrap markers create to make sure we de-inhibit target nodes""" | 156 """wrap markers create to make sure we de-inhibit target nodes""" |
157 # wrapping transactio to unify the one in each function | 157 # wrapping transactio to unify the one in each function |
158 tr = repo.transaction('add-obsolescence-marker') | 158 lock = tr = None |
159 try: | 159 try: |
160 lock = repo.lock() | |
161 tr = repo.transaction('add-obsolescence-marker') | |
160 orig(repo, relations, flag, date, metadata) | 162 orig(repo, relations, flag, date, metadata) |
161 precs = (r[0].node() for r in relations) | 163 precs = (r[0].node() for r in relations) |
162 _deinhibitmarkers(repo, precs) | 164 _deinhibitmarkers(repo, precs) |
163 tr.close() | 165 tr.close() |
164 finally: | 166 finally: |
165 tr.release() | 167 lockmod.release(tr, lock) |
166 | 168 |
167 def transactioncallback(orig, repo, *args, **kwargs): | 169 def transactioncallback(orig, repo, *args, **kwargs): |
168 """ Wrap localrepo.transaction to inhibit new obsolete changes """ | 170 """ Wrap localrepo.transaction to inhibit new obsolete changes """ |
169 def inhibitposttransaction(transaction): | 171 def inhibitposttransaction(transaction): |
170 # 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 |