changeset 25913:fa14ba7b9667

wireproto: make wirepeer look-before-you-leap on batching This means that users of request batching don't need to worry themselves with capability checking. Instead, they can just use batching, and if the remote server doesn't support batching for some reason the wirepeer code will transparently un-batch the requests. This will allow for some slight simplification in a handful of places. Prior to this change, largefiles would have been silently broken against a server which did not support batching.
author Augie Fackler <augie@google.com>
date Wed, 05 Aug 2015 14:15:17 -0400
parents cbbdd085c991
children 4d77e89652ad
files mercurial/wireproto.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/wireproto.py	Wed Aug 05 14:51:34 2015 -0400
+++ b/mercurial/wireproto.py	Wed Aug 05 14:15:17 2015 -0400
@@ -149,7 +149,10 @@
 class wirepeer(peer.peerrepository):
 
     def batch(self):
-        return remotebatch(self)
+        if self.capable('batch'):
+            return remotebatch(self)
+        else:
+            return peer.localbatch(self)
     def _submitbatch(self, req):
         cmds = []
         for op, argsdict in req: