[PATCH 5 of 6] pull: allow a generic way to pass parameter to the pull operation

Pierre-Yves David pierre-yves.david at ens-lyon.org
Fri Jun 5 00:20:02 CDT 2015


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1433230991 25200
#      Tue Jun 02 00:43:11 2015 -0700
# Node ID 4f36fdb8dc6586c41a09f9509df3c1b5dbeaf343
# Parent  631215946aa71e9feae366e603d17e4d92dea048
pull: allow a generic way to pass parameter to the pull operation

We have been feeling the need for this in extension for quite some time. This
will be used to pass remote bookmarks information around in the next changesets.

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -5118,10 +5118,11 @@ def pull(ui, repo, source="default", **o
     try:
         revs, checkout = hg.addbranchrevs(repo, other, branches,
                                           opts.get('rev'))
 
 
+        pullopargs = {}
         if opts.get('bookmark'):
             if not revs:
                 revs = []
             # The list of bookmark used here is not the one used to actually
             # update the bookmark name. This can result in the revision pulled
@@ -5150,11 +5151,12 @@ def pull(ui, repo, source="default", **o
                         "so a rev cannot be specified.")
                 raise util.Abort(err)
 
         modheads = exchange.pull(repo, other, heads=revs,
                                  force=opts.get('force'),
-                                 bookmarks=opts.get('bookmark', ())).cgresult
+                                 bookmarks=opts.get('bookmark', ()),
+                                 opargs=pullopargs).cgresult
         if checkout:
             checkout = str(repo.changelog.rev(checkout))
         repo._subtoppath = source
         try:
             ret = postincoming(ui, repo, modheads, opts.get('update'), checkout)
diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -884,12 +884,15 @@ class transactionmanager(object):
     def release(self):
         """release transaction if created"""
         if self._tr is not None:
             self._tr.release()
 
-def pull(repo, remote, heads=None, force=False, bookmarks=()):
-    pullop = pulloperation(repo, remote, heads, force, bookmarks=bookmarks)
+def pull(repo, remote, heads=None, force=False, bookmarks=(), opargs=None):
+    if opargs is None:
+        opargs = {}
+    pullop = pulloperation(repo, remote, heads, force, bookmarks=bookmarks,
+                           **opargs)
     if pullop.remote.local():
         missing = set(pullop.remote.requirements) - pullop.repo.supported
         if missing:
             msg = _("required features are not"
                     " supported in the destination:"


More information about the Mercurial-devel mailing list