Patchwork D317: wireproto: properly implement batchable checking

login
register
mail settings
Submitter phabricator
Date Aug. 11, 2017, 6:52 p.m.
Message ID <2ba719169845ff4f8e61ef62457aafe9@localhost.localdomain>
Download mbox | patch
Permalink /patch/22890/
State Not Applicable
Headers show

Comments

phabricator - Aug. 11, 2017, 6:52 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG297d1b70685c: wireproto: properly implement batchable checking (authored by indygreg).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D317?vs=732&id=791

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

AFFECTED FILES
  mercurial/wireproto.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py
--- a/mercurial/wireproto.py
+++ b/mercurial/wireproto.py
@@ -120,9 +120,13 @@ 
         self._remote = remote
 
     def __getattr__(self, name):
-        if not getattr(self._remote, name, False):
-            raise AttributeError(
-                'Attempted to iterbatch non-batchable call to %r' % name)
+        # Validate this method is batchable, since submit() only supports
+        # batchable methods.
+        fn = getattr(self._remote, name)
+        if not getattr(fn, 'batchable', None):
+            raise error.ProgrammingError('Attempted to batch a non-batchable '
+                                         'call to %r' % name)
+
         return super(remoteiterbatcher, self).__getattr__(name)
 
     def submit(self):