##// END OF EJS Templates
dirstate: use getattr rather than lazyread
Matt Mackall -
r4603:0f6853c1 default
parent child Browse files
Show More
@@ -20,7 +20,6 b' class dirstate(object):'
20 20 self.root = root
21 21 self.dirty = 0
22 22 self.ui = ui
23 self.map = None
24 23 self.fp = None
25 24 self.pl = None
26 25 self.dirs = None
@@ -29,6 +28,13 b' class dirstate(object):'
29 28 self._branch = None
30 29 self._slash = None
31 30
31 def __getattr__(self, name):
32 if name == 'map':
33 self.read()
34 return self.map
35 else:
36 raise AttributeError, name
37
32 38 def wjoin(self, f):
33 39 return os.path.join(self.root, f)
34 40
@@ -142,11 +148,7 b' class dirstate(object):'
142 148 self.write()
143 149
144 150 def __getitem__(self, key):
145 try:
146 return self.map[key]
147 except TypeError:
148 self.lazyread()
149 return self[key]
151 return self.map[key]
150 152
151 153 _unknown = ('?', 0, 0, 0)
152 154
@@ -157,7 +159,6 b' class dirstate(object):'
157 159 return self._unknown
158 160
159 161 def __contains__(self, key):
160 self.lazyread()
161 162 return key in self.map
162 163
163 164 def parents(self):
@@ -186,7 +187,6 b' class dirstate(object):'
186 187 self.dirty = 1
187 188
188 189 def setparents(self, p1, p2=nullid):
189 self.lazyread()
190 190 self.markdirty()
191 191 self.pl = p1, p2
192 192
@@ -200,10 +200,6 b' class dirstate(object):'
200 200 except KeyError:
201 201 return "?"
202 202
203 def lazyread(self):
204 if self.map is None:
205 self.read()
206
207 203 def parse(self, st):
208 204 self.pl = [st[:20], st[20: 40]]
209 205
@@ -255,7 +251,6 b' class dirstate(object):'
255 251 self.ignorefunc = None
256 252
257 253 def copy(self, source, dest):
258 self.lazyread()
259 254 self.markdirty()
260 255 self.copymap[dest] = source
261 256
@@ -282,7 +277,6 b' class dirstate(object):'
282 277 def prefixes(f):
283 278 for c in strutil.rfindall(f, '/'):
284 279 yield f[:c]
285 self.lazyread()
286 280 self.initdirs()
287 281 seendirs = {}
288 282 for f in files:
@@ -309,7 +303,6 b' class dirstate(object):'
309 303 a marked for addition'''
310 304
311 305 if not files: return
312 self.lazyread()
313 306 self.markdirty()
314 307 if state == "a":
315 308 self.initdirs()
@@ -330,7 +323,6 b' class dirstate(object):'
330 323
331 324 def forget(self, files):
332 325 if not files: return
333 self.lazyread()
334 326 self.markdirty()
335 327 self.initdirs()
336 328 for f in files:
@@ -438,7 +430,6 b' class dirstate(object):'
438 430
439 431 and st is the stat result if the file was found in the directory.
440 432 '''
441 self.lazyread()
442 433
443 434 # walk all files by default
444 435 if not files:
General Comments 0
You need to be logged in to leave comments. Login now