Show More
@@ -25,10 +25,10 b' class dirstate(object):' | |||
|
25 | 25 | |
|
26 | 26 | def __getattr__(self, name): |
|
27 | 27 | if name == '_map': |
|
28 | self.read() | |
|
28 | self._read() | |
|
29 | 29 | return self._map |
|
30 | 30 | elif name == '_copymap': |
|
31 | self.read() | |
|
31 | self._read() | |
|
32 | 32 | return self._copymap |
|
33 | 33 | elif name == '_branch': |
|
34 | 34 | try: |
@@ -46,11 +46,11 b' class dirstate(object):' | |||
|
46 | 46 | except IOError, err: |
|
47 | 47 | if err.errno != errno.ENOENT: raise |
|
48 | 48 | return self._pl |
|
49 | elif name == 'dirs': | |
|
50 | self.dirs = {} | |
|
49 | elif name == '_dirs': | |
|
50 | self._dirs = {} | |
|
51 | 51 | for f in self._map: |
|
52 |
self. |
|
|
53 | return self.dirs | |
|
52 | self._incpath(f) | |
|
53 | return self._dirs | |
|
54 | 54 | elif name == '_ignore': |
|
55 | 55 | files = [self.wjoin('.hgignore')] + self._ui.hgignorefiles() |
|
56 | 56 | self._ignore = ignore.ignore(self._root, files, self._ui.warn) |
@@ -120,7 +120,7 b' class dirstate(object):' | |||
|
120 | 120 | def state(self, key): |
|
121 | 121 | return self._map.get(key, ("?",))[0] |
|
122 | 122 | |
|
123 | def read(self): | |
|
123 | def _read(self): | |
|
124 | 124 | self._map = {} |
|
125 | 125 | self._copymap = {} |
|
126 | 126 | self._pl = [nullid, nullid] |
@@ -156,7 +156,7 b' class dirstate(object):' | |||
|
156 | 156 | pos = newpos |
|
157 | 157 | |
|
158 | 158 | def invalidate(self): |
|
159 | for a in "_map _copymap _branch pl dirs _ignore".split(): | |
|
159 | for a in "_map _copymap _branch pl _dirs _ignore".split(): | |
|
160 | 160 | if hasattr(self, a): |
|
161 | 161 | self.__delattr__(a) |
|
162 | 162 | |
@@ -170,11 +170,17 b' class dirstate(object):' | |||
|
170 | 170 | def copies(self): |
|
171 | 171 | return self._copymap |
|
172 | 172 | |
|
173 |
def |
|
|
173 | def _incpath(self, path): | |
|
174 | 174 | for c in strutil.findall(path, '/'): |
|
175 | 175 | pc = path[:c] |
|
176 | self.dirs.setdefault(pc, 0) | |
|
177 |
self.dirs[pc] += |
|
|
176 | self._dirs.setdefault(pc, 0) | |
|
177 | self._dirs[pc] += 1 | |
|
178 | ||
|
179 | def _decpath(self, path): | |
|
180 | for c in strutil.findall(path, '/'): | |
|
181 | pc = path[:c] | |
|
182 | self._dirs.setdefault(pc, 0) | |
|
183 | self._dirs[pc] -= 1 | |
|
178 | 184 | |
|
179 | 185 | def checkinterfering(self, files): |
|
180 | 186 | def prefixes(f): |
@@ -183,7 +189,7 b' class dirstate(object):' | |||
|
183 | 189 | seendirs = {} |
|
184 | 190 | for f in files: |
|
185 | 191 | # shadows |
|
186 | if self.dirs.get(f): | |
|
192 | if self._dirs.get(f): | |
|
187 | 193 | raise util.Abort(_('directory named %r already in dirstate') % |
|
188 | 194 | f) |
|
189 | 195 | for d in prefixes(f): |
@@ -211,10 +217,10 b' class dirstate(object):' | |||
|
211 | 217 | for f in files: |
|
212 | 218 | if state == "r": |
|
213 | 219 | self._map[f] = ('r', 0, 0, 0) |
|
214 |
self. |
|
|
220 | self._decpath(f) | |
|
215 | 221 | else: |
|
216 | 222 | if state == "a": |
|
217 |
self. |
|
|
223 | self._incpath(f) | |
|
218 | 224 | s = os.lstat(self.wjoin(f)) |
|
219 | 225 | st_size = kw.get('st_size', s.st_size) |
|
220 | 226 | st_mtime = kw.get('st_mtime', s.st_mtime) |
@@ -228,7 +234,7 b' class dirstate(object):' | |||
|
228 | 234 | for f in files: |
|
229 | 235 | try: |
|
230 | 236 | del self._map[f] |
|
231 |
self. |
|
|
237 | self._decpath(f) | |
|
232 | 238 | except KeyError: |
|
233 | 239 | self._ui.warn(_("not in dirstate: %s!\n") % f) |
|
234 | 240 | pass |
@@ -290,7 +296,7 b' class dirstate(object):' | |||
|
290 | 296 | bs += 1 |
|
291 | 297 | return ret |
|
292 | 298 | |
|
293 |
def supported |
|
|
299 | def _supported(self, f, st, verbose=False): | |
|
294 | 300 | if stat.S_ISREG(st.st_mode) or stat.S_ISLNK(st.st_mode): |
|
295 | 301 | return True |
|
296 | 302 | if verbose: |
@@ -383,7 +389,7 b' class dirstate(object):' | |||
|
383 | 389 | if imatch(np) and np in dc: |
|
384 | 390 | yield 'm', np, st |
|
385 | 391 | elif imatch(np): |
|
386 |
if self.supported |
|
|
392 | if self._supported(np, st): | |
|
387 | 393 | yield 'f', np, st |
|
388 | 394 | elif np in dc: |
|
389 | 395 | yield 'm', np, st |
@@ -421,7 +427,7 b' class dirstate(object):' | |||
|
421 | 427 | yield e |
|
422 | 428 | else: |
|
423 | 429 | if not seen(nf) and match(nf): |
|
424 |
if self.supported |
|
|
430 | if self._supported(ff, st, verbose=True): | |
|
425 | 431 | yield 'f', nf, st |
|
426 | 432 | elif ff in dc: |
|
427 | 433 | yield 'm', nf, st |
@@ -458,7 +464,7 b' class dirstate(object):' | |||
|
458 | 464 | raise |
|
459 | 465 | st = None |
|
460 | 466 | # We need to re-check that it is a valid file |
|
461 |
if st and self.supported |
|
|
467 | if st and self._supported(fn, st): | |
|
462 | 468 | nonexistent = False |
|
463 | 469 | # XXX: what to do with file no longer present in the fs |
|
464 | 470 | # who are not removed in the dirstate ? |
General Comments 0
You need to be logged in to leave comments.
Login now