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