From: Jelmer Vernooij Date: Wed, 14 May 2008 19:03:14 +0000 (+0200) Subject: Fix use of unicode filenames in working tree paths. X-Git-Tag: bzr-svn-0.4.11_rc1~411 X-Git-Url: http://git.samba.org/samba.git/?p=jelmer%2Fsubvertpy.git;a=commitdiff_plain;h=87bdb4394b66c1c39ba75a0f562bfc4f93b3611e Fix use of unicode filenames in working tree paths. --- diff --git a/tree.py b/tree.py index 41dd3bad..31f58489 100644 --- a/tree.py +++ b/tree.py @@ -277,7 +277,7 @@ class SvnBasisTree(RevisionTree): self._repository = workingtree.branch.repository def add_file_to_inv(relpath, id, revid, wc): - props = svn.wc.get_prop_diffs(self.workingtree.abspath(relpath), wc) + props = svn.wc.get_prop_diffs(self.workingtree.abspath(relpath).encode("utf-8"), wc) if isinstance(props, list): # Subversion 1.5 props = props[1] if props.has_key(svn.core.SVN_PROP_SPECIAL): @@ -301,7 +301,7 @@ class SvnBasisTree(RevisionTree): if entry.schedule in (svn.wc.schedule_normal, svn.wc.schedule_delete, svn.wc.schedule_replace): - return self.id_map[workingtree.branch.unprefix(relpath)] + return self.id_map[workingtree.branch.unprefix(relpath.decode("utf-8"))] return (None, None) def add_dir_to_inv(relpath, wc, parent_id): @@ -314,16 +314,19 @@ class SvnBasisTree(RevisionTree): # First handle directory itself ie = self._inventory.add_path(relpath, 'directory', id) ie.revision = revid - if relpath == "": + if relpath == u"": self._inventory.revision_id = revid - for name in entries: - if name == "": + for name, entry in entries.items(): + name = name.decode("utf-8") + if name == u"": continue + assert isinstance(relpath, unicode) + assert isinstance(name, unicode) + subrelpath = os.path.join(relpath, name) - entry = entries[name] assert entry if entry.kind == svn.core.svn_node_dir: @@ -341,12 +344,12 @@ class SvnBasisTree(RevisionTree): wc = workingtree._get_wc() try: - add_dir_to_inv("", wc, None) + add_dir_to_inv(u"", wc, None) finally: svn.wc.adm_close(wc) def _abspath(self, relpath): - return svn.wc.get_pristine_copy_path(self.workingtree.abspath(relpath)) + return svn.wc.get_pristine_copy_path(self.workingtree.abspath(relpath).encode("utf-8")) def get_file_lines(self, file_id): base_copy = self._abspath(self.id2path(file_id)) diff --git a/workingtree.py b/workingtree.py index 5d7ba85e..0559d115 100644 --- a/workingtree.py +++ b/workingtree.py @@ -75,6 +75,7 @@ class SvnWorkingTree(WorkingTree): def __init__(self, bzrdir, local_path, branch): self._format = SvnWorkingTreeFormat() self.basedir = local_path + assert isinstance(self.basedir, unicode) self.bzrdir = bzrdir self._branch = branch self.base_revnum = 0