comparison mercurial/wireprotov1server.py @ 45784:74271829ddc0

clonebundles: move a bundle of clone bundle related code to a new module In the process on general clone bundle automatically, we need to make some function available more widely. This is a good opportunity to extract a significant amount of code from `mercurial.exchange` into a new `mercurial.bundlecaches`. This make `mercurial.exchange` move under the 3K line range (hooray…). The module is called `bundlecaches` because I expect it to be eventually useful for more than just clone bundle (like pull bunbles). Differential Revision: https://phab.mercurial-scm.org/D9208
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 15 Oct 2020 15:57:36 +0200
parents d2e1dcd4490d
children 80f32ec8653a
comparison
equal deleted inserted replaced
45783:88a47cbf063c 45784:74271829ddc0
17 ) 17 )
18 from .pycompat import getattr 18 from .pycompat import getattr
19 19
20 from . import ( 20 from . import (
21 bundle2, 21 bundle2,
22 bundlecaches,
22 changegroup as changegroupmod, 23 changegroup as changegroupmod,
23 discovery, 24 discovery,
24 encoding, 25 encoding,
25 error, 26 error,
26 exchange, 27 exchange,
385 return {binascii.unhexlify(h) for h in s.split(b';')} 386 return {binascii.unhexlify(h) for h in s.split(b';')}
386 387
387 manifest = repo.vfs.tryread(b'pullbundles.manifest') 388 manifest = repo.vfs.tryread(b'pullbundles.manifest')
388 if not manifest: 389 if not manifest:
389 return None 390 return None
390 res = exchange.parseclonebundlesmanifest(repo, manifest) 391 res = bundlecaches.parseclonebundlesmanifest(repo, manifest)
391 res = exchange.filterclonebundleentries(repo, res) 392 res = bundlecaches.filterclonebundleentries(repo, res)
392 if not res: 393 if not res:
393 return None 394 return None
394 cl = repo.unfiltered().changelog 395 cl = repo.unfiltered().changelog
395 heads_anc = cl.ancestors([cl.rev(rev) for rev in heads], inclusive=True) 396 heads_anc = cl.ancestors([cl.rev(rev) for rev in heads], inclusive=True)
396 common_anc = cl.ancestors([cl.rev(rev) for rev in common], inclusive=True) 397 common_anc = cl.ancestors([cl.rev(rev) for rev in common], inclusive=True)