diff tests/test-convert-bzr-directories.t @ 15461:6ba2fc0a87ab stable

convert/bzr: correctly handle divergent nested renames (issue3089) With renames like: a -> b a/c -> a/c We were ignoring or duplicating the second one instead of leaving files unchanged or moving them to their proper destination only. To avoid this, we process the files in reverse lexicographic order, from most to least specific change, and ignore files already processed. v2: - Add a test - Change "reverse=1" into "reverse=True"
author Patrick Mezard <pmezard@gmail.com>
date Tue, 08 Nov 2011 17:08:58 +0100
parents c40b4744071a
children 3c72117a7a0e
line wrap: on
line diff
--- a/tests/test-convert-bzr-directories.t	Fri Nov 04 10:31:38 2011 +0100
+++ b/tests/test-convert-bzr-directories.t	Tue Nov 08 17:08:58 2011 +0100
@@ -149,3 +149,45 @@
   644   second/something
   644   third/dummy
   $ cd ..
+
+divergent nested renames (issue3089)
+
+  $ mkdir test-divergent-renames
+  $ cd test-divergent-renames
+  $ bzr init -q source
+  $ cd source
+  $ mkdir -p a/c
+  $ echo a > a/fa
+  $ echo c > a/c/fc
+  $ bzr add -q a
+  $ bzr commit -q -m 'Initial layout'
+  $ bzr mv a b
+  a => b
+  $ mkdir a
+  $ bzr add a
+  adding a
+  $ bzr mv b/c a/c
+  b/c => a/c
+  $ bzr status
+  added:
+    a/
+  renamed:
+    a/ => b/
+    a/c/ => a/c/
+  $ bzr commit -q -m 'Divergent renames'
+  $ cd ..
+  $ hg convert source source-hg
+  initializing destination source-hg repository
+  scanning source...
+  sorting...
+  converting...
+  1 Initial layout
+  0 Divergent renames
+  $ hg -R source-hg st -C --change 1
+  A b/fa
+    a/fa
+  R a/fa
+  $ hg -R source-hg manifest -r 1
+  a/c/fc
+  b/fa
+  $ cd ..