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: | |
|
50 | def _calcmode(path): | |
|
51 | try: | |
|
52 | # files in .hg/ will be created using this mode | |
|
53 | mode = os.stat(path).st_mode | |
|
54 | # avoid some useless chmods | |
|
55 | if (0777 & ~util._umask) == (0777 & mode): | |
|
56 | mode = None | |
|
57 | except OSError: | |
|
58 | mode = None | |
|
59 | return mode | |
|
60 | ||
|
61 | class basicstore: | |
|
51 | 62 | '''base class for local repository stores''' |
|
52 | def __init__(self, path): | |
|
63 | def __init__(self, path, opener): | |
|
53 | 64 | self.path = path |
|
54 | try: | |
|
55 | # files in .hg/ will be created using this mode | |
|
56 | mode = os.stat(self.path).st_mode | |
|
57 | # avoid some useless chmods | |
|
58 | if (0777 & ~util._umask) == (0777 & mode): | |
|
59 | mode = None | |
|
60 | except OSError: | |
|
61 | mode = None | |
|
62 | self.createmode = mode | |
|
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