comparison mercurial/wireproto.py @ 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 0851678be71b
comparison
equal deleted inserted replaced
25912:cbbdd085c991 25913:fa14ba7b9667
147 # client side 147 # client side
148 148
149 class wirepeer(peer.peerrepository): 149 class wirepeer(peer.peerrepository):
150 150
151 def batch(self): 151 def batch(self):
152 return remotebatch(self) 152 if self.capable('batch'):
153 return remotebatch(self)
154 else:
155 return peer.localbatch(self)
153 def _submitbatch(self, req): 156 def _submitbatch(self, req):
154 cmds = [] 157 cmds = []
155 for op, argsdict in req: 158 for op, argsdict in req:
156 args = ','.join('%s=%s' % (escapearg(k), escapearg(v)) 159 args = ','.join('%s=%s' % (escapearg(k), escapearg(v))
157 for k, v in argsdict.iteritems()) 160 for k, v in argsdict.iteritems())