diff tests/test-import-git.t @ 16112:d7829b2ecf32 stable

import: handle git renames and --similarity (issue3187) There is no reason to discard copy sources from the set of files considered by addremove(). It was done to handle the case where a first patch would create 'a' and a second one would move 'a' to 'b'. If these patches were applied with --no-commit, 'a' would first be marked as added, then unlinked and dropped from the dirstate but still passed to addremove(). A better fix is thus to exclude removed files which ends being dropped from the dirstate instead of removed. Reported by Jason Harris <jason@jasonfharris.com>
author Patrick Mezard <patrick@mezard.eu>
date Thu, 16 Feb 2012 13:03:42 +0100
parents e0348815e806
children fc4e0fecf403
line wrap: on
line diff
--- a/tests/test-import-git.t	Thu Feb 16 12:56:48 2012 +0100
+++ b/tests/test-import-git.t	Thu Feb 16 13:03:42 2012 +0100
@@ -402,6 +402,23 @@
   A b
     a
   R a
+
+Renames, similarity and git diff
+
+  $ hg revert -aC
+  undeleting a
+  forgetting b
+  $ rm b
+  $ hg import --similarity 90 --no-commit - <<EOF
+  > diff --git a/a b/b
+  > rename from a
+  > rename to b
+  > EOF
+  applying patch from stdin
+  $ hg st --copies
+  A b
+    a
+  R a
   $ cd ..
 
 Pure copy with existing destination