# HG changeset patch # User Pierre-Yves David # Date 1625356683 -7200 # Node ID d3cf20328abdb9b4d0000181fb1f6be782772c31 # Parent 80617f3c0f9aad33dc496c4b710230e668191f48 dirstate: infer the 'n' state from `from_p2` This flag is only used with 'n' so lets set the state based on that parameter in this case. Differential Revision: https://phab.mercurial-scm.org/D10971 diff -r 80617f3c0f9a -r d3cf20328abd mercurial/dirstate.py --- a/mercurial/dirstate.py Sun Jul 04 01:57:28 2021 +0200 +++ b/mercurial/dirstate.py Sun Jul 04 01:58:03 2021 +0200 @@ -543,7 +543,7 @@ self._addpath(f, merged=True) else: # add-like - self._addpath(f, b'n', 0, from_p2=True) + self._addpath(f, from_p2=True) self._map.copymap.pop(f, None) def add(self, f): diff -r 80617f3c0f9a -r d3cf20328abd mercurial/dirstatemap.py --- a/mercurial/dirstatemap.py Sun Jul 04 01:57:28 2021 +0200 +++ b/mercurial/dirstatemap.py Sun Jul 04 01:58:03 2021 +0200 @@ -172,6 +172,7 @@ mtime = AMBIGUOUS_TIME elif from_p2: assert not possibly_dirty + state = b'n' size = FROM_P2 mtime = AMBIGUOUS_TIME elif possibly_dirty: diff -r 80617f3c0f9a -r d3cf20328abd rust/hg-core/src/dirstate/dirstate_map.rs --- a/rust/hg-core/src/dirstate/dirstate_map.rs Sun Jul 04 01:57:28 2021 +0200 +++ b/rust/hg-core/src/dirstate/dirstate_map.rs Sun Jul 04 01:58:03 2021 +0200 @@ -91,6 +91,7 @@ entry.mtime = MTIME_UNSET; } else if from_p2 { assert!(!possibly_dirty); + entry.state = EntryState::Normal; entry.size = SIZE_FROM_OTHER_PARENT; entry.mtime = MTIME_UNSET; } else if possibly_dirty { diff -r 80617f3c0f9a -r d3cf20328abd rust/hg-core/src/dirstate_tree/dirstate_map.rs --- a/rust/hg-core/src/dirstate_tree/dirstate_map.rs Sun Jul 04 01:57:28 2021 +0200 +++ b/rust/hg-core/src/dirstate_tree/dirstate_map.rs Sun Jul 04 01:58:03 2021 +0200 @@ -742,6 +742,7 @@ entry.mtime = MTIME_UNSET; } else if from_p2 { assert!(!possibly_dirty); + entry.state = EntryState::Normal; entry.size = SIZE_FROM_OTHER_PARENT; entry.mtime = MTIME_UNSET; } else if possibly_dirty {