[PATCH 2 of 6] headssummary: directly feed the function with the 'pushop' object
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Sun Jun 4 10:49:30 EDT 2017
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at octobus.net>
# Date 1496048160 -7200
# Mon May 29 10:56:00 2017 +0200
# Node ID 60a6a3a24864486abf07736d7c591e73a6e7e012
# Parent df3d013cc55eeeab9296daf313d73bcafae4883c
# EXP-Topic pushrace
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
# hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r 60a6a3a24864
headssummary: directly feed the function with the 'pushop' object
Our goal is to be able to perform the post processing directly into the
'_headssummary' function. However before this patch the '_headsummary' function
only had access to repo, remote, outgoing while the '_postprocessobsolete'
function takes a 'pushop' object. Experience shows that having the 'pushop'
object helps extensions so we update '_headssummary' to take a pushop
object as argument.
diff --git a/mercurial/discovery.py b/mercurial/discovery.py
--- a/mercurial/discovery.py
+++ b/mercurial/discovery.py
@@ -182,7 +182,7 @@ def findcommonoutgoing(repo, other, only
return og
-def _headssummary(repo, remote, outgoing):
+def _headssummary(pushop):
"""compute a summary of branch and heads status before and after push
return {'branch': ([remoteheads], [newheads], [unsyncedheads])} mapping
@@ -193,6 +193,9 @@ def _headssummary(repo, remote, outgoing
- newheads: the new remote heads (known locally) with outgoing pushed
- unsyncedheads: the list of remote heads unknown locally.
"""
+ repo = pushop.repo.unfiltered()
+ remote = pushop.remote
+ outgoing = pushop.outgoing
cl = repo.changelog
headssum = {}
# A. Create set of branches involved in the push.
@@ -311,7 +314,7 @@ def checkheads(pushop):
return
if remote.capable('branchmap'):
- headssum = _headssummary(repo, remote, outgoing)
+ headssum = _headssummary(pushop)
else:
headssum = _oldheadssummary(repo, remoteheads, outgoing, inc)
newbranches = [branch for branch, heads in headssum.iteritems()
More information about the Mercurial-devel
mailing list