##// END OF EJS Templates
introduce localrepo.spath for the store path, sopener fixes
Benoit Boissinot -
r3791:8643b9f9 default
parent child Browse files
Show More
@@ -199,8 +199,8 b' class bundlerepository(localrepo.localre'
199 199 else:
200 200 raise util.Abort(_("%s: unknown bundle compression type")
201 201 % bundlename)
202 self.changelog = bundlechangelog(self.opener, self.bundlefile)
203 self.manifest = bundlemanifest(self.opener, self.bundlefile,
202 self.changelog = bundlechangelog(self.sopener, self.bundlefile)
203 self.manifest = bundlemanifest(self.sopener, self.bundlefile,
204 204 self.changelog.rev)
205 205 # dict with the mapping 'filename' -> position in the bundle
206 206 self.bundlefilespos = {}
@@ -223,10 +223,10 b' class bundlerepository(localrepo.localre'
223 223 f = f[1:]
224 224 if f in self.bundlefilespos:
225 225 self.bundlefile.seek(self.bundlefilespos[f])
226 return bundlefilelog(self.opener, f, self.bundlefile,
226 return bundlefilelog(self.sopener, f, self.bundlefile,
227 227 self.changelog.rev)
228 228 else:
229 return filelog.filelog(self.opener, f)
229 return filelog.filelog(self.sopener, f)
230 230
231 231 def close(self):
232 232 """Close assigned bundle file immediately."""
@@ -129,11 +129,9 b' def clone(ui, source, dest=None, pull=Fa'
129 129
130 130 dest_repo = repository(ui, dest, create=True)
131 131
132 dest_path = None
133 132 dir_cleanup = None
134 133 if dest_repo.local():
135 dest_path = os.path.realpath(dest_repo.root)
136 dir_cleanup = DirCleanup(dest_path)
134 dir_cleanup = DirCleanup(os.path.realpath(dest_repo.root))
137 135
138 136 abspath = source
139 137 copy = False
@@ -154,14 +152,16 b' def clone(ui, source, dest=None, pull=Fa'
154 152
155 153 if copy:
156 154 # we lock here to avoid premature writing to the target
157 dest_lock = lock.lock(os.path.join(dest_path, ".hg", "lock"))
155 src_store = os.path.realpath(src_repo.spath)
156 dest_store = os.path.realpath(dest_repo.spath)
157 dest_lock = lock.lock(os.path.join(dest_store, "lock"))
158 158
159 159 files = ("data",
160 160 "00manifest.d", "00manifest.i",
161 161 "00changelog.d", "00changelog.i")
162 162 for f in files:
163 src = os.path.join(source, ".hg", f)
164 dst = os.path.join(dest_path, ".hg", f)
163 src = os.path.join(src_store, f)
164 dst = os.path.join(dest_store, f)
165 165 try:
166 166 util.copyfiles(src, dst)
167 167 except OSError, inst:
@@ -31,12 +31,15 b' class localrepository(repo.repository):'
31 31 " here (.hg not found)"))
32 32 path = p
33 33 self.path = os.path.join(path, ".hg")
34 self.spath = self.path
34 35
35 36 if not os.path.isdir(self.path):
36 37 if create:
37 38 if not os.path.exists(path):
38 39 os.mkdir(path)
39 40 os.mkdir(self.path)
41 if self.spath != self.path:
42 os.mkdir(self.spath)
40 43 else:
41 44 raise repo.RepoError(_("repository %s not found") % path)
42 45 elif create:
@@ -46,7 +49,7 b' class localrepository(repo.repository):'
46 49 self.origroot = path
47 50 self.ui = ui.ui(parentui=parentui)
48 51 self.opener = util.opener(self.path)
49 self.sopener = util.opener(self.path)
52 self.sopener = util.opener(self.spath)
50 53 self.wopener = util.opener(self.root)
51 54
52 55 try:
@@ -395,7 +398,7 b' class localrepository(repo.repository):'
395 398 return os.path.join(self.path, f)
396 399
397 400 def sjoin(self, f):
398 return os.path.join(self.path, f)
401 return os.path.join(self.spath, f)
399 402
400 403 def wjoin(self, f):
401 404 return os.path.join(self.root, f)
@@ -33,12 +33,13 b' class statichttprepository(localrepo.loc'
33 33 def __init__(self, ui, path):
34 34 self._url = path
35 35 self.path = (path + "/.hg")
36 self.spath = self.path
36 37 self.ui = ui
37 38 self.revlogversion = 0
38 39 self.opener = opener(self.path)
39 self.sopener = opener(self.path)
40 self.manifest = manifest.manifest(self.opener)
41 self.changelog = changelog.changelog(self.opener)
40 self.sopener = opener(self.spath)
41 self.manifest = manifest.manifest(self.sopener)
42 self.changelog = changelog.changelog(self.sopener)
42 43 self.tagscache = None
43 44 self.nodetagscache = None
44 45 self.encodepats = None
@@ -78,7 +78,7 b' def stream_out(repo, fileobj):'
78 78 repo.ui.debug('scanning\n')
79 79 entries = []
80 80 total_bytes = 0
81 for name, size in walkrepo(repo.path):
81 for name, size in walkrepo(repo.spath):
82 82 entries.append((name, size))
83 83 total_bytes += size
84 84 repolock.release()
@@ -89,7 +89,7 b' def stream_out(repo, fileobj):'
89 89 for name, size in entries:
90 90 repo.ui.debug('sending %s (%d bytes)\n' % (name, size))
91 91 fileobj.write('%s\0%d\n' % (name, size))
92 for chunk in util.filechunkiter(repo.opener(name), limit=size):
92 for chunk in util.filechunkiter(repo.sopener(name), limit=size):
93 93 fileobj.write(chunk)
94 94 flush = getattr(fileobj, 'flush', None)
95 95 if flush: flush()
General Comments 0
You need to be logged in to leave comments. Login now