diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py --- a/mercurial/dirstate.py +++ b/mercurial/dirstate.py @@ -627,7 +627,7 @@ class dirstate(object): def _writedirstate(self, st): # use the modification time of the newly created temporary file as the # filesystem's notion of 'now' - now = util.fstat(st).st_mtime + now = util.statmtimesec(util.fstat(st)) & _rangemask st.write(parsers.pack_dirstate(self._map, self._copymap, self._pl, now)) st.close() self._lastnormaltime = 0 diff --git a/mercurial/parsers.c b/mercurial/parsers.c --- a/mercurial/parsers.c +++ b/mercurial/parsers.c @@ -551,9 +551,9 @@ static PyObject *pack_dirstate(PyObject Py_ssize_t nbytes, pos, l; PyObject *k, *v = NULL, *pn; char *p, *s; - double now; + int now; - if (!PyArg_ParseTuple(args, "O!O!Od:pack_dirstate", + if (!PyArg_ParseTuple(args, "O!O!Oi:pack_dirstate", &PyDict_Type, &map, &PyDict_Type, ©map, &pl, &now)) return NULL; @@ -622,7 +622,7 @@ static PyObject *pack_dirstate(PyObject mode = tuple->mode; size = tuple->size; mtime = tuple->mtime; - if (state == 'n' && mtime == (uint32_t)now) { + if (state == 'n' && mtime == now) { /* See pure/parsers.py:pack_dirstate for why we do * this. */ mtime = -1; diff --git a/tests/fakedirstatewritetime.py b/tests/fakedirstatewritetime.py --- a/tests/fakedirstatewritetime.py +++ b/tests/fakedirstatewritetime.py @@ -31,8 +31,7 @@ def fakewrite(ui, func): # parsing 'fakenow' in YYYYmmddHHMM format makes comparison between # 'fakenow' value and 'touch -t YYYYmmddHHMM' argument easy - timestamp = util.parsedate(fakenow, ['%Y%m%d%H%M'])[0] - fakenow = float(timestamp) + fakenow = util.parsedate(fakenow, ['%Y%m%d%H%M'])[0] orig_pack_dirstate = parsers.pack_dirstate wrapper = lambda *args: pack_dirstate(fakenow, orig_pack_dirstate, *args)