D317: wireproto: properly implement batchable checking

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Fri Aug 11 18:52:01 UTC 2017


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

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



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


More information about the Mercurial-devel mailing list