Show More
@@ -387,9 +387,6 b' class dirstate(object):' | |||||
387 | return self._map.copymap |
|
387 | return self._map.copymap | |
388 |
|
388 | |||
389 | def _droppath(self, f): |
|
389 | def _droppath(self, f): | |
390 | if self[f] not in "?r" and "dirs" in self._map.__dict__: |
|
|||
391 | self._map.dirs.delpath(f) |
|
|||
392 |
|
||||
393 | if "filefoldmap" in self._map.__dict__: |
|
390 | if "filefoldmap" in self._map.__dict__: | |
394 | normed = util.normcase(f) |
|
391 | normed = util.normcase(f) | |
395 | if normed in self._map.filefoldmap: |
|
392 | if normed in self._map.filefoldmap: | |
@@ -411,11 +408,9 b' class dirstate(object):' | |||||
411 | if entry is not None and entry[0] != 'r': |
|
408 | if entry is not None and entry[0] != 'r': | |
412 | raise error.Abort( |
|
409 | raise error.Abort( | |
413 | _('file %r in dirstate clashes with %r') % (d, f)) |
|
410 | _('file %r in dirstate clashes with %r') % (d, f)) | |
414 | if oldstate in "?r" and "dirs" in self._map.__dict__: |
|
|||
415 | self._map.dirs.addpath(f) |
|
|||
416 | self._dirty = True |
|
411 | self._dirty = True | |
417 | self._updatedfiles.add(f) |
|
412 | self._updatedfiles.add(f) | |
418 | self._map.addfile(f, state, mode, size, mtime) |
|
413 | self._map.addfile(f, oldstate, state, mode, size, mtime) | |
419 |
|
414 | |||
420 | def normal(self, f): |
|
415 | def normal(self, f): | |
421 | '''Mark a file normal and clean.''' |
|
416 | '''Mark a file normal and clean.''' | |
@@ -476,6 +471,7 b' class dirstate(object):' | |||||
476 | '''Mark a file removed.''' |
|
471 | '''Mark a file removed.''' | |
477 | self._dirty = True |
|
472 | self._dirty = True | |
478 | self._droppath(f) |
|
473 | self._droppath(f) | |
|
474 | oldstate = self[f] | |||
479 | size = 0 |
|
475 | size = 0 | |
480 | if self._pl[1] != nullid: |
|
476 | if self._pl[1] != nullid: | |
481 | entry = self._map.get(f) |
|
477 | entry = self._map.get(f) | |
@@ -486,7 +482,7 b' class dirstate(object):' | |||||
486 | elif entry[0] == 'n' and entry[2] == -2: # other parent |
|
482 | elif entry[0] == 'n' and entry[2] == -2: # other parent | |
487 | size = -2 |
|
483 | size = -2 | |
488 | self._map.otherparentset.add(f) |
|
484 | self._map.otherparentset.add(f) | |
489 | self._map.removefile(f, size) |
|
485 | self._map.removefile(f, oldstate, size) | |
490 | if size == 0: |
|
486 | if size == 0: | |
491 | self._map.copymap.pop(f, None) |
|
487 | self._map.copymap.pop(f, None) | |
492 |
|
488 | |||
@@ -498,7 +494,8 b' class dirstate(object):' | |||||
498 |
|
494 | |||
499 | def drop(self, f): |
|
495 | def drop(self, f): | |
500 | '''Drop a file from the dirstate''' |
|
496 | '''Drop a file from the dirstate''' | |
501 | if self._map.dropfile(f): |
|
497 | oldstate = self[f] | |
|
498 | if self._map.dropfile(f, oldstate): | |||
502 | self._dirty = True |
|
499 | self._dirty = True | |
503 | self._droppath(f) |
|
500 | self._droppath(f) | |
504 | self._map.copymap.pop(f, None) |
|
501 | self._map.copymap.pop(f, None) | |
@@ -1217,8 +1214,8 b' class dirstatemap(object):' | |||||
1217 | - `dirfoldmap` is a dict mapping normalized directory names to the |
|
1214 | - `dirfoldmap` is a dict mapping normalized directory names to the | |
1218 | denormalized form that they appear as in the dirstate. |
|
1215 | denormalized form that they appear as in the dirstate. | |
1219 |
|
1216 | |||
1220 |
Once instantiated, the |
|
1217 | Once instantiated, the filefoldmap and dirfoldmap views must be maintained | |
1221 |
|
|
1218 | by the caller. | |
1222 | """ |
|
1219 | """ | |
1223 |
|
1220 | |||
1224 | def __init__(self, ui, opener, root): |
|
1221 | def __init__(self, ui, opener, root): | |
@@ -1280,15 +1277,17 b' class dirstatemap(object):' | |||||
1280 | """Loads the underlying data, if it's not already loaded""" |
|
1277 | """Loads the underlying data, if it's not already loaded""" | |
1281 | self._map |
|
1278 | self._map | |
1282 |
|
1279 | |||
1283 | def addfile(self, f, state, mode, size, mtime): |
|
1280 | def addfile(self, f, oldstate, state, mode, size, mtime): | |
1284 | """Add a tracked file to the dirstate.""" |
|
1281 | """Add a tracked file to the dirstate.""" | |
|
1282 | if oldstate in "?r" and "dirs" in self.__dict__: | |||
|
1283 | self.dirs.addpath(f) | |||
1285 | self._map[f] = dirstatetuple(state, mode, size, mtime) |
|
1284 | self._map[f] = dirstatetuple(state, mode, size, mtime) | |
1286 | if state != 'n' or mtime == -1: |
|
1285 | if state != 'n' or mtime == -1: | |
1287 | self.nonnormalset.add(f) |
|
1286 | self.nonnormalset.add(f) | |
1288 | if size == -2: |
|
1287 | if size == -2: | |
1289 | self.otherparentset.add(f) |
|
1288 | self.otherparentset.add(f) | |
1290 |
|
1289 | |||
1291 | def removefile(self, f, size): |
|
1290 | def removefile(self, f, oldstate, size): | |
1292 | """ |
|
1291 | """ | |
1293 | Mark a file as removed in the dirstate. |
|
1292 | Mark a file as removed in the dirstate. | |
1294 |
|
1293 | |||
@@ -1296,15 +1295,20 b' class dirstatemap(object):' | |||||
1296 | the file's previous state. In the future, we should refactor this |
|
1295 | the file's previous state. In the future, we should refactor this | |
1297 | to be more explicit about what that state is. |
|
1296 | to be more explicit about what that state is. | |
1298 | """ |
|
1297 | """ | |
|
1298 | if oldstate not in "?r" and "dirs" in self.__dict__: | |||
|
1299 | self.dirs.delpath(f) | |||
1299 | self._map[f] = dirstatetuple('r', 0, size, 0) |
|
1300 | self._map[f] = dirstatetuple('r', 0, size, 0) | |
1300 | self.nonnormalset.add(f) |
|
1301 | self.nonnormalset.add(f) | |
1301 |
|
1302 | |||
1302 | def dropfile(self, f): |
|
1303 | def dropfile(self, f, oldstate): | |
1303 | """ |
|
1304 | """ | |
1304 | Remove a file from the dirstate. Returns True if the file was |
|
1305 | Remove a file from the dirstate. Returns True if the file was | |
1305 | previously recorded. |
|
1306 | previously recorded. | |
1306 | """ |
|
1307 | """ | |
1307 | exists = self._map.pop(f, None) is not None |
|
1308 | exists = self._map.pop(f, None) is not None | |
|
1309 | if exists: | |||
|
1310 | if oldstate != "r" and "dirs" in self.__dict__: | |||
|
1311 | self.dirs.delpath(f) | |||
1308 | self.nonnormalset.discard(f) |
|
1312 | self.nonnormalset.discard(f) | |
1309 | return exists |
|
1313 | return exists | |
1310 |
|
1314 |
General Comments 0
You need to be logged in to leave comments.
Login now