diff --git a/hgext/convert/subversion.py b/hgext/convert/subversion.py --- a/hgext/convert/subversion.py +++ b/hgext/convert/subversion.py @@ -744,8 +744,7 @@ class svn_source(converter_source): pmodule, prevnum = self.revsplit(parents[0])[1:] if ent.copyfrom_rev < prevnum: continue - copyfrompath = ent.copyfrom_path.decode(self.encoding) - copyfrompath = self.getrelpath(copyfrompath, pmodule) + copyfrompath = self.getrelpath(ent.copyfrom_path, pmodule) if not copyfrompath: continue copyfrom[path] = ent @@ -757,10 +756,9 @@ class svn_source(converter_source): entrypath = self.getrelpath("/" + child, pmodule) if not entrypath: continue - entry = entrypath.decode(self.encoding) - copytopath = path + entry[len(copyfrompath):] + copytopath = path + entrypath[len(copyfrompath):] copytopath = self.getrelpath(copytopath) - copies[self.recode(copytopath)] = self.recode(entry, pmodule) + copies[self.recode(copytopath)] = self.recode(entrypath) return (list(set(entries)), copies) diff --git a/tests/svn/encoding.svndump b/tests/svn/encoding.svndump new file mode 100644 --- /dev/null +++ b/tests/svn/encoding.svndump @@ -0,0 +1,180 @@ +SVN-fs-dump-format-version: 2 + +UUID: 64cf20ed-79ff-4f10-8aaf-041d1993b42e + +Revision-number: 0 +Prop-content-length: 56 +Content-length: 56 + +K 8 +svn:date +V 27 +2009-06-21T10:05:28.031033Z +PROPS-END + +Revision-number: 1 +Prop-content-length: 112 +Content-length: 112 + +K 7 +svn:log +V 10 +init projA +K 10 +svn:author +V 7 +pmezard +K 8 +svn:date +V 27 +2009-06-21T10:05:28.108227Z +PROPS-END + +Node-path: branches +Node-kind: dir +Node-action: add +Prop-content-length: 10 +Content-length: 10 + +PROPS-END + + +Node-path: tags +Node-kind: dir +Node-action: add +Prop-content-length: 10 +Content-length: 10 + +PROPS-END + + +Node-path: trunk +Node-kind: dir +Node-action: add +Prop-content-length: 10 +Content-length: 10 + +PROPS-END + + +Revision-number: 2 +Prop-content-length: 106 +Content-length: 106 + +K 7 +svn:log +V 5 +hello +K 10 +svn:author +V 7 +pmezard +K 8 +svn:date +V 27 +2009-06-21T10:05:29.109026Z +PROPS-END + +Node-path: trunk/à +Node-kind: dir +Node-action: add +Prop-content-length: 10 +Content-length: 10 + +PROPS-END + + +Node-path: trunk/à/é +Node-kind: file +Node-action: add +Prop-content-length: 10 +Text-content-length: 2 +Text-content-md5: e29311f6f1bf1af907f9ef9f44b8328b +Text-content-sha1: e983f374794de9c64e3d1c1de1d490c0756eeeff +Content-length: 12 + +PROPS-END +d + + +Node-path: trunk/é +Node-kind: file +Node-action: add +Prop-content-length: 10 +Text-content-length: 2 +Text-content-md5: 9ffbf43126e33be52cd2bf7e01d627f9 +Text-content-sha1: 094e3afb2fe8dfe82f63731cdcd3b999f4856cff +Content-length: 12 + +PROPS-END +e + + +Revision-number: 3 +Prop-content-length: 112 +Content-length: 112 + +K 7 +svn:log +V 10 +copy files +K 10 +svn:author +V 7 +pmezard +K 8 +svn:date +V 27 +2009-06-21T10:05:32.061964Z +PROPS-END + +Node-path: trunk/è +Node-kind: file +Node-action: add +Node-copyfrom-rev: 2 +Node-copyfrom-path: trunk/é +Text-copy-source-md5: 9ffbf43126e33be52cd2bf7e01d627f9 +Text-copy-source-sha1: 094e3afb2fe8dfe82f63731cdcd3b999f4856cff + + +Node-path: trunk/ù +Node-kind: dir +Node-action: add +Node-copyfrom-rev: 2 +Node-copyfrom-path: trunk/à + + +Node-path: trunk/à +Node-action: delete + + +Node-path: trunk/é +Node-action: delete + + +Revision-number: 4 +Prop-content-length: 114 +Content-length: 114 + +K 7 +svn:log +V 12 +remove files +K 10 +svn:author +V 7 +pmezard +K 8 +svn:date +V 27 +2009-06-21T10:05:33.096353Z +PROPS-END + +Node-path: trunk/è +Node-action: delete + + +Node-path: trunk/ù +Node-action: delete + + diff --git a/tests/svn/svndump-encoding.sh b/tests/svn/svndump-encoding.sh new file mode 100755 --- /dev/null +++ b/tests/svn/svndump-encoding.sh @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- +#!/bin/sh +# +# Use this script to generate encoding.svndump +# + +mkdir temp +cd temp + +mkdir project-orig +cd project-orig +mkdir trunk +mkdir branches +mkdir tags +cd .. + +svnadmin create svn-repo +svnurl=file://`pwd`/svn-repo +svn import project-orig $svnurl -m "init projA" + +svn co $svnurl project +cd project +echo e > trunk/é +mkdir trunk/à +echo d > trunk/à/é +svn add trunk/é trunk/à +svn ci -m hello + +# Copy files and directories +svn mv trunk/é trunk/è +svn mv trunk/à trunk/ù +svn ci -m "copy files" + +# Remove files +svn rm trunk/è +svn rm trunk/ù +svn ci -m 'remove files' +cd .. + +svnadmin dump svn-repo > ../encoding.svndump diff --git a/tests/test-convert-svn-encoding b/tests/test-convert-svn-encoding new file mode 100755 --- /dev/null +++ b/tests/test-convert-svn-encoding @@ -0,0 +1,13 @@ +#!/bin/sh + +"$TESTDIR/hghave" svn svn-bindings || exit 80 + +echo "[extensions]" >> $HGRCPATH +echo "convert = " >> $HGRCPATH + +svnadmin create svn-repo +cat "$TESTDIR/svn/encoding.svndump" | svnadmin load svn-repo > /dev/null + +echo '% convert while testing all possible outputs' +hg --debug convert svn-repo A-hg > /dev/null + diff --git a/tests/test-convert-svn-encoding.out b/tests/test-convert-svn-encoding.out new file mode 100644 --- /dev/null +++ b/tests/test-convert-svn-encoding.out @@ -0,0 +1,1 @@ +% convert while testing all possible outputs