Mercurial > hg
comparison mercurial/dirstate.py @ 48140:98b3eb6c1479
dirstate: align the dirstatemap's API to the data change
We are passing different data, so lets simplify the dirstatemap API too.
Differential Revision: https://phab.mercurial-scm.org/D11583
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Fri, 01 Oct 2021 01:27:53 +0200 |
parents | 5fc2dfb073d6 |
children | 42ab0bcb6ded |
comparison
equal
deleted
inserted
replaced
48139:ab5a7fdbf75c | 48140:98b3eb6c1479 |
---|---|
514 entry = self._map.get(filename) | 514 entry = self._map.get(filename) |
515 if entry is None: | 515 if entry is None: |
516 wc_tracked = False | 516 wc_tracked = False |
517 else: | 517 else: |
518 wc_tracked = entry.tracked | 518 wc_tracked = entry.tracked |
519 possibly_dirty = False | 519 if not (p1_tracked or wc_tracked): |
520 if p1_tracked and wc_tracked: | |
521 # the underlying reference might have changed, we will have to | |
522 # check it. | |
523 possibly_dirty = True | |
524 elif not (p1_tracked or wc_tracked): | |
525 # the file is no longer relevant to anyone | 520 # the file is no longer relevant to anyone |
526 if self._map.get(filename) is not None: | 521 if self._map.get(filename) is not None: |
527 self._map.reset_state(filename) | 522 self._map.reset_state(filename) |
528 self._dirty = True | 523 self._dirty = True |
529 elif (not p1_tracked) and wc_tracked: | 524 elif (not p1_tracked) and wc_tracked: |
530 if entry is not None and entry.added: | 525 if entry is not None and entry.added: |
531 return # avoid dropping copy information (maybe?) | 526 return # avoid dropping copy information (maybe?) |
532 elif p1_tracked and not wc_tracked: | |
533 pass | |
534 else: | |
535 assert False, 'unreachable' | |
536 | 527 |
537 # this mean we are doing call for file we do not really care about the | 528 # this mean we are doing call for file we do not really care about the |
538 # data (eg: added or removed), however this should be a minor overhead | 529 # data (eg: added or removed), however this should be a minor overhead |
539 # compared to the overall update process calling this. | 530 # compared to the overall update process calling this. |
540 parentfiledata = None | 531 parentfiledata = None |
543 | 534 |
544 self._map.reset_state( | 535 self._map.reset_state( |
545 filename, | 536 filename, |
546 wc_tracked, | 537 wc_tracked, |
547 p1_tracked, | 538 p1_tracked, |
548 possibly_dirty=possibly_dirty, | 539 # the underlying reference might have changed, we will have to |
540 # check it. | |
541 has_meaningful_mtime=False, | |
549 parentfiledata=parentfiledata, | 542 parentfiledata=parentfiledata, |
550 ) | 543 ) |
551 if ( | 544 if ( |
552 parentfiledata is not None | 545 parentfiledata is not None |
553 and parentfiledata[2] > self._lastnormaltime | 546 and parentfiledata[2] > self._lastnormaltime |
614 | 607 |
615 self._map.reset_state( | 608 self._map.reset_state( |
616 filename, | 609 filename, |
617 wc_tracked, | 610 wc_tracked, |
618 p1_tracked, | 611 p1_tracked, |
619 p2_tracked=p2_tracked, | 612 p2_info=merged or clean_p2, |
620 merged=merged, | 613 has_meaningful_mtime=not possibly_dirty, |
621 clean_p1=clean_p1, | |
622 clean_p2=clean_p2, | |
623 possibly_dirty=possibly_dirty, | |
624 parentfiledata=parentfiledata, | 614 parentfiledata=parentfiledata, |
625 ) | 615 ) |
626 if ( | 616 if ( |
627 parentfiledata is not None | 617 parentfiledata is not None |
628 and parentfiledata[2] > self._lastnormaltime | 618 and parentfiledata[2] > self._lastnormaltime |
771 else: | 761 else: |
772 self._map.reset_state( | 762 self._map.reset_state( |
773 f, | 763 f, |
774 wc_tracked=True, | 764 wc_tracked=True, |
775 p1_tracked=True, | 765 p1_tracked=True, |
776 possibly_dirty=True, | |
777 ) | 766 ) |
778 for f in to_drop: | 767 for f in to_drop: |
779 self._map.reset_state(f) | 768 self._map.reset_state(f) |
780 | 769 |
781 self._dirty = True | 770 self._dirty = True |