Show More
@@ -60,7 +60,7 b' class localrepository(repo.repository):' | |||
|
60 | 60 | if inst.errno != errno.ENOENT: |
|
61 | 61 | raise |
|
62 | 62 | |
|
63 | self.store = store.store(requirements, self.path, util.opener) | |
|
63 | self.store = store.store(requirements, self.path, util.opener, os.path.join) | |
|
64 | 64 | self.spath = self.store.path |
|
65 | 65 | self.sopener = self.store.opener |
|
66 | 66 | self.sjoin = self.store.join |
@@ -54,7 +54,9 b' class statichttprepository(localrepo.loc' | |||
|
54 | 54 | raise repo.RepoError(_("requirement '%s' not supported") % r) |
|
55 | 55 | |
|
56 | 56 | # setup store |
|
57 | self.store = store.store(requirements, self.path, opener) | |
|
57 | def pjoin(a, b): | |
|
58 | return a + '/' + b | |
|
59 | self.store = store.store(requirements, self.path, opener, pjoin) | |
|
58 | 60 | self.spath = self.store.path |
|
59 | 61 | self.sopener = self.store.opener |
|
60 | 62 | self.sjoin = self.store.join |
@@ -50,18 +50,19 b' def _calcmode(path):' | |||
|
50 | 50 | |
|
51 | 51 | class basicstore: |
|
52 | 52 | '''base class for local repository stores''' |
|
53 | def __init__(self, path, opener): | |
|
53 | def __init__(self, path, opener, pathjoiner): | |
|
54 | self.pathjoiner = pathjoiner | |
|
54 | 55 | self.path = path |
|
55 | 56 | self.createmode = _calcmode(path) |
|
56 | 57 | self.opener = opener(self.path) |
|
57 | 58 | self.opener.createmode = self.createmode |
|
58 | 59 | |
|
59 | 60 | def join(self, f): |
|
60 |
return |
|
|
61 | return self.pathjoiner(self.path, f) | |
|
61 | 62 | |
|
62 | 63 | def _walk(self, relpath, recurse): |
|
63 | 64 | '''yields (unencoded, encoded, size)''' |
|
64 |
path = |
|
|
65 | path = self.pathjoiner(self.path, relpath) | |
|
65 | 66 | striplen = len(self.path) + len(os.sep) |
|
66 | 67 | prefix = path[striplen:] |
|
67 | 68 | l = [] |
@@ -70,7 +71,7 b' class basicstore:' | |||
|
70 | 71 | while visit: |
|
71 | 72 | p = visit.pop() |
|
72 | 73 | for f, kind, st in osutil.listdir(p, stat=True): |
|
73 |
fp = |
|
|
74 | fp = self.pathjoiner(p, f) | |
|
74 | 75 | if kind == stat.S_IFREG and f[-2:] in ('.d', '.i'): |
|
75 | 76 | n = util.pconvert(fp[striplen:]) |
|
76 | 77 | l.append((n, n, st.st_size)) |
@@ -96,8 +97,9 b' class basicstore:' | |||
|
96 | 97 | return ['requires'] + _data.split() |
|
97 | 98 | |
|
98 | 99 | class encodedstore(basicstore): |
|
99 | def __init__(self, path, opener): | |
|
100 |
self.path = |
|
|
100 | def __init__(self, path, opener, pathjoiner): | |
|
101 | self.pathjoiner = pathjoiner | |
|
102 | self.path = self.pathjoiner(path, 'store') | |
|
101 | 103 | self.createmode = _calcmode(self.path) |
|
102 | 104 | op = opener(self.path) |
|
103 | 105 | op.createmode = self.createmode |
@@ -112,13 +114,13 b' class encodedstore(basicstore):' | |||
|
112 | 114 | yield a, b, size |
|
113 | 115 | |
|
114 | 116 | def join(self, f): |
|
115 |
return |
|
|
117 | return self.pathjoiner(self.path, encodefilename(f)) | |
|
116 | 118 | |
|
117 | 119 | def copylist(self): |
|
118 | 120 | return (['requires', '00changelog.i'] + |
|
119 |
['store |
|
|
121 | [self.pathjoiner('store', f) for f in _data.split()]) | |
|
120 | 122 | |
|
121 | def store(requirements, path, opener): | |
|
123 | def store(requirements, path, opener, pathjoiner): | |
|
122 | 124 | if 'store' in requirements: |
|
123 | return encodedstore(path, opener) | |
|
124 | return basicstore(path, opener) | |
|
125 | return encodedstore(path, opener, pathjoiner) | |
|
126 | return basicstore(path, opener, pathjoiner) |
General Comments 0
You need to be logged in to leave comments.
Login now