headssummary: directly feed the function with the 'pushop' object
authorPierre-Yves David <pierre-yves.david@octobus.net>
Mon, 29 May 2017 10:56:00 +0200
changeset 32706 993f58db2045
parent 32705 70a020daf0b9
child 32707 32c8f98aebf4
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.
mercurial/discovery.py
--- a/mercurial/discovery.py	Mon May 29 05:45:59 2017 +0200
+++ b/mercurial/discovery.py	Mon May 29 10:56:00 2017 +0200
@@ -182,7 +182,7 @@
 
     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 @@
     - 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 @@
         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()