Patchwork [3,of,6] push: use `exchange.push` in `commands.push`

login
register
mail settings
Submitter Pierre-Yves David
Date Sept. 25, 2014, 6:46 p.m.
Message ID <df847d3fe4044027e189.1411670804@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/5982/
State Accepted
Commit 1625770c2ce1923e5ed49148488da499258f77a7
Headers show

Comments

Pierre-Yves David - Sept. 25, 2014, 6:46 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1411634379 25200
#      Thu Sep 25 01:39:39 2014 -0700
# Node ID df847d3fe4044027e189a290aab75643d99cff0d
# Parent  e91c1379d9de4abb6d4b44eda75386f857c77ca6
push: use `exchange.push` in `commands.push`

To gain access all results from the push, we need to have access to the
`pushoperation` object. We call `exchange.push` to do so.

It is impossible to just change the `localrepo.push` signature because the
chance may be too subtle to be caugh by external extension wrapping
`localrepo.push`.

This mean we'll have to kill `localrepo.push` because just using
`exchange.push` in `commands.py`, would silently disable all wrapping around
`localrepo.push` by third party extension. So we'll remove it in later
changeset to get such extension to fail noisily.

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4972,14 +4972,14 @@  def push(ui, repo, dest=None, **opts):
             result = c.sub(s).push(opts)
             if result == 0:
                 return not result
     finally:
         del repo._subtoppath
-    result = repo.push(other, opts.get('force'), revs=revs,
-                       newbranch=opts.get('new_branch'))
-
-    result = not result
+    pushop = exchange.push(repo, other, opts.get('force'), revs=revs,
+                           newbranch=opts.get('new_branch'))
+
+    result = not pushop.cgresult
 
     if opts.get('bookmark'):
         bresult = bookmarks.pushtoremote(ui, repo, other, opts['bookmark'])
         if bresult == 2:
             return 2