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

login
register
mail settings
Submitter Pierre-Yves David
Date June 5, 2015, 5:20 a.m.
Message ID <4f36fdb8dc6586c41a09.1433481602@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/9514/
State Accepted
Headers show

Comments

Pierre-Yves David - June 5, 2015, 5:20 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@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.

Patch

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:"