Show More
@@ -47,19 +47,24 b' def _dirwalk(path, recurse):' | |||
|
47 | 47 | elif kind == stat.S_IFREG: |
|
48 | 48 | yield pe, st.st_size |
|
49 | 49 | |
|
50 | class _store: | |
|
51 | '''base class for local repository stores''' | |
|
52 | def __init__(self, path): | |
|
53 | self.path = path | |
|
50 | def _calcmode(path): | |
|
54 | 51 |
|
|
55 | 52 |
|
|
56 |
|
|
|
53 | mode = os.stat(path).st_mode | |
|
57 | 54 | # avoid some useless chmods |
|
58 | 55 |
|
|
59 | 56 |
|
|
60 | 57 |
|
|
61 | 58 |
|
|
62 | self.createmode = mode | |
|
59 | return mode | |
|
60 | ||
|
61 | class basicstore: | |
|
62 | '''base class for local repository stores''' | |
|
63 | def __init__(self, path, opener): | |
|
64 | self.path = path | |
|
65 | self.createmode = _calcmode(path) | |
|
66 | self.opener = opener(self.path) | |
|
67 | self.opener.createmode = self.createmode | |
|
63 | 68 | |
|
64 | 69 | def join(self, f): |
|
65 | 70 | return os.path.join(self.path, f) |
@@ -93,15 +98,10 b' class _store:' | |||
|
93 | 98 | for x in meta: |
|
94 | 99 | yield x |
|
95 | 100 | |
|
96 |
class |
|
|
101 | class encodedstore(basicstore): | |
|
97 | 102 | def __init__(self, path, opener): |
|
98 | _store.__init__(self, path) | |
|
99 |
self. |
|
|
100 | self.opener.createmode = self.createmode | |
|
101 | ||
|
102 | class encodedstore(_store): | |
|
103 | def __init__(self, path, opener): | |
|
104 | _store.__init__(self, os.path.join(path, 'store')) | |
|
103 | self.path = os.path.join(path, 'store') | |
|
104 | self.createmode = _calcmode(self.path) | |
|
105 | 105 | self.encodefn = encodefilename |
|
106 | 106 | op = opener(self.path) |
|
107 | 107 | op.createmode = self.createmode |
@@ -120,7 +120,6 b' class encodedstore(_store):' | |||
|
120 | 120 | return os.path.join(self.path, self.encodefn(f)) |
|
121 | 121 | |
|
122 | 122 | def store(requirements, path, opener): |
|
123 |
if 'store' |
|
|
124 | return directstore(path, opener) | |
|
125 | else: | |
|
123 | if 'store' in requirements: | |
|
126 | 124 | return encodedstore(path, opener) |
|
125 | return basicstore(path, opener) |
General Comments 0
You need to be logged in to leave comments.
Login now