Mercurial > hg
comparison mercurial/dirstate.py @ 47488:91520abe2b2c
dirstate: add an explicit `possibly_dirty` parameter to `_addpath`
This lets says what we mean instead of using magic value. The lower level can
then decide how to express that.
Differential Revision: https://phab.mercurial-scm.org/D10932
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Fri, 02 Jul 2021 02:17:18 +0200 |
parents | 1f571077222d |
children | 4a7df782f416 |
comparison
equal
deleted
inserted
replaced
47487:1f571077222d | 47488:91520abe2b2c |
---|---|
444 state, | 444 state, |
445 mode, | 445 mode, |
446 size=NONNORMAL, | 446 size=NONNORMAL, |
447 mtime=AMBIGUOUS_TIME, | 447 mtime=AMBIGUOUS_TIME, |
448 from_p2=False, | 448 from_p2=False, |
449 possibly_dirty=False, | |
449 ): | 450 ): |
450 oldstate = self[f] | 451 oldstate = self[f] |
451 if state == b'a' or oldstate == b'r': | 452 if state == b'a' or oldstate == b'r': |
452 scmutil.checkfilename(f) | 453 scmutil.checkfilename(f) |
453 if self._map.hastrackeddir(f): | 454 if self._map.hastrackeddir(f): |
463 msg = _(b'file %r in dirstate clashes with %r') | 464 msg = _(b'file %r in dirstate clashes with %r') |
464 msg %= (pycompat.bytestr(d), pycompat.bytestr(f)) | 465 msg %= (pycompat.bytestr(d), pycompat.bytestr(f)) |
465 raise error.Abort(msg) | 466 raise error.Abort(msg) |
466 if from_p2: | 467 if from_p2: |
467 size = FROM_P2 | 468 size = FROM_P2 |
469 mtime = AMBIGUOUS_TIME | |
470 elif possibly_dirty: | |
468 mtime = AMBIGUOUS_TIME | 471 mtime = AMBIGUOUS_TIME |
469 else: | 472 else: |
470 assert size != FROM_P2 | 473 assert size != FROM_P2 |
471 if size != NONNORMAL: | 474 if size != NONNORMAL: |
472 size = size & _rangemask | 475 size = size & _rangemask |
520 if source: | 523 if source: |
521 self.copy(source, f) | 524 self.copy(source, f) |
522 return | 525 return |
523 if entry[0] == b'm' or entry[0] == b'n' and entry[2] == FROM_P2: | 526 if entry[0] == b'm' or entry[0] == b'n' and entry[2] == FROM_P2: |
524 return | 527 return |
525 self._addpath(f, b'n', 0) | 528 self._addpath(f, b'n', 0, possibly_dirty=True) |
526 self._map.copymap.pop(f, None) | 529 self._map.copymap.pop(f, None) |
527 | 530 |
528 def otherparent(self, f): | 531 def otherparent(self, f): |
529 '''Mark as coming from the other parent, always dirty.''' | 532 '''Mark as coming from the other parent, always dirty.''' |
530 if self._pl[1] == self._nodeconstants.nullid: | 533 if self._pl[1] == self._nodeconstants.nullid: |