mercurial/dirstate.py
changeset 47741 9f19d9f2d191
parent 47731 485ae37a7ec5
child 47742 f51aaa0f1485
equal deleted inserted replaced
47740:28d5e05c139a 47741:9f19d9f2d191
   401                 # Discard "merged" markers when moving away from a merge state
   401                 # Discard "merged" markers when moving away from a merge state
   402                 if s.merged:
   402                 if s.merged:
   403                     source = self._map.copymap.get(f)
   403                     source = self._map.copymap.get(f)
   404                     if source:
   404                     if source:
   405                         copies[f] = source
   405                         copies[f] = source
   406                     self.normallookup(f)
   406                     self._normallookup(f)
   407                 # Also fix up otherparent markers
   407                 # Also fix up otherparent markers
   408                 elif s.from_p2:
   408                 elif s.from_p2:
   409                     source = self._map.copymap.get(f)
   409                     source = self._map.copymap.get(f)
   410                     if source:
   410                     if source:
   411                         copies[f] = source
   411                         copies[f] = source
   474         entry = self._map.get(filename)
   474         entry = self._map.get(filename)
   475         if entry is None:
   475         if entry is None:
   476             self._add(filename)
   476             self._add(filename)
   477             return True
   477             return True
   478         elif not entry.tracked:
   478         elif not entry.tracked:
   479             self.normallookup(filename)
   479             self._normallookup(filename)
   480             return True
   480             return True
   481         # XXX This is probably overkill for more case, but we need this to
   481         # XXX This is probably overkill for more case, but we need this to
   482         # fully replace the `normallookup` call with `set_tracked` one.
   482         # fully replace the `normallookup` call with `set_tracked` one.
   483         # Consider smoothing this in the future.
   483         # Consider smoothing this in the future.
   484         self.set_possibly_dirty(filename)
   484         self.set_possibly_dirty(filename)
   744             # modifications that happen within the same timeslot.
   744             # modifications that happen within the same timeslot.
   745             self._lastnormaltime = mtime
   745             self._lastnormaltime = mtime
   746 
   746 
   747     def normallookup(self, f):
   747     def normallookup(self, f):
   748         '''Mark a file normal, but possibly dirty.'''
   748         '''Mark a file normal, but possibly dirty.'''
       
   749         if self.pendingparentchange():
       
   750             util.nouideprecwarn(
       
   751                 b"do not use `normallookup` inside of update/merge context."
       
   752                 b" Use `update_file` or `update_file_p1`",
       
   753                 b'6.0',
       
   754                 stacklevel=2,
       
   755             )
       
   756         else:
       
   757             util.nouideprecwarn(
       
   758                 b"do not use `normallookup` outside of update/merge context."
       
   759                 b" Use `set_possibly_dirty` or `set_tracked`",
       
   760                 b'6.0',
       
   761                 stacklevel=2,
       
   762             )
       
   763         self._normallookup(f)
       
   764 
       
   765     def _normallookup(self, f):
       
   766         '''Mark a file normal, but possibly dirty.'''
   749         if self.in_merge:
   767         if self.in_merge:
   750             # if there is a merge going on and the file was either
   768             # if there is a merge going on and the file was either
   751             # "merged" or coming from other parent (-2) before
   769             # "merged" or coming from other parent (-2) before
   752             # being removed, restore that state.
   770             # being removed, restore that state.
   753             entry = self._map.get(f)
   771             entry = self._map.get(f)
   823         self._map.removefile(filename, in_merge=self.in_merge)
   841         self._map.removefile(filename, in_merge=self.in_merge)
   824 
   842 
   825     def merge(self, f):
   843     def merge(self, f):
   826         '''Mark a file merged.'''
   844         '''Mark a file merged.'''
   827         if not self.in_merge:
   845         if not self.in_merge:
   828             return self.normallookup(f)
   846             return self._normallookup(f)
   829         return self.otherparent(f)
   847         return self.otherparent(f)
   830 
   848 
   831     def drop(self, f):
   849     def drop(self, f):
   832         '''Drop a file from the dirstate'''
   850         '''Drop a file from the dirstate'''
   833         if not self.pendingparentchange():
   851         if not self.pendingparentchange():
   954         if self._origpl is None:
   972         if self._origpl is None:
   955             self._origpl = self._pl
   973             self._origpl = self._pl
   956         self._map.setparents(parent, self._nodeconstants.nullid)
   974         self._map.setparents(parent, self._nodeconstants.nullid)
   957 
   975 
   958         for f in to_lookup:
   976         for f in to_lookup:
   959             self.normallookup(f)
   977             self._normallookup(f)
   960         for f in to_drop:
   978         for f in to_drop:
   961             self._drop(f)
   979             self._drop(f)
   962 
   980 
   963         self._dirty = True
   981         self._dirty = True
   964 
   982