Patchwork D265: exchange: access requirements on repo instead of peer

login
register
mail settings
Submitter phabricator
Date Aug. 8, 2017, 3:24 a.m.
Message ID <differential-rev-PHID-DREV-fbtd45e4uz4xym36kd3x-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/22734/
State Superseded
Headers show

Comments

phabricator - Aug. 8, 2017, 3:24 a.m.
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  As part of formalizing the peer interface, I audited for attribute
  accesses for non-internal names to find API violations. This
  uncovered the code changed in this commit.
  
  localpeer.requirements is just an alias to the repo's requirements
  attribute. So, change the code to get the data from the source
  instead of relying on a one-off attribute in the localpeer type.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D265

AFFECTED FILES
  mercurial/exchange.py

CHANGE DETAILS




To: indygreg, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -1216,8 +1216,10 @@ 
         opargs = {}
     pullop = pulloperation(repo, remote, heads, force, bookmarks=bookmarks,
                            streamclonerequested=streamclonerequested, **opargs)
-    if pullop.remote.local():
-        missing = set(pullop.remote.requirements) - pullop.repo.supported
+
+    peerlocal = pullop.remote.local()
+    if peerlocal:
+        missing = set(peerlocal.requirements) - pullop.repo.supported
         if missing:
             msg = _("required features are not"
                     " supported in the destination:"