Patchwork D391: exchange: remove need for "locked" variable

login
register
mail settings
Submitter phabricator
Date Aug. 15, 2017, 6:14 a.m.
Message ID <0e784721c94d3ac7c0e0350e28fae8d9@localhost.localdomain>
Download mbox | patch
Permalink /patch/23010/
State Not Applicable
Headers show

Comments

phabricator - Aug. 15, 2017, 6:14 a.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG5904511fc9f8: exchange: remove need for "locked" variable (authored by martinvonz).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D391?vs=889&id=917

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

AFFECTED FILES
  mercurial/exchange.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -440,28 +440,26 @@ 
 
     # get lock as we might write phase data
     wlock = lock = None
-    locked = 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:
             wlock = pushop.repo.wlock()
         lock = pushop.repo.lock()
-        locked = True
+        pushop.trmanager = transactionmanager(pushop.repo,
+                                              'push-response',
+                                              pushop.remote.url())
     except IOError as err:
         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 locked:
-            pushop.trmanager = transactionmanager(pushop.repo,
-                                                  'push-response',
-                                                  pushop.remote.url())
         pushop.repo.checkpush(pushop)
         _pushdiscovery(pushop)
         if not _forcebundle1(pushop):