Patchwork [05,of,16] push: extract bookmark exchange in its own method

login
register
mail settings
Submitter Pierre-Yves David
Date April 17, 2013, 3:58 p.m.
Message ID <e8228b2e83a7aa25d3a6.1366214320@crater1.logilab.fr>
Download mbox | patch
Permalink /patch/1390/
State Deferred, archived
Headers show

Comments

Pierre-Yves David - April 17, 2013, 3:58 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@logilab.fr>
# Date 1366205410 -7200
#      Wed Apr 17 15:30:10 2013 +0200
# Node ID e8228b2e83a7aa25d3a6be434e728a51d0613cef
# Parent  b5874256521657270bfee104401ee8a79196a3fb
push: extract bookmark exchange in its own method

Patch

diff --git a/mercurial/exchangeutil.py b/mercurial/exchangeutil.py
--- a/mercurial/exchangeutil.py
+++ b/mercurial/exchangeutil.py
@@ -204,11 +204,18 @@  class pushoperation(object):
             finally:
                 if lock is not None:
                     lock.release()
         finally:
             locallock.release()
+        self._pushbookmarks()
+        return ret
 
+    def _pushbookmarks(self):
+        """synchronise local bookmark position to remote"""
+        repo = self.repo
+        remote = self.remote
+        unfi = repo.unfiltered()
         repo.ui.debug("checking for updated bookmarks\n")
         rb = remote.listkeys('bookmarks')
         for k in rb.keys():
             if k in unfi._bookmarks:
                 nr, nl = rb[k], hex(repo._bookmarks[k])
@@ -221,11 +228,10 @@  class pushoperation(object):
                             repo.ui.status(_("updating bookmark %s\n") % k)
                         else:
                             repo.ui.warn(_('updating bookmark %s'
                                            ' failed!\n') % k)
 
-        return ret
 
 def pull(repo, remote, heads=None, force=False):
     # don't open transaction for nothing or you break future useful
     # rollback call
     tr = None