dirstate: drop `state` to `_addpath`
All its value are inferred within the dirstatemap now.
Differential Revision: https://phab.mercurial-scm.org/D10972
--- a/mercurial/dirstate.py Sun Jul 04 01:58:03 2021 +0200
+++ b/mercurial/dirstate.py Sun Jul 04 01:59:41 2021 +0200
@@ -443,7 +443,6 @@
def _addpath(
self,
f,
- state=None,
mode=0,
size=None,
mtime=None,
@@ -472,7 +471,6 @@
self._updatedfiles.add(f)
self._map.addfile(
f,
- state=state,
mode=mode,
size=size,
mtime=mtime,
@@ -499,7 +497,7 @@
mode = s.st_mode
size = s.st_size
mtime = s[stat.ST_MTIME]
- self._addpath(f, b'n', mode, size, mtime)
+ self._addpath(f, mode=mode, size=size, mtime=mtime)
self._map.copymap.pop(f, None)
if f in self._map.nonnormalset:
self._map.nonnormalset.remove(f)
--- a/mercurial/dirstatemap.py Sun Jul 04 01:58:03 2021 +0200
+++ b/mercurial/dirstatemap.py Sun Jul 04 01:59:41 2021 +0200
@@ -147,7 +147,6 @@
def addfile(
self,
f,
- state=None,
mode=0,
size=None,
mtime=None,
@@ -180,9 +179,9 @@
size = NONNORMAL
mtime = AMBIGUOUS_TIME
else:
- assert state != b'a'
assert size != FROM_P2
assert size != NONNORMAL
+ state = b'n'
size = size & rangemask
mtime = mtime & rangemask
assert state is not None
@@ -475,7 +474,6 @@
def addfile(
self,
f,
- state=None,
mode=0,
size=None,
mtime=None,
@@ -486,7 +484,6 @@
):
return self._rustmap.addfile(
f,
- state,
mode,
size,
mtime,
--- a/rust/hg-core/src/dirstate/dirstate_map.rs Sun Jul 04 01:58:03 2021 +0200
+++ b/rust/hg-core/src/dirstate/dirstate_map.rs Sun Jul 04 01:59:41 2021 +0200
@@ -99,6 +99,7 @@
entry.size = SIZE_NON_NORMAL;
entry.mtime = MTIME_UNSET;
} else {
+ entry.state = EntryState::Normal;
entry.size = entry.size & V1_RANGEMASK;
entry.mtime = entry.mtime & V1_RANGEMASK;
}
--- a/rust/hg-core/src/dirstate_tree/dirstate_map.rs Sun Jul 04 01:58:03 2021 +0200
+++ b/rust/hg-core/src/dirstate_tree/dirstate_map.rs Sun Jul 04 01:59:41 2021 +0200
@@ -750,6 +750,7 @@
entry.size = SIZE_NON_NORMAL;
entry.mtime = MTIME_UNSET;
} else {
+ entry.state = EntryState::Normal;
entry.size = entry.size & V1_RANGEMASK;
entry.mtime = entry.mtime & V1_RANGEMASK;
}
--- a/rust/hg-cpython/src/dirstate/dirstate_map.rs Sun Jul 04 01:58:03 2021 +0200
+++ b/rust/hg-cpython/src/dirstate/dirstate_map.rs Sun Jul 04 01:59:41 2021 +0200
@@ -108,7 +108,6 @@
def addfile(
&self,
f: PyObject,
- state: PyObject,
mode: PyObject,
size: PyObject,
mtime: PyObject,
@@ -119,16 +118,6 @@
) -> PyResult<PyObject> {
let f = f.extract::<PyBytes>(py)?;
let filename = HgPath::new(f.data(py));
- let state = if state.is_none(py) {
- // Arbitrary default value
- EntryState::Normal
- } else {
- state.extract::<PyBytes>(py)?.data(py)[0]
- .try_into()
- .map_err(|e: HgError| {
- PyErr::new::<exc::ValueError, _>(py, e.to_string())
- })?
- };
let mode = if mode.is_none(py) {
// fallback default value
0
@@ -148,7 +137,8 @@
mtime.extract(py)?
};
let entry = DirstateEntry {
- state: state,
+ // XXX Arbitrary default value since the value is determined later
+ state: EntryState::Normal,
mode: mode,
size: size,
mtime: mtime,