Mercurial > hg
comparison mercurial/exchange.py @ 33790:f2befc1f4cf4
exchange: remove 'locallocked' member from pushop object
The variable has been used only within a single function since
94e2862dbcfb (push: elevate phase transaction to cover entire
operation, 2014-11-21), so there's no need to keep it on the pushop
object.
Differential Revision: https://phab.mercurial-scm.org/D389
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 28 Jul 2017 21:49:44 -0700 |
parents | 52c5ff856b49 |
children | 20d663a104fb |
comparison
equal
deleted
inserted
replaced
33789:19f495fef0a3 | 33790:f2befc1f4cf4 |
---|---|
306 self.revs = revs | 306 self.revs = revs |
307 # bookmark explicitly pushed | 307 # bookmark explicitly pushed |
308 self.bookmarks = bookmarks | 308 self.bookmarks = bookmarks |
309 # allow push of new branch | 309 # allow push of new branch |
310 self.newbranch = newbranch | 310 self.newbranch = newbranch |
311 # did a local lock get acquired? | |
312 self.locallocked = None | |
313 # step already performed | 311 # step already performed |
314 # (used to check what steps have been already performed through bundle2) | 312 # (used to check what steps have been already performed through bundle2) |
315 self.stepsdone = set() | 313 self.stepsdone = set() |
316 # Integer version of the changegroup push result | 314 # Integer version of the changegroup push result |
317 # - None means nothing to push | 315 # - None means nothing to push |
440 raise error.Abort(_('cannot push: destination does not support the ' | 438 raise error.Abort(_('cannot push: destination does not support the ' |
441 'unbundle wire protocol command')) | 439 'unbundle wire protocol command')) |
442 | 440 |
443 # get local lock as we might write phase data | 441 # get local lock as we might write phase data |
444 localwlock = locallock = None | 442 localwlock = locallock = None |
443 locallocked = False | |
445 try: | 444 try: |
446 # bundle2 push may receive a reply bundle touching bookmarks or other | 445 # bundle2 push may receive a reply bundle touching bookmarks or other |
447 # things requiring the wlock. Take it now to ensure proper ordering. | 446 # things requiring the wlock. Take it now to ensure proper ordering. |
448 maypushback = pushop.ui.configbool('experimental', 'bundle2.pushback') | 447 maypushback = pushop.ui.configbool('experimental', 'bundle2.pushback') |
449 if (not _forcebundle1(pushop)) and maypushback: | 448 if (not _forcebundle1(pushop)) and maypushback: |
450 localwlock = pushop.repo.wlock() | 449 localwlock = pushop.repo.wlock() |
451 locallock = pushop.repo.lock() | 450 locallock = pushop.repo.lock() |
452 pushop.locallocked = True | 451 locallocked = True |
453 except IOError as err: | 452 except IOError as err: |
454 pushop.locallocked = False | |
455 if err.errno != errno.EACCES: | 453 if err.errno != errno.EACCES: |
456 raise | 454 raise |
457 # source repo cannot be locked. | 455 # source repo cannot be locked. |
458 # We do not abort the push, but just disable the local phase | 456 # We do not abort the push, but just disable the local phase |
459 # synchronisation. | 457 # synchronisation. |
460 msg = 'cannot lock source repository: %s\n' % err | 458 msg = 'cannot lock source repository: %s\n' % err |
461 pushop.ui.debug(msg) | 459 pushop.ui.debug(msg) |
462 try: | 460 try: |
463 if pushop.locallocked: | 461 if locallocked: |
464 pushop.trmanager = transactionmanager(pushop.repo, | 462 pushop.trmanager = transactionmanager(pushop.repo, |
465 'push-response', | 463 'push-response', |
466 pushop.remote.url()) | 464 pushop.remote.url()) |
467 pushop.repo.checkpush(pushop) | 465 pushop.repo.checkpush(pushop) |
468 _pushdiscovery(pushop) | 466 _pushdiscovery(pushop) |