Mercurial > public > mercurial-scm > hg
diff mercurial/localrepo.py @ 37615:f3dc8239e3a9
peer: scatter module to the wind (API)
peer.py hardly contained any code. The code it did contain was
generic to the version 1 peer interface or specific to the
local repository peer.
So code has been moved to wireprotov1peer and localrepo, as
appropriate.
Differential Revision: https://phab.mercurial-scm.org/D3260
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Wed, 11 Apr 2018 12:51:09 -0700 |
parents | ecd3f6909184 |
children | e1b32dc4646c |
line wrap: on
line diff
--- a/mercurial/localrepo.py Wed Apr 11 12:49:08 2018 -0700 +++ b/mercurial/localrepo.py Wed Apr 11 12:51:09 2018 -0700 @@ -49,7 +49,6 @@ narrowspec, obsolete, pathutil, - peer, phases, pushkey, pycompat, @@ -66,6 +65,7 @@ txnutil, util, vfs as vfsmod, + wireprotov1peer, ) from .utils import ( procutil, @@ -153,6 +153,20 @@ 'unbundle'} legacycaps = moderncaps.union({'changegroupsubset'}) +class localiterbatcher(wireprotov1peer.iterbatcher): + def __init__(self, local): + super(localiterbatcher, self).__init__() + self.local = local + + def submit(self): + # submit for a local iter batcher is a noop + pass + + def results(self): + for name, args, opts, resref in self.calls: + resref.set(getattr(self.local, name)(*args, **opts)) + yield resref.value + class localpeer(repository.peer): '''peer for a local repo; reflects only the most recent API''' @@ -273,7 +287,7 @@ # Begin of peer interface. def iterbatch(self): - return peer.localiterbatcher(self) + return localiterbatcher(self) # End of peer interface.