Details
Details
- Reviewers
dlax durin42 - Group Reviewers
hg-reviewers - Commits
- rHGd2458ba810c5: bundlerepo: add docstring for bundlerepository class
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
dlax | |
durin42 |
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
for chunkdata in iter(bundle.filelogheader, {}): | for chunkdata in iter(bundle.filelogheader, {}): | ||||
fname = chunkdata['filename'] | fname = chunkdata['filename'] | ||||
bundlefilespos[fname] = bundle.tell() | bundlefilespos[fname] = bundle.tell() | ||||
for chunk in iter(lambda: bundle.deltachunk(None), {}): | for chunk in iter(lambda: bundle.deltachunk(None), {}): | ||||
pass | pass | ||||
return bundlefilespos | return bundlefilespos | ||||
class bundlerepository(localrepo.localrepository): | class bundlerepository(localrepo.localrepository): | ||||
"""A repository instance that is a union of a local repo and a bundle. | |||||
Instances represent a read-only repository composed of a local repository | |||||
with the contents of a bundle file applied. The repository instance is | |||||
conceptually similar to the state of a repository after an | |||||
``hg unbundle`` operation. However, the contents of the bundle are never | |||||
applied to the actual base repository. | |||||
""" | |||||
def __init__(self, ui, repopath, bundlepath): | def __init__(self, ui, repopath, bundlepath): | ||||
self._tempparent = None | self._tempparent = None | ||||
try: | try: | ||||
localrepo.localrepository.__init__(self, ui, repopath) | localrepo.localrepository.__init__(self, ui, repopath) | ||||
except error.RepoError: | except error.RepoError: | ||||
self._tempparent = tempfile.mkdtemp() | self._tempparent = tempfile.mkdtemp() | ||||
localrepo.instance(ui, self._tempparent, 1) | localrepo.instance(ui, self._tempparent, 1) | ||||
localrepo.localrepository.__init__(self, ui, self._tempparent) | localrepo.localrepository.__init__(self, ui, self._tempparent) |