##// END OF EJS Templates
dirstatemap: move `reset_state` out of common methods...
Raphaël Gomès -
r49993:358b1a1e default
parent child Browse files
Show More
@@ -143,45 +143,6 b' class _dirstatemapcommon:'
143 self._refresh_entry(f, entry)
143 self._refresh_entry(f, entry)
144 return True
144 return True
145
145
146 def reset_state(
147 self,
148 filename,
149 wc_tracked=False,
150 p1_tracked=False,
151 p2_info=False,
152 has_meaningful_mtime=True,
153 parentfiledata=None,
154 ):
155 """Set a entry to a given state, diregarding all previous state
156
157 This is to be used by the part of the dirstate API dedicated to
158 adjusting the dirstate after a update/merge.
159
160 note: calling this might result to no entry existing at all if the
161 dirstate map does not see any point at having one for this file
162 anymore.
163 """
164 # copy information are now outdated
165 # (maybe new information should be in directly passed to this function)
166 self.copymap.pop(filename, None)
167
168 if not (p1_tracked or p2_info or wc_tracked):
169 old_entry = self._map.get(filename)
170 self._drop_entry(filename)
171 self._dirs_decr(filename, old_entry=old_entry)
172 return
173
174 old_entry = self._map.get(filename)
175 self._dirs_incr(filename, old_entry)
176 entry = DirstateItem(
177 wc_tracked=wc_tracked,
178 p1_tracked=p1_tracked,
179 p2_info=p2_info,
180 has_meaningful_mtime=has_meaningful_mtime,
181 parentfiledata=parentfiledata,
182 )
183 self._insert_entry(filename, entry)
184
185 ### disk interaction
146 ### disk interaction
186
147
187 def _opendirstatefile(self):
148 def _opendirstatefile(self):
@@ -513,6 +474,45 b' class dirstatemap(_dirstatemapcommon):'
513
474
514 ### code related to manipulation of entries and copy-sources
475 ### code related to manipulation of entries and copy-sources
515
476
477 def reset_state(
478 self,
479 filename,
480 wc_tracked=False,
481 p1_tracked=False,
482 p2_info=False,
483 has_meaningful_mtime=True,
484 parentfiledata=None,
485 ):
486 """Set a entry to a given state, diregarding all previous state
487
488 This is to be used by the part of the dirstate API dedicated to
489 adjusting the dirstate after a update/merge.
490
491 note: calling this might result to no entry existing at all if the
492 dirstate map does not see any point at having one for this file
493 anymore.
494 """
495 # copy information are now outdated
496 # (maybe new information should be in directly passed to this function)
497 self.copymap.pop(filename, None)
498
499 if not (p1_tracked or p2_info or wc_tracked):
500 old_entry = self._map.get(filename)
501 self._drop_entry(filename)
502 self._dirs_decr(filename, old_entry=old_entry)
503 return
504
505 old_entry = self._map.get(filename)
506 self._dirs_incr(filename, old_entry)
507 entry = DirstateItem(
508 wc_tracked=wc_tracked,
509 p1_tracked=p1_tracked,
510 p2_info=p2_info,
511 has_meaningful_mtime=has_meaningful_mtime,
512 parentfiledata=parentfiledata,
513 )
514 self._insert_entry(filename, entry)
515
516 def set_tracked(self, filename):
516 def set_tracked(self, filename):
517 new = False
517 new = False
518 entry = self.get(filename)
518 entry = self.get(filename)
@@ -724,6 +724,24 b' if rustmod is not None:'
724 def set_tracked(self, f):
724 def set_tracked(self, f):
725 return self._map.set_tracked(f)
725 return self._map.set_tracked(f)
726
726
727 def reset_state(
728 self,
729 filename,
730 wc_tracked=False,
731 p1_tracked=False,
732 p2_info=False,
733 has_meaningful_mtime=True,
734 parentfiledata=None,
735 ):
736 return self._map.reset_state(
737 filename,
738 wc_tracked,
739 p1_tracked,
740 p2_info,
741 has_meaningful_mtime,
742 parentfiledata,
743 )
744
727 def _drop_entry(self, f):
745 def _drop_entry(self, f):
728 self._map.drop_item_and_copy_source(f)
746 self._map.drop_item_and_copy_source(f)
729
747
General Comments 0
You need to be logged in to leave comments. Login now