diff --git a/mercurial/exchange.py b/mercurial/exchange.py
index b97a453b8c27b8e50a661c40402795783b3f1a6b_bWVyY3VyaWFsL2V4Y2hhbmdlLnB5..1516daaca632b9ba16511c011fd01f3c4768557a_bWVyY3VyaWFsL2V4Y2hhbmdlLnB5 100644
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -382,6 +382,6 @@
     afterward.
     """
 
-    def __init__(self, repo):
+    def __init__(self, repo, remote):
         # repo we pull from
         self.repo = repo
@@ -386,4 +386,6 @@
         # repo we pull from
         self.repo = repo
+        # repo we pull to
+        self.remote = remote
 
 def pull(repo, remote, heads=None, force=False):
@@ -388,8 +390,8 @@
 
 def pull(repo, remote, heads=None, force=False):
-    pullop = pulloperation(repo)
-    if remote.local():
-        missing = set(remote.requirements) - pullop.repo.supported
+    pullop = pulloperation(repo, remote)
+    if pullop.remote.local():
+        missing = set(pullop.remote.requirements) - pullop.repo.supported
         if missing:
             msg = _("required features are not"
                     " supported in the destination:"
@@ -399,6 +401,6 @@
     # don't open transaction for nothing or you break future useful
     # rollback call
     tr = None
-    trname = 'pull\n' + util.hidepassword(remote.url())
+    trname = 'pull\n' + util.hidepassword(pullop.remote.url())
     lock = pullop.repo.lock()
     try:
@@ -403,6 +405,7 @@
     lock = pullop.repo.lock()
     try:
-        tmp = discovery.findcommonincoming(pullop.repo.unfiltered(), remote,
+        tmp = discovery.findcommonincoming(pullop.repo.unfiltered(),
+                                           pullop.remote,
                                            heads=heads, force=force)
         common, fetch, rheads = tmp
         if not fetch:
@@ -412,7 +415,7 @@
             tr = pullop.repo.transaction(trname)
             if heads is None and list(common) == [nullid]:
                 pullop.repo.ui.status(_("requesting all changes\n"))
-            elif heads is None and remote.capable('changegroupsubset'):
+            elif heads is None and pullop.remote.capable('changegroupsubset'):
                 # issue1320, avoid a race if remote changed after discovery
                 heads = rheads
 
@@ -416,5 +419,5 @@
                 # issue1320, avoid a race if remote changed after discovery
                 heads = rheads
 
-            if remote.capable('getbundle'):
+            if pullop.remote.capable('getbundle'):
                 # TODO: get bundlecaps from remote
@@ -420,4 +423,4 @@
                 # TODO: get bundlecaps from remote
-                cg = remote.getbundle('pull', common=common,
-                                      heads=heads or rheads)
+                cg = pullop.remote.getbundle('pull', common=common,
+                                             heads=heads or rheads)
             elif heads is None:
@@ -423,7 +426,7 @@
             elif heads is None:
-                cg = remote.changegroup(fetch, 'pull')
-            elif not remote.capable('changegroupsubset'):
+                cg = pullop.remote.changegroup(fetch, 'pull')
+            elif not pullop.remote.capable('changegroupsubset'):
                 raise util.Abort(_("partial pull cannot be done because "
                                        "other repository doesn't support "
                                        "changegroupsubset."))
             else:
@@ -426,9 +429,10 @@
                 raise util.Abort(_("partial pull cannot be done because "
                                        "other repository doesn't support "
                                        "changegroupsubset."))
             else:
-                cg = remote.changegroupsubset(fetch, heads, 'pull')
-            result = pullop.repo.addchangegroup(cg, 'pull', remote.url())
+                cg = pullop.remote.changegroupsubset(fetch, heads, 'pull')
+            result = pullop.repo.addchangegroup(cg, 'pull',
+                                                pullop.remote.url())
 
         # compute target subset
         if heads is None:
@@ -441,7 +445,7 @@
             subset = heads
 
         # Get remote phases data from remote
-        remotephases = remote.listkeys('phases')
+        remotephases = pullop.remote.listkeys('phases')
         publishing = bool(remotephases.get('publishing', False))
         if remotephases and not publishing:
             # remote is new and unpublishing
@@ -459,7 +463,7 @@
                 return pullop.repo.transaction(trname)
             return tr
 
-        obstr = obsolete.syncpull(pullop.repo, remote, gettransaction)
+        obstr = obsolete.syncpull(pullop.repo, pullop.remote, gettransaction)
         if obstr is not None:
             tr = obstr