mercurial/dirstatemap.py
changeset 48140 98b3eb6c1479
parent 48138 38488d488ec1
child 48148 e2753a7acfa7
equal deleted inserted replaced
48139:ab5a7fdbf75c 48140:98b3eb6c1479
   171     def reset_state(
   171     def reset_state(
   172         self,
   172         self,
   173         filename,
   173         filename,
   174         wc_tracked=False,
   174         wc_tracked=False,
   175         p1_tracked=False,
   175         p1_tracked=False,
   176         p2_tracked=False,
   176         p2_info=False,
   177         merged=False,
   177         has_meaningful_mtime=True,
   178         clean_p1=False,
   178         has_meaningful_data=True,
   179         clean_p2=False,
       
   180         possibly_dirty=False,
       
   181         parentfiledata=None,
   179         parentfiledata=None,
   182     ):
   180     ):
   183         """Set a entry to a given state, diregarding all previous state
   181         """Set a entry to a given state, diregarding all previous state
   184 
   182 
   185         This is to be used by the part of the dirstate API dedicated to
   183         This is to be used by the part of the dirstate API dedicated to
   187 
   185 
   188         note: calling this might result to no entry existing at all if the
   186         note: calling this might result to no entry existing at all if the
   189         dirstate map does not see any point at having one for this file
   187         dirstate map does not see any point at having one for this file
   190         anymore.
   188         anymore.
   191         """
   189         """
   192         if merged and (clean_p1 or clean_p2):
       
   193             msg = b'`merged` argument incompatible with `clean_p1`/`clean_p2`'
       
   194             raise error.ProgrammingError(msg)
       
   195         # copy information are now outdated
   190         # copy information are now outdated
   196         # (maybe new information should be in directly passed to this function)
   191         # (maybe new information should be in directly passed to this function)
   197         self.copymap.pop(filename, None)
   192         self.copymap.pop(filename, None)
   198 
   193 
   199         if not (p1_tracked or p2_tracked or wc_tracked):
   194         if not (p1_tracked or p2_info or wc_tracked):
   200             old_entry = self._map.get(filename)
   195             old_entry = self._map.get(filename)
   201             self._drop_entry(filename)
   196             self._drop_entry(filename)
   202             self._dirs_decr(filename, old_entry=old_entry)
   197             self._dirs_decr(filename, old_entry=old_entry)
   203             return
   198             return
   204 
       
   205         p2_info = merged or clean_p2
       
   206         if merged:
       
   207             assert p1_tracked
       
   208 
       
   209         has_meaningful_mtime = not possibly_dirty
       
   210 
   199 
   211         old_entry = self._map.get(filename)
   200         old_entry = self._map.get(filename)
   212         self._dirs_incr(filename, old_entry)
   201         self._dirs_incr(filename, old_entry)
   213         entry = DirstateItem(
   202         entry = DirstateItem(
   214             wc_tracked=wc_tracked,
   203             wc_tracked=wc_tracked,