tests/test-convert-git.t
changeset 22470 8e0c4df28eec
parent 22413 3cb0318bb2dd
child 22471 cc5f94db672b
--- a/tests/test-convert-git.t	Thu Sep 11 23:57:49 2014 -0700
+++ b/tests/test-convert-git.t	Fri Sep 12 11:23:26 2014 -0700
@@ -241,8 +241,45 @@
   9277c9cc8dd4576fc01a17939b4351e5ada93466 644   foo
   88dfeab657e8cf2cef3dec67b914f49791ae76b1 644   quux
 
+test importing git renames and copies
+
+  $ cd git-repo2
+  $ git mv foo foo-renamed
+since bar is not touched in this commit, this copy will not be detected
+  $ cp bar bar-copied
+  $ cp baz baz-copied
+  $ cp baz baz-copied2
+  $ echo baz2 >> baz
+  $ git add bar-copied baz-copied baz-copied2
+  $ commit -a -m 'rename and copy'
+  $ cd ..
+
+input validation
+  $ hg convert --config convert.git.similarity=foo --datesort git-repo2 fullrepo
+  abort: convert.git.similarity must be a number
+  [255]
+  $ hg convert --config convert.git.similarity=-1 --datesort git-repo2 fullrepo
+  abort: similarity must be between 0 and 100
+  [255]
+  $ hg convert --config convert.git.similarity=101 --datesort git-repo2 fullrepo
+  abort: similarity must be between 0 and 100
+  [255]
+
+  $ hg -q convert --config convert.git.similarity=100 --datesort git-repo2 fullrepo
+  $ hg -R fullrepo status -C --change master
+  M baz
+  A bar-copied
+  A baz-copied
+    baz
+  A baz-copied2
+    baz
+  A foo-renamed
+    foo
+  R foo
+
 test binary conversion (issue1359)
 
+  $ count=19
   $ mkdir git-repo3
   $ cd git-repo3
   $ git init-db >/dev/null 2>/dev/null
@@ -398,6 +435,29 @@
 
   $ cd ../..
 
+make sure rename detection doesn't break removing and adding gitmodules
+
+  $ cd git-repo6
+  $ git mv .gitmodules .gitmodules-renamed
+  $ commit -a -m 'rename .gitmodules'
+  $ git mv .gitmodules-renamed .gitmodules
+  $ commit -a -m 'rename .gitmodules back'
+  $ cd ..
+
+  $ hg --config convert.git.similarity=100 convert -q git-repo6 git-repo6-hg
+  $ hg -R git-repo6-hg log -r 'tip^' -T "{desc|firstline}\n"
+  rename .gitmodules
+  $ hg -R git-repo6-hg status -C --change 'tip^'
+  A .gitmodules-renamed
+  R .hgsub
+  R .hgsubstate
+  $ hg -R git-repo6-hg log -r tip -T "{desc|firstline}\n"
+  rename .gitmodules back
+  $ hg -R git-repo6-hg status -C --change tip
+  A .hgsub
+  A .hgsubstate
+  R .gitmodules-renamed
+
 convert the revision removing '.gitmodules' itself (and related
 submodules)