diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py --- a/mercurial/dirstate.py +++ b/mercurial/dirstate.py @@ -680,21 +680,15 @@ class dirstate(object): self.clear() self._lastnormaltime = lastnormaltime - for f in changedfiles: - mode = 0o666 - if f in allfiles and 'x' in allfiles.flags(f): - mode = 0o777 - - if f in allfiles: - self._map[f] = dirstatetuple('n', mode, -1, 0) - else: - self._map.pop(f, None) - if f in self._nonnormalset: - self._nonnormalset.remove(f) - if self._origpl is None: self._origpl = self._pl self._pl = (parent, nullid) + for f in changedfiles: + if f in allfiles: + self.normallookup(f) + else: + self.drop(f) + self._dirty = True def write(self, tr): diff --git a/tests/test-rebuildstate.t b/tests/test-rebuildstate.t --- a/tests/test-rebuildstate.t +++ b/tests/test-rebuildstate.t @@ -48,8 +48,8 @@ basic test for hg debugrebuildstate state dump after $ hg debugstate --nodates | sort - n 644 -1 set bar - n 644 -1 set foo + n 0 -1 unset bar + n 0 -1 unset foo $ hg debugadddrop --normal-lookup file1 file2 $ hg debugadddrop --drop bar @@ -57,7 +57,7 @@ state dump after $ hg debugstate --nodates n 0 -1 unset file1 n 0 -1 unset file2 - n 644 -1 set foo + n 0 -1 unset foo $ hg debugrebuildstate status @@ -115,7 +115,7 @@ dirstate $ hg debugrebuilddirstate --minimal $ hg debugdirstate --nodates r 0 0 * bar (glob) - n 644 -1 * foo (glob) + n 0 -1 * foo (glob) a 0 -1 * qux (glob) $ hg status -A A qux