<br><br><div class="gmail_quote">On Wed Nov 26 2014 at 3:31:32 PM Pierre-Yves David <<a href="mailto:pierre-yves.david@ens-lyon.org">pierre-yves.david@ens-lyon.org</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"># HG changeset patch<br>
# User Pierre-Yves David <<a href="mailto:pierre-yves.david@fb.com" target="_blank">pierre-yves.david@fb.com</a>><br>
# Date 1416883376 28800<br>
#      Mon Nov 24 18:42:56 2014 -0800<br>
# Branch stable<br>
# Node ID 1866e1771d90ea39c1abc2bf677f7a<u></u>cd48bca701<br>
# Parent  82ede43751eae4b870b598326d3010<u></u>5960ce0e10<br>
rename: properly report removed and added file as modified (issue4458)<br>
<br>
The result of 'hg rm' + 'hg rename' disagreed with the one from<br>
'hg rename --force'. We align them on 'hg move --force' because it agree with<br>
what 'hg status' says after the commit.<br>
<br>
Stopping to repor modified file as added put an end to hg revert confusion in this<br>
situation (issue4458).<br>
<br>
However, reporting file as modified also prevent revert to restore the copy<br>
source. We fix this in a later changesets.<br>
<br>
Git diff also stop reporting the add in the middle of the chain as add. Not<br>
sure how important (and even wrong) it is.<br></blockquote><div><br></div><div>I think you said it's consistent with how it already appears after commit, so I agree that changing that seems like a separate problem (if we even want to change it).</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
diff --git a/mercurial/context.py b/mercurial/context.py<br>
--- a/mercurial/context.py<br>
+++ b/mercurial/context.py<br>
@@ -1335,12 +1335,14 @@ class workingctx(committablectx):<br>
             self._repo.ui.warn(_("copy failed: %s is not a file or a "<br>
                                  "symbolic link\n") % dest)<br>
         else:<br>
             wlock = self._repo.wlock()<br>
             try:<br>
-                if self._repo.dirstate[dest] in '?r':<br>
+                if self._repo.dirstate[dest] in '?':<br>
                     self._repo.dirstate.add(dest)<br>
+                elif self._repo.dirstate[dest] in 'r':<br>
+                    self._repo.dirstate.<u></u>normallookup(dest)<br>
                 self._repo.dirstate.copy(<u></u>source, dest)<br>
             finally:<br>
                 wlock.release()<br>
<br>
     def _filtersuspectsymlink(self, files):<br>
diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py<br>
--- a/mercurial/scmutil.py<br>
+++ b/mercurial/scmutil.py<br>
@@ -802,12 +802,16 @@ def dirstatecopy(ui, repo, wctx, src, ds<br>
         if repo.dirstate[origsrc] == 'a' and origsrc == src:<br>
             if not ui.quiet:<br>
                 ui.warn(_("%s has not been committed yet, so no copy "<br>
                           "data will be stored for %s.\n")<br>
                         % (repo.pathto(origsrc, cwd), repo.pathto(dst, cwd)))<br>
-            if repo.dirstate[dst] in '?r' and not dryrun:<br>
-                wctx.add([dst])<br>
+            if not dryrun:<br>
+                if repo.dirstate[dst] == '?':<br>
+                    wctx.add([dst])<br>
+                elif repo.dirstate[dst] == 'r':<br>
+                    repo.dirstate.normallookup(<u></u>dst)<br>
+<br></blockquote><div><br></div><div>Would bypassing wctx.add() and going straight to <span style="font-size:13.1999998092651px">repo.dirstate.normallookup() when the file had been previously removed be equivalent? It seems like that bypasses the warning about adding big files and odd file types. Is the thinking that that would have been already checked when the source was added? It would also bypass the repo.wlock(). I don't know if that has any effect. What's the reason for not calling wctx.add() in both cases?</span></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
         elif not dryrun:<br>
             wctx.copy(origsrc, dst)<br>
<br>
 def readrequires(opener, supported):<br>
     '''Reads and parses .hg/requires and checks if all entries found<br>
diff --git a/tests/test-mq-qrename.t b/tests/test-mq-qrename.t<br>
--- a/tests/test-mq-qrename.t<br>
+++ b/tests/test-mq-qrename.t<br>
@@ -74,12 +74,12 @@ Test overlapping renames (issue2388)<br>
   $ hg qnew patchb<br>
   $ hg ci --mq -m c1<br>
   $ hg qrename patchb patchc<br>
   $ hg qrename patcha patchb<br>
   $ hg st --mq<br>
+  M patchb<br>
   M series<br>
-  A patchb<br>
   A patchc<br>
   R patcha<br>
   $ cd ..<br>
<br>
 Test renames with mq repo (issue2097)<br>
diff --git a/tests/test-rename.t b/tests/test-rename.t<br>
--- a/tests/test-rename.t<br>
+++ b/tests/test-rename.t<br>
@@ -569,19 +569,28 @@ transitive rename --after<br>
 overwriting with renames (issue1959)<br>
<br>
   $ hg rename d1/a d1/c<br>
   $ hg rename d1/b d1/a<br>
   $ hg status -C<br>
-  A d1/a<br>
+  M d1/a<br>
     d1/b<br>
   A d1/c<br>
     d1/a<br>
   R d1/b<br>
   $ hg diff --git<br>
-  diff --git a/d1/b b/d1/a<br>
-  rename from d1/b<br>
-  rename to d1/a<br>
+  diff --git a/d1/a b/d1/a<br>
+  --- a/d1/a<br>
+  +++ b/d1/a<br>
+  @@ -1,1 +1,1 @@<br>
+  -d1/a<br>
+  +d1/b<br>
+  diff --git a/d1/b b/d1/b<br>
+  deleted file mode 100644<br>
+  --- a/d1/b<br>
+  +++ /dev/null<br>
+  @@ -1,1 +0,0 @@<br>
+  -d1/b<br>
   diff --git a/d1/a b/d1/c<br>
   copy from d1/a<br>
   copy to d1/c<br>
   $ hg update -C<br>
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved<br>
diff --git a/tests/test-status.t b/tests/test-status.t<br>
--- a/tests/test-status.t<br>
+++ b/tests/test-status.t<br>
@@ -388,5 +388,51 @@ warning message about such pattern.<br>
   $ hg --config ui.slash=false status -A --rev 1 1<br>
   R 1\2\3\4\5\b.txt<br>
 #endif<br>
<br>
   $ cd ..<br>
+<br>
+Status after move overwriting a file (issue4458)<br>
+=============================<u></u>====================<br>
+<br>
+<br>
+  $ hg init issue4458<br>
+  $ cd issue4458<br>
+  $ echo a > a<br>
+  $ echo b > b<br>
+  $ hg commit -Am base<br>
+  adding a<br>
+  adding b<br>
+<br>
+<br>
+with --force<br>
+<br>
+  $ hg mv b --force a<br>
+  $ hg st --copies<br>
+  M a<br>
+    b<br>
+  R b<br>
+  $ hg revert --all<br>
+  reverting a<br>
+  undeleting b<br>
+  $ rm *.orig<br>
+<br>
+without force<br>
+<br>
+  $ hg rm a<br>
+  $ hg st --copies<br>
+  R a<br>
+  $ hg mv b a<br>
+  $ hg st --copies<br>
+  M a<br>
+    b<br>
+  R b<br>
+<br>
+Other "bug" highlight, the revision status does not report the copy information.<br>
+This is buggy behavior.<br>
+<br>
+  $ hg commit -m 'blah'<br>
+  $ hg st --copies --change .<br>
+  M a<br>
+  R b<br>
+<br>
+  $ cd ..<br>
______________________________<u></u>_________________<br>
Mercurial-devel mailing list<br>
<a href="mailto:Mercurial-devel@selenic.com" target="_blank">Mercurial-devel@selenic.com</a><br>
<a href="http://selenic.com/mailman/listinfo/mercurial-devel" target="_blank">http://selenic.com/mailman/<u></u>listinfo/mercurial-devel</a><br>
</blockquote></div>