comparison mercurial/dirstate.py @ 47694:1c06ef8f5ea5

dirstate: use `reset_state` in `update_file_p1` Going through the same API is more consistent and allow us to push implementation lower down the call stack. Differential Revision: https://phab.mercurial-scm.org/D11136
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 15 Jul 2021 04:55:57 +0200
parents 46c318b9b9a4
children f98145ce78d7
comparison
equal deleted inserted replaced
47693:46c318b9b9a4 47694:1c06ef8f5ea5
519 entry = self._map.get(filename) 519 entry = self._map.get(filename)
520 if entry is None: 520 if entry is None:
521 wc_tracked = False 521 wc_tracked = False
522 else: 522 else:
523 wc_tracked = entry.tracked 523 wc_tracked = entry.tracked
524 possibly_dirty = False
524 if p1_tracked and wc_tracked: 525 if p1_tracked and wc_tracked:
525 # the underlying reference might have changed, we will have to 526 # the underlying reference might have changed, we will have to
526 # check it. 527 # check it.
527 self.normallookup(filename) 528 possibly_dirty = True
528 elif not (p1_tracked or wc_tracked): 529 elif not (p1_tracked or wc_tracked):
529 # the file is no longer relevant to anyone 530 # the file is no longer relevant to anyone
530 self._drop(filename) 531 self._drop(filename)
531 elif (not p1_tracked) and wc_tracked: 532 elif (not p1_tracked) and wc_tracked:
532 if not entry.added: 533 if entry is not None and entry.added:
533 self._add(filename) 534 return # avoid dropping copy information (maybe?)
534 elif p1_tracked and not wc_tracked: 535 elif p1_tracked and not wc_tracked:
535 if entry is None or not entry.removed: 536 pass
536 self._remove(filename)
537 else: 537 else:
538 assert False, 'unreachable' 538 assert False, 'unreachable'
539
540 # this mean we are doing call for file we do not really care about the
541 # data (eg: added or removed), however this should be a minor overhead
542 # compared to the overall update process calling this.
543 parentfiledata = None
544 if wc_tracked:
545 parentfiledata = self._get_filedata(filename)
546
547 self._updatedfiles.add(filename)
548 self._map.reset_state(
549 filename,
550 wc_tracked,
551 p1_tracked,
552 possibly_dirty=possibly_dirty,
553 parentfiledata=parentfiledata,
554 )
539 555
540 @requires_parents_change 556 @requires_parents_change
541 def update_file( 557 def update_file(
542 self, 558 self,
543 filename, 559 filename,