# HG changeset patch # User Pierre-Yves David # Date 1625185051 -7200 # Node ID 4a7df782f416017f6eb9f55772f426e51808c198 # Parent 91520abe2b2c55eb7ac0f5ffd45c94d384eb1985 dirstate: explicitely deal with the `added` case in `_addpath` This special case is now directly handled, this clarify the possible value for the other options. Differential Revision: https://phab.mercurial-scm.org/D10933 diff -r 91520abe2b2c -r 4a7df782f416 mercurial/dirstate.py --- a/mercurial/dirstate.py Fri Jul 02 02:17:18 2021 +0200 +++ b/mercurial/dirstate.py Fri Jul 02 02:17:31 2021 +0200 @@ -464,17 +464,22 @@ msg = _(b'file %r in dirstate clashes with %r') msg %= (pycompat.bytestr(d), pycompat.bytestr(f)) raise error.Abort(msg) - if from_p2: + if state == b'a': + assert not possibly_dirty + assert not from_p2 + size = NONNORMAL + mtime = AMBIGUOUS_TIME + elif from_p2: + assert not possibly_dirty size = FROM_P2 mtime = AMBIGUOUS_TIME elif possibly_dirty: mtime = AMBIGUOUS_TIME else: assert size != FROM_P2 - if size != NONNORMAL: - size = size & _rangemask - if mtime != AMBIGUOUS_TIME: - mtime = mtime & _rangemask + assert size != NONNORMAL + size = size & _rangemask + mtime = mtime & _rangemask self._dirty = True self._updatedfiles.add(f) self._map.addfile(f, oldstate, state, mode, size, mtime)