convert/darcs: fix file renaming (issue1853)
authorPatrick Mezard <pmezard@gmail.com>
Sun, 04 Oct 2009 22:23:11 +0200
changeset 9526 457a30ed8ffb
parent 9525 2299c421a98e
child 9527 b3c13e721593
convert/darcs: fix file renaming (issue1853)
hgext/convert/darcs.py
tests/test-convert-darcs
tests/test-convert-darcs.out
--- a/hgext/convert/darcs.py	Thu Aug 06 21:35:25 2009 -0700
+++ b/hgext/convert/darcs.py	Sun Oct 04 22:23:11 2009 +0200
@@ -116,7 +116,8 @@
                 continue
             if elt.tag == 'move':
                 changes.append((elt.get('from'), rev))
-                copies[elt.get('from')] = elt.get('to')
+                changes.append((elt.get('to'), rev))
+                copies[elt.get('to')] = elt.get('from')
             else:
                 changes.append((elt.text.strip(), rev))
         self.lastrev = rev
--- a/tests/test-convert-darcs	Thu Aug 06 21:35:25 2009 -0700
+++ b/tests/test-convert-darcs	Sun Oct 04 22:23:11 2009 +0200
@@ -43,7 +43,12 @@
 darcs pull -a ../darcs-clone
 sleep 1
 echo e > a
+echo f > f
 darcs record -a -l -m p2
+
+echo % test file and directory move
+darcs mv f ff
+darcs record -a -l -m p3
 cd ..
 
 glog()
--- a/tests/test-convert-darcs.out	Thu Aug 06 21:35:25 2009 -0700
+++ b/tests/test-convert-darcs.out	Sun Oct 04 22:23:11 2009 +0200
@@ -10,15 +10,20 @@
 ./a
 Finished pulling and applying.
 Finished recording patch 'p2'
+% test file and directory move
+Finished recording patch 'p3'
 initializing destination darcs-repo-hg repository
 scanning source...
 sorting...
 converting...
-3 p0
-2 p1.2
-1 p1.1
-0 p2
-o  3 "p2" files: a
+4 p0
+3 p1.2
+2 p1.1
+1 p2
+0 p3
+o  4 "p3" files: f ff
+|
+o  3 "p2" files: a f
 |
 o  2 "p1.1" files:
 |
@@ -28,3 +33,4 @@
 
 7225b30cdf38257d5cc7780772c051b6f33e6d6b 644   a
 1e88685f5ddec574a34c70af492f95b6debc8741 644   b
+ef5c76581d78340f568d5f48d679bf307452cbc9 644   ff