mercurial/peer.py
changeset 33788 b47fe9733d76
parent 33787 4c706037adef
child 33827 dedab036215d
equal deleted inserted replaced
33787:4c706037adef 33788:b47fe9733d76
    47         raise NotImplementedError()
    47         raise NotImplementedError()
    48 
    48 
    49     def results(self):
    49     def results(self):
    50         raise NotImplementedError()
    50         raise NotImplementedError()
    51 
    51 
    52 class localbatch(batcher):
       
    53     '''performs the queued calls directly'''
       
    54     def __init__(self, local):
       
    55         batcher.__init__(self)
       
    56         self.local = local
       
    57     def submit(self):
       
    58         for name, args, opts, resref in self.calls:
       
    59             resref.set(getattr(self.local, name)(*args, **opts))
       
    60 
       
    61 class localiterbatcher(iterbatcher):
    52 class localiterbatcher(iterbatcher):
    62     def __init__(self, local):
    53     def __init__(self, local):
    63         super(iterbatcher, self).__init__()
    54         super(iterbatcher, self).__init__()
    64         self.local = local
    55         self.local = local
    65 
    56 
   104         return next(batchable)
    95         return next(batchable)
   105     setattr(plain, 'batchable', f)
    96     setattr(plain, 'batchable', f)
   106     return plain
    97     return plain
   107 
    98 
   108 class peerrepository(object):
    99 class peerrepository(object):
   109 
       
   110     def batch(self):
       
   111         return localbatch(self)
       
   112 
       
   113     def iterbatch(self):
   100     def iterbatch(self):
   114         """Batch requests but allow iterating over the results.
   101         """Batch requests but allow iterating over the results.
   115 
   102 
   116         This is to allow interleaving responses with things like
   103         This is to allow interleaving responses with things like
   117         progress updates for clients.
   104         progress updates for clients.