Patchwork D389: exchange: remove 'locallocked' member from pushop object

login
register
mail settings
Submitter phabricator
Date Aug. 14, 2017, 11:46 p.m.
Message ID <differential-rev-PHID-DREV-bwqit2yyedebri6jil7i-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/22984/
State Superseded
Headers show

Comments

phabricator - Aug. 14, 2017, 11:46 p.m.
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The variable has been used only within a single function since
  https://phab.mercurial-scm.org/rHG94e2862dbcfb0f26ade829dc6df7d7d60e14aa10 (push: elevate phase transaction to cover entire
  operation, 2014-11-21), so there's no need to keep it on the pushop
  object.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D389

AFFECTED FILES
  mercurial/exchange.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -308,8 +308,6 @@ 
         self.bookmarks = bookmarks
         # allow push of new branch
         self.newbranch = newbranch
-        # did a local lock get acquired?
-        self.locallocked = None
         # step already performed
         # (used to check what steps have been already performed through bundle2)
         self.stepsdone = set()
@@ -442,25 +440,25 @@ 
 
     # get local lock as we might write phase data
     localwlock = locallock = None
+    locallocked = False
     try:
         # bundle2 push may receive a reply bundle touching bookmarks or other
         # things requiring the wlock. Take it now to ensure proper ordering.
         maypushback = pushop.ui.configbool('experimental', 'bundle2.pushback')
         if (not _forcebundle1(pushop)) and maypushback:
             localwlock = pushop.repo.wlock()
         locallock = pushop.repo.lock()
-        pushop.locallocked = True
+        locallocked = True
     except IOError as err:
-        pushop.locallocked = False
         if err.errno != errno.EACCES:
             raise
         # source repo cannot be locked.
         # We do not abort the push, but just disable the local phase
         # synchronisation.
         msg = 'cannot lock source repository: %s\n' % err
         pushop.ui.debug(msg)
     try:
-        if pushop.locallocked:
+        if locallocked:
             pushop.trmanager = transactionmanager(pushop.repo,
                                                   'push-response',
                                                   pushop.remote.url())