Mercurial > hg
changeset 3791:8643b9f90b51
introduce localrepo.spath for the store path, sopener fixes
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Tue, 05 Dec 2006 11:28:23 +0100 |
parents | f183c18568df |
children | f3fbf76d043c |
files | mercurial/bundlerepo.py mercurial/hg.py mercurial/localrepo.py mercurial/statichttprepo.py mercurial/streamclone.py |
diffstat | 5 files changed, 21 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/bundlerepo.py Tue Dec 05 11:28:21 2006 +0100 +++ b/mercurial/bundlerepo.py Tue Dec 05 11:28:23 2006 +0100 @@ -199,8 +199,8 @@ else: raise util.Abort(_("%s: unknown bundle compression type") % bundlename) - self.changelog = bundlechangelog(self.opener, self.bundlefile) - self.manifest = bundlemanifest(self.opener, self.bundlefile, + self.changelog = bundlechangelog(self.sopener, self.bundlefile) + self.manifest = bundlemanifest(self.sopener, self.bundlefile, self.changelog.rev) # dict with the mapping 'filename' -> position in the bundle self.bundlefilespos = {} @@ -223,10 +223,10 @@ f = f[1:] if f in self.bundlefilespos: self.bundlefile.seek(self.bundlefilespos[f]) - return bundlefilelog(self.opener, f, self.bundlefile, + return bundlefilelog(self.sopener, f, self.bundlefile, self.changelog.rev) else: - return filelog.filelog(self.opener, f) + return filelog.filelog(self.sopener, f) def close(self): """Close assigned bundle file immediately."""
--- a/mercurial/hg.py Tue Dec 05 11:28:21 2006 +0100 +++ b/mercurial/hg.py Tue Dec 05 11:28:23 2006 +0100 @@ -129,11 +129,9 @@ dest_repo = repository(ui, dest, create=True) - dest_path = None dir_cleanup = None if dest_repo.local(): - dest_path = os.path.realpath(dest_repo.root) - dir_cleanup = DirCleanup(dest_path) + dir_cleanup = DirCleanup(os.path.realpath(dest_repo.root)) abspath = source copy = False @@ -154,14 +152,16 @@ if copy: # we lock here to avoid premature writing to the target - dest_lock = lock.lock(os.path.join(dest_path, ".hg", "lock")) + src_store = os.path.realpath(src_repo.spath) + dest_store = os.path.realpath(dest_repo.spath) + dest_lock = lock.lock(os.path.join(dest_store, "lock")) files = ("data", "00manifest.d", "00manifest.i", "00changelog.d", "00changelog.i") for f in files: - src = os.path.join(source, ".hg", f) - dst = os.path.join(dest_path, ".hg", f) + src = os.path.join(src_store, f) + dst = os.path.join(dest_store, f) try: util.copyfiles(src, dst) except OSError, inst:
--- a/mercurial/localrepo.py Tue Dec 05 11:28:21 2006 +0100 +++ b/mercurial/localrepo.py Tue Dec 05 11:28:23 2006 +0100 @@ -31,12 +31,15 @@ " here (.hg not found)")) path = p self.path = os.path.join(path, ".hg") + self.spath = self.path if not os.path.isdir(self.path): if create: if not os.path.exists(path): os.mkdir(path) os.mkdir(self.path) + if self.spath != self.path: + os.mkdir(self.spath) else: raise repo.RepoError(_("repository %s not found") % path) elif create: @@ -46,7 +49,7 @@ self.origroot = path self.ui = ui.ui(parentui=parentui) self.opener = util.opener(self.path) - self.sopener = util.opener(self.path) + self.sopener = util.opener(self.spath) self.wopener = util.opener(self.root) try: @@ -395,7 +398,7 @@ return os.path.join(self.path, f) def sjoin(self, f): - return os.path.join(self.path, f) + return os.path.join(self.spath, f) def wjoin(self, f): return os.path.join(self.root, f)
--- a/mercurial/statichttprepo.py Tue Dec 05 11:28:21 2006 +0100 +++ b/mercurial/statichttprepo.py Tue Dec 05 11:28:23 2006 +0100 @@ -33,12 +33,13 @@ def __init__(self, ui, path): self._url = path self.path = (path + "/.hg") + self.spath = self.path self.ui = ui self.revlogversion = 0 self.opener = opener(self.path) - self.sopener = opener(self.path) - self.manifest = manifest.manifest(self.opener) - self.changelog = changelog.changelog(self.opener) + self.sopener = opener(self.spath) + self.manifest = manifest.manifest(self.sopener) + self.changelog = changelog.changelog(self.sopener) self.tagscache = None self.nodetagscache = None self.encodepats = None
--- a/mercurial/streamclone.py Tue Dec 05 11:28:21 2006 +0100 +++ b/mercurial/streamclone.py Tue Dec 05 11:28:23 2006 +0100 @@ -78,7 +78,7 @@ repo.ui.debug('scanning\n') entries = [] total_bytes = 0 - for name, size in walkrepo(repo.path): + for name, size in walkrepo(repo.spath): entries.append((name, size)) total_bytes += size repolock.release() @@ -89,7 +89,7 @@ for name, size in entries: repo.ui.debug('sending %s (%d bytes)\n' % (name, size)) fileobj.write('%s\0%d\n' % (name, size)) - for chunk in util.filechunkiter(repo.opener(name), limit=size): + for chunk in util.filechunkiter(repo.sopener(name), limit=size): fileobj.write(chunk) flush = getattr(fileobj, 'flush', None) if flush: flush()