This code will soon become a bit more complicated. So extract to its
own function.
And change both instantiators of bundlerepository to use it.
hg-reviewers |
This code will soon become a bit more complicated. So extract to its
own function.
And change both instantiators of bundlerepository to use it.
Lint Skipped |
Unit Tests Skipped |
if u.scheme == 'bundle': | if u.scheme == 'bundle': | ||||
s = path.split("+", 1) | s = path.split("+", 1) | ||||
if len(s) == 1: | if len(s) == 1: | ||||
repopath, bundlename = parentpath, s[0] | repopath, bundlename = parentpath, s[0] | ||||
else: | else: | ||||
repopath, bundlename = s | repopath, bundlename = s | ||||
else: | else: | ||||
repopath, bundlename = parentpath, path | repopath, bundlename = parentpath, path | ||||
return bundlerepository(ui, repopath, bundlename) | |||||
return makebundlerepository(ui, repopath, bundlename) | |||||
def makebundlerepository(ui, repopath, bundlepath): | |||||
"""Make a bundle repository object based on repo and bundle paths.""" | |||||
return bundlerepository(ui, repopath, bundlepath) | |||||
class bundletransactionmanager(object): | class bundletransactionmanager(object): | ||||
def transaction(self): | def transaction(self): | ||||
return None | return None | ||||
def close(self): | def close(self): | ||||
raise NotImplementedError | raise NotImplementedError | ||||
bundletype = "HG10UN" | bundletype = "HG10UN" | ||||
fname = bundle = bundle2.writebundle(ui, cg, bundlename, | fname = bundle = bundle2.writebundle(ui, cg, bundlename, | ||||
bundletype) | bundletype) | ||||
# keep written bundle? | # keep written bundle? | ||||
if bundlename: | if bundlename: | ||||
bundle = None | bundle = None | ||||
if not localrepo: | if not localrepo: | ||||
# use the created uncompressed bundlerepo | # use the created uncompressed bundlerepo | ||||
localrepo = bundlerepo = bundlerepository(repo.baseui, repo.root, | localrepo = bundlerepo = makebundlerepository(repo. baseui, | ||||
repo.root, | |||||
fname) | fname) | ||||
# this repo contains local and peer now, so filter out local again | # this repo contains local and peer now, so filter out local again | ||||
common = repo.heads() | common = repo.heads() | ||||
if localrepo: | if localrepo: | ||||
# Part of common may be remotely filtered | # Part of common may be remotely filtered | ||||
# So use an unfiltered version | # So use an unfiltered version | ||||
# The discovery process probably need cleanup to avoid that | # The discovery process probably need cleanup to avoid that | ||||
localrepo = localrepo.unfiltered() | localrepo = localrepo.unfiltered() | ||||