##// END OF EJS Templates
dirstatemap: use a common implementation for `dirstatemap.set_untracked`...
marmoute -
r48939:ced8cf9c default
parent child Browse files
Show More
@@ -101,6 +101,21 b' class _dirstatemapcommon(object):'
101 def _refresh_entry(self, f, entry):
101 def _refresh_entry(self, f, entry):
102 """record updated state of an entry"""
102 """record updated state of an entry"""
103
103
104 ### method to manipulate the entries
105
106 def set_untracked(self, f):
107 """Mark a file as no longer tracked in the dirstate map"""
108 entry = self.get(f)
109 if entry is None:
110 return False
111 else:
112 self._dirs_decr(f, old_entry=entry, remove_variant=not entry.added)
113 if not entry.merged:
114 self.copymap.pop(f, None)
115 entry.set_untracked()
116 self._refresh_entry(f, entry)
117 return True
118
104
119
105 class dirstatemap(_dirstatemapcommon):
120 class dirstatemap(_dirstatemapcommon):
106 """Map encapsulating the dirstate's contents.
121 """Map encapsulating the dirstate's contents.
@@ -496,20 +511,6 b' class dirstatemap(_dirstatemapcommon):'
496 self.set_possibly_dirty(filename)
511 self.set_possibly_dirty(filename)
497 return new
512 return new
498
513
499 def set_untracked(self, f):
500 """Mark a file as no longer tracked in the dirstate map"""
501 entry = self.get(f)
502 if entry is None:
503 return False
504 else:
505 self._dirs_decr(f, old_entry=entry, remove_variant=not entry.added)
506 if not entry.merged:
507 self.copymap.pop(f, None)
508 entry.set_untracked()
509 if not entry.any_tracked:
510 self._map.pop(f, None)
511 return True
512
513
514
514 if rustmod is not None:
515 if rustmod is not None:
515
516
@@ -898,22 +899,6 b' if rustmod is not None:'
898 self.set_possibly_dirty(filename)
899 self.set_possibly_dirty(filename)
899 return new
900 return new
900
901
901 def set_untracked(self, f):
902 """Mark a file as no longer tracked in the dirstate map"""
903 # in merge is only trigger more logic, so it "fine" to pass it.
904 #
905 # the inner rust dirstate map code need to be adjusted once the API
906 # for dirstate/dirstatemap/DirstateItem is a bit more settled
907 entry = self.get(f)
908 if entry is None:
909 return False
910 else:
911 if entry.added:
912 self._map.drop_item_and_copy_source(f)
913 else:
914 self._map.removefile(f, in_merge=True)
915 return True
916
917 ### Legacy method we need to get rid of
902 ### Legacy method we need to get rid of
918
903
919 def addfile(
904 def addfile(
General Comments 0
You need to be logged in to leave comments. Login now