##// END OF EJS Templates
dirstate: make dirstatemap.set_untracked deal with added file...
marmoute -
r48786:5a6c1ef4 default
parent child Browse files
Show More
@@ -493,17 +493,11 b' class dirstate(object):'
493
493
494 return True the file was previously tracked, False otherwise.
494 return True the file was previously tracked, False otherwise.
495 """
495 """
496 entry = self._map.get(filename)
496 ret = self._map.set_untracked(filename)
497 if entry is None:
497 if ret:
498 return False
499 else:
500 self._dirty = True
498 self._dirty = True
501 self._updatedfiles.add(filename)
499 self._updatedfiles.add(filename)
502 if entry.added:
500 return ret
503 self._map.dropfile(filename)
504 else:
505 self._map.set_untracked(filename)
506 return True
507
501
508 @requires_no_parents_change
502 @requires_no_parents_change
509 def set_clean(self, filename, parentfiledata=None):
503 def set_clean(self, filename, parentfiledata=None):
@@ -299,14 +299,22 b' class dirstatemap(object):'
299
299
300 def set_untracked(self, f):
300 def set_untracked(self, f):
301 """Mark a file as no longer tracked in the dirstate map"""
301 """Mark a file as no longer tracked in the dirstate map"""
302 entry = self[f]
302 entry = self.get(f)
303 self._dirs_decr(f, old_entry=entry, remove_variant=True)
303 if entry is None:
304 if entry.from_p2:
304 return False
305 self.otherparentset.add(f)
305 else:
306 elif not entry.merged:
306 self._dirs_decr(f, old_entry=entry, remove_variant=not entry.added)
307 self.copymap.pop(f, None)
307 if not entry.merged:
308 entry.set_untracked()
308 self.copymap.pop(f, None)
309 self.nonnormalset.add(f)
309 if entry.added:
310 self.nonnormalset.discard(f)
311 self._map.pop(f, None)
312 else:
313 self.nonnormalset.add(f)
314 if entry.from_p2:
315 self.otherparentset.add(f)
316 entry.set_untracked()
317 return True
310
318
311 def dropfile(self, f):
319 def dropfile(self, f):
312 """
320 """
@@ -648,7 +656,16 b' if rustmod is not None:'
648 #
656 #
649 # the inner rust dirstate map code need to be adjusted once the API
657 # the inner rust dirstate map code need to be adjusted once the API
650 # for dirstate/dirstatemap/DirstateItem is a bit more settled
658 # for dirstate/dirstatemap/DirstateItem is a bit more settled
651 self._rustmap.removefile(f, in_merge=True)
659 entry = self.get(f)
660 if entry is None:
661 return False
662 else:
663 if entry.added:
664 self._rustmap.copymap().pop(f, None)
665 self._rustmap.dropfile(f)
666 else:
667 self._rustmap.removefile(f, in_merge=True)
668 return True
652
669
653 def removefile(self, *args, **kwargs):
670 def removefile(self, *args, **kwargs):
654 return self._rustmap.removefile(*args, **kwargs)
671 return self._rustmap.removefile(*args, **kwargs)
General Comments 0
You need to be logged in to leave comments. Login now