changeset 22625:62ab9ca90b36

push: perform bookmark export in the push function This part is responsible for adding new bookmarks on the remote. Before that, it was done on its own in `commands.push`. The export is still not integrated with the rest of the push process, but at least it now dwells in the right function.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Thu, 25 Sep 2014 02:53:29 -0700
parents eef31f9a4c0f
children fb74a5833467
files mercurial/commands.py mercurial/exchange.py
diffstat 2 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Thu Sep 25 00:57:36 2014 -0700
+++ b/mercurial/commands.py	Thu Sep 25 02:53:29 2014 -0700
@@ -5074,11 +5074,10 @@
 
     result = not pushop.cgresult
 
-    if opts.get('bookmark'):
-        bresult = bookmarks.pushtoremote(ui, repo, other, opts['bookmark'])
-        if bresult == 2:
+    if pushop.bkresult is not None:
+        if pushop.bkresult == 2:
             result = 2
-        elif not result and bresult:
+        elif not result and pushop.bkresult:
             result = 2
 
     return result
--- a/mercurial/exchange.py	Thu Sep 25 00:57:36 2014 -0700
+++ b/mercurial/exchange.py	Thu Sep 25 02:53:29 2014 -0700
@@ -216,6 +216,10 @@
         if locallock is not None:
             locallock.release()
 
+    if pushop.bookmarks:
+        pushop.bkresult = bookmod.pushtoremote(repo.ui, repo, remote,
+                                               pushop.bookmarks)
+
     return pushop
 
 # list of steps to perform discovery before push