diff --git a/hgext/convert/darcs.py b/hgext/convert/darcs.py --- a/hgext/convert/darcs.py +++ b/hgext/convert/darcs.py @@ -116,7 +116,8 @@ class darcs_source(converter_source, com 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 diff --git a/tests/test-convert-darcs b/tests/test-convert-darcs --- a/tests/test-convert-darcs +++ b/tests/test-convert-darcs @@ -43,7 +43,12 @@ echo % merge branch 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() diff --git a/tests/test-convert-darcs.out b/tests/test-convert-darcs.out --- a/tests/test-convert-darcs.out +++ b/tests/test-convert-darcs.out @@ -10,15 +10,20 @@ We have conflicts in the following files ./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 @@ o 0 "p0" files: a 7225b30cdf38257d5cc7780772c051b6f33e6d6b 644 a 1e88685f5ddec574a34c70af492f95b6debc8741 644 b +ef5c76581d78340f568d5f48d679bf307452cbc9 644 ff