comparison mercurial/bundlerepo.py @ 39603:a8d2faeca49e

bundlerepo: factor out code for instantiating a bundle repository This code will soon become a bit more complicated. So extract to its own function. And change both instantiators of bundlerepository to use it. Differential Revision: https://phab.mercurial-scm.org/D4554
author Gregory Szorc <gregory.szorc@gmail.com>
date Tue, 11 Sep 2018 19:16:32 -0700
parents 2d2bbf3f3e09
children 335ae4d0a552
comparison
equal deleted inserted replaced
39602:2d2bbf3f3e09 39603:a8d2faeca49e
477 repopath, bundlename = parentpath, s[0] 477 repopath, bundlename = parentpath, s[0]
478 else: 478 else:
479 repopath, bundlename = s 479 repopath, bundlename = s
480 else: 480 else:
481 repopath, bundlename = parentpath, path 481 repopath, bundlename = parentpath, path
482 return bundlerepository(ui, repopath, bundlename) 482
483 return makebundlerepository(ui, repopath, bundlename)
484
485 def makebundlerepository(ui, repopath, bundlepath):
486 """Make a bundle repository object based on repo and bundle paths."""
487 return bundlerepository(ui, repopath, bundlepath)
483 488
484 class bundletransactionmanager(object): 489 class bundletransactionmanager(object):
485 def transaction(self): 490 def transaction(self):
486 return None 491 return None
487 492
586 # keep written bundle? 591 # keep written bundle?
587 if bundlename: 592 if bundlename:
588 bundle = None 593 bundle = None
589 if not localrepo: 594 if not localrepo:
590 # use the created uncompressed bundlerepo 595 # use the created uncompressed bundlerepo
591 localrepo = bundlerepo = bundlerepository(repo.baseui, repo.root, 596 localrepo = bundlerepo = makebundlerepository(repo. baseui,
592 fname) 597 repo.root,
598 fname)
599
593 # this repo contains local and peer now, so filter out local again 600 # this repo contains local and peer now, so filter out local again
594 common = repo.heads() 601 common = repo.heads()
595 if localrepo: 602 if localrepo:
596 # Part of common may be remotely filtered 603 # Part of common may be remotely filtered
597 # So use an unfiltered version 604 # So use an unfiltered version