exchange: access requirements on repo instead of peer
authorGregory Szorc <gregory.szorc@gmail.com>
Sat, 05 Aug 2017 15:15:20 -0700
changeset 33702 033484935391
parent 33701 fda0867cfe03
child 33703 da3087b8f4a2
exchange: access requirements on repo instead of peer 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. Differential Revision: https://phab.mercurial-scm.org/D265
mercurial/exchange.py
--- a/mercurial/exchange.py	Sun Aug 06 17:44:56 2017 -0700
+++ b/mercurial/exchange.py	Sat Aug 05 15:15:20 2017 -0700
@@ -1226,8 +1226,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:"