Show More
@@ -20,18 +20,33 b' class dirstate(object):' | |||||
20 | self.root = root |
|
20 | self.root = root | |
21 | self.dirty = 0 |
|
21 | self.dirty = 0 | |
22 | self.ui = ui |
|
22 | self.ui = ui | |
23 | self.fp = None |
|
|||
24 | self.pl = None |
|
|||
25 | self.dirs = None |
|
23 | self.dirs = None | |
26 | self.copymap = {} |
|
|||
27 | self.ignorefunc = None |
|
24 | self.ignorefunc = None | |
28 | self._branch = None |
|
|||
29 | self._slash = None |
|
25 | self._slash = None | |
30 |
|
26 | |||
31 | def __getattr__(self, name): |
|
27 | def __getattr__(self, name): | |
32 | if name == 'map': |
|
28 | if name == 'map': | |
33 | self.read() |
|
29 | self.read() | |
34 | return self.map |
|
30 | return self.map | |
|
31 | elif name == 'copymap': | |||
|
32 | self.read() | |||
|
33 | return self.copymap | |||
|
34 | elif name == '_branch': | |||
|
35 | try: | |||
|
36 | self._branch = self.opener("branch").read().strip()\ | |||
|
37 | or "default" | |||
|
38 | except IOError: | |||
|
39 | self._branch = "default" | |||
|
40 | return self._branch | |||
|
41 | elif name == 'pl': | |||
|
42 | self.pl = [nullid, nullid] | |||
|
43 | try: | |||
|
44 | st = self.opener("dirstate").read(40) | |||
|
45 | if len(st) == 40: | |||
|
46 | self.pl = st[:20], st[20:40] | |||
|
47 | except IOError, err: | |||
|
48 | if err.errno != errno.ENOENT: raise | |||
|
49 | return self.pl | |||
35 | else: |
|
50 | else: | |
36 | raise AttributeError, name |
|
51 | raise AttributeError, name | |
37 |
|
52 | |||
@@ -162,24 +177,9 b' class dirstate(object):' | |||||
162 | return key in self.map |
|
177 | return key in self.map | |
163 |
|
178 | |||
164 | def parents(self): |
|
179 | def parents(self): | |
165 | if self.pl is None: |
|
|||
166 | self.pl = [nullid, nullid] |
|
|||
167 | try: |
|
|||
168 | self.fp = self.opener('dirstate') |
|
|||
169 | st = self.fp.read(40) |
|
|||
170 | if len(st) == 40: |
|
|||
171 | self.pl = st[:20], st[20:40] |
|
|||
172 | except IOError, err: |
|
|||
173 | if err.errno != errno.ENOENT: raise |
|
|||
174 | return self.pl |
|
180 | return self.pl | |
175 |
|
181 | |||
176 | def branch(self): |
|
182 | def branch(self): | |
177 | if not self._branch: |
|
|||
178 | try: |
|
|||
179 | self._branch = self.opener("branch").read().strip()\ |
|
|||
180 | or "default" |
|
|||
181 | except IOError: |
|
|||
182 | self._branch = "default" |
|
|||
183 | return self._branch |
|
183 | return self._branch | |
184 |
|
184 | |||
185 | def markdirty(self): |
|
185 | def markdirty(self): | |
@@ -227,13 +227,9 b' class dirstate(object):' | |||||
227 |
|
227 | |||
228 | def read(self): |
|
228 | def read(self): | |
229 | self.map = {} |
|
229 | self.map = {} | |
|
230 | self.copymap = {} | |||
230 | self.pl = [nullid, nullid] |
|
231 | self.pl = [nullid, nullid] | |
231 | try: |
|
232 | try: | |
232 | if self.fp: |
|
|||
233 | self.fp.seek(0) |
|
|||
234 | st = self.fp.read() |
|
|||
235 | self.fp = None |
|
|||
236 | else: |
|
|||
237 |
|
|
233 | st = self.opener("dirstate").read() | |
238 | if st: |
|
234 | if st: | |
239 | self.parse(st) |
|
235 | self.parse(st) |
General Comments 0
You need to be logged in to leave comments.
Login now