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.
--- 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