[PATCH] repo model: properly handle unicode Git repo paths with dulwich 0.9.9+
Mads Kiilerich
mads at kiilerich.com
Mon Mar 30 19:26:33 EDT 2015
On 03/29/2015 09:44 PM, Thomas De Schampheleire wrote:
> # HG changeset patch
> # User Thomas De Schampheleire <thomas.de.schampheleire at gmail.com>
> # Date 1427657601 -7200
> # Sun Mar 29 21:33:21 2015 +0200
> # Node ID be46b65653de6d38e208629bde1886fe31cf38c4
> # Parent 65c5e70a1d0c1861d7dc835f204d132342920da2
> repo model: properly handle unicode Git repo paths with dulwich 0.9.9+
>
> Since commit 65c5e70a1d0c bumped the dulwich requirement, following tests
> that create non-ascii Git repositories fail:
> TestAdminReposControllerGIT.test_create_non_ascii
> TestAdminReposControllerGIT.test_delete_non_ascii
>
> Using safe_unicode() instead of safe_str() to construct the repository path
> in the repo model fixes this problem for Git repositories.
>
> For Mercurial, safe_unicode() does not work and it has to be safe_str().
Thanks.
Something is wrong.
The premature bump was wrong.
This fix outside the vcs abstractions also seems wrong.
But it also seems like dulwich got an unintended regression when
introducing python3 support in 0.10. I have filed
https://github.com/jelmer/dulwich/issues/263 .
Let's stick to 0.9.9 while we investigate and make sure we get the right
fix.
/Mads
> diff --git a/kallithea/model/repo.py b/kallithea/model/repo.py
> --- a/kallithea/model/repo.py
> +++ b/kallithea/model/repo.py
> @@ -709,8 +709,11 @@
> _paths = [repo_store_location]
> else:
> _paths = [self.repos_path, new_parent_path, repo_name]
> - # we need to make it str for mercurial
> - repo_path = os.path.join(*map(lambda x: safe_str(x), _paths))
> + # we need to make it str for mercurial
> + if repo_type == 'hg':
> + repo_path = os.path.join(*map(lambda x: safe_str(x), _paths))
> + else:
> + repo_path = os.path.join(*map(lambda x: safe_unicode(x), _paths))
>
> # check if this path is not a repository
> if is_valid_repo(repo_path, self.repos_path):
> _______________________________________________
> kallithea-general mailing list
> kallithea-general at sfconservancy.org
> http://lists.sfconservancy.org/mailman/listinfo/kallithea-general
More information about the kallithea-general
mailing list