mercurial/exchange.py
changeset 33792 5904511fc9f8
parent 33791 20d663a104fb
child 33793 bbbbd3c30bfc
equal deleted inserted replaced
33791:20d663a104fb 33792:5904511fc9f8
   438         raise error.Abort(_('cannot push: destination does not support the '
   438         raise error.Abort(_('cannot push: destination does not support the '
   439                             'unbundle wire protocol command'))
   439                             'unbundle wire protocol command'))
   440 
   440 
   441     # get lock as we might write phase data
   441     # get lock as we might write phase data
   442     wlock = lock = None
   442     wlock = lock = None
   443     locked = False
       
   444     try:
   443     try:
   445         # bundle2 push may receive a reply bundle touching bookmarks or other
   444         # bundle2 push may receive a reply bundle touching bookmarks or other
   446         # things requiring the wlock. Take it now to ensure proper ordering.
   445         # things requiring the wlock. Take it now to ensure proper ordering.
   447         maypushback = pushop.ui.configbool('experimental', 'bundle2.pushback')
   446         maypushback = pushop.ui.configbool('experimental', 'bundle2.pushback')
   448         if (not _forcebundle1(pushop)) and maypushback:
   447         if (not _forcebundle1(pushop)) and maypushback:
   449             wlock = pushop.repo.wlock()
   448             wlock = pushop.repo.wlock()
   450         lock = pushop.repo.lock()
   449         lock = pushop.repo.lock()
   451         locked = True
   450         pushop.trmanager = transactionmanager(pushop.repo,
       
   451                                               'push-response',
       
   452                                               pushop.remote.url())
   452     except IOError as err:
   453     except IOError as err:
   453         if err.errno != errno.EACCES:
   454         if err.errno != errno.EACCES:
   454             raise
   455             raise
   455         # source repo cannot be locked.
   456         # source repo cannot be locked.
   456         # We do not abort the push, but just disable the local phase
   457         # We do not abort the push, but just disable the local phase
   457         # synchronisation.
   458         # synchronisation.
   458         msg = 'cannot lock source repository: %s\n' % err
   459         msg = 'cannot lock source repository: %s\n' % err
   459         pushop.ui.debug(msg)
   460         pushop.ui.debug(msg)
       
   461 
   460     try:
   462     try:
   461         if locked:
       
   462             pushop.trmanager = transactionmanager(pushop.repo,
       
   463                                                   'push-response',
       
   464                                                   pushop.remote.url())
       
   465         pushop.repo.checkpush(pushop)
   463         pushop.repo.checkpush(pushop)
   466         _pushdiscovery(pushop)
   464         _pushdiscovery(pushop)
   467         if not _forcebundle1(pushop):
   465         if not _forcebundle1(pushop):
   468             _pushbundle2(pushop)
   466             _pushbundle2(pushop)
   469         _pushchangeset(pushop)
   467         _pushchangeset(pushop)