[PATCH 1 of 2] exchange: pass pushop to discovery.checkheads
Ryan McElroy
rm at fb.com
Tue Nov 10 19:20:59 UTC 2015
# HG changeset patch
# User Ryan McElroy <rmcelroy at fb.com>
# Date 1447182801 28800
# Tue Nov 10 11:13:21 2015 -0800
# Node ID a44afd1adea7ef653244e1a290c84c1bb3ccdb0b
# Parent 78998efe2eb11258ea7c5d78bb560d410ad2754b
exchange: pass pushop to discovery.checkheads
Previously, we passed a bunch of parameters to discovery.checkheads, but all
of the arguments can be fetched out of pushop, which may contain a lot more
useful information for extensions now that pushop is extensible.
diff --git a/mercurial/discovery.py b/mercurial/discovery.py
--- a/mercurial/discovery.py
+++ b/mercurial/discovery.py
@@ -255,12 +255,22 @@ def _nowarnheads(repo, remote, newbookma
return bookmarkedheads
-def checkheads(repo, remote, outgoing, remoteheads, newbranch=False, inc=False,
- newbookmarks=[]):
+def checkheads(pushop):
"""Check that a push won't add any outgoing head
raise Abort error and display ui message as needed.
"""
+
+ repo = pushop.repo.unfiltered()
+ remote = pushop.remote
+ outgoing = pushop.outgoing
+ remoteheads = pushop.remoteheads
+ newbranch = pushop.newbranch
+ inc = bool(pushop.incoming)
+
+ # internal config: bookmarks.pushing
+ newbookmarks = pushop.ui.configlist('bookmarks', 'pushing')
+
# Check for each named branch if we're creating new remote heads.
# To be a remote head after push, node must be either:
# - unknown locally
diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -571,13 +571,7 @@ def _pushcheckoutgoing(pushop):
elif ctx.troubled():
raise error.Abort(mst[ctx.troubles()[0]] % ctx)
- # internal config: bookmarks.pushing
- newbm = pushop.ui.configlist('bookmarks', 'pushing')
- discovery.checkheads(unfi, pushop.remote, outgoing,
- pushop.remoteheads,
- pushop.newbranch,
- bool(pushop.incoming),
- newbm)
+ discovery.checkheads(pushop)
return True
# List of names of steps to perform for an outgoing bundle2, order matters.
More information about the Mercurial-devel
mailing list