diff mercurial/context.py @ 23402:2963d5c9d90b stable

rename: properly report removed and added file as modified (issue4458) The result of 'hg rm' + 'hg rename' disagreed with the one from 'hg rename --force'. We align them on 'hg move --force' because it agrees with what 'hg status' says after the commit. Stopping reporting a modified file as added puts an end to the hg revert confusion in this situation (issue4458). However, reporting the file as modified also prevents revert from restoring the copy source. We fix this in a later changeset. Git diff also stop reporting the add in the middle of the chain as add. Not sure how important (and even wrong) it is.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Mon, 24 Nov 2014 18:42:56 -0800
parents fd1bab28a8cc
children b913c394386f b1179dabc6de
line wrap: on
line diff
--- a/mercurial/context.py	Wed Nov 26 14:54:16 2014 -0800
+++ b/mercurial/context.py	Mon Nov 24 18:42:56 2014 -0800
@@ -1337,8 +1337,10 @@
         else:
             wlock = self._repo.wlock()
             try:
-                if self._repo.dirstate[dest] in '?r':
+                if self._repo.dirstate[dest] in '?':
                     self._repo.dirstate.add(dest)
+                elif self._repo.dirstate[dest] in 'r':
+                    self._repo.dirstate.normallookup(dest)
                 self._repo.dirstate.copy(source, dest)
             finally:
                 wlock.release()