#3012: r3118 exception in browser
------------------------------------+---------------------------------------
Reporter: athomas | Owner: cboos
Type: defect | Status: assigned
Priority: high | Milestone: 0.10
Component: browser | Version: devel
Severity: major | Resolution:
Keywords: unicode browser config |
------------------------------------+---------------------------------------
Comment (by athomas):
Aha!!
1. `<type 'str'> '/home/athomas/projects/trac/env/svn'`[[BR]]
3. `<type 'str'> 'home/athomas/projects/trac/env/svn'`
Looks like `_to_svn()` is being a little too aggressive in its stripping
of slashes. The following patch seems to fix the problem:
{{{
Index: trac/versioncontrol/svn_fs.py
===================================================================
--- trac/versioncontrol/svn_fs.py (revision 3121)
+++ trac/versioncontrol/svn_fs.py (working copy)
@@ -101,7 +101,7 @@
"""Expect a list of `unicode` path components.
Returns an UTF-8 encoded string suitable for the Subversion python
bindings.
"""
- return '/'.join([path.strip('/') for path in args]).encode('utf-8')
+ return '/' + '/'.join([path.strip('/') for path in
args]).encode('utf-8')
def _from_svn(path):
"""Expect an UTF-8 encoded string and transform it to an `unicode`
object"""
@@ -265,7 +265,7 @@
# Remove any trailing slash or else subversion might abort
path = os.path.normpath(path).replace('\\', '/')
- self.path = repos.svn_repos_find_root_path(path, self.pool())
+ self.path = repos.svn_repos_find_root_path(_to_svn(path),
self.pool())
if self.path is None:
raise TracError("%s does not appear to be a Subversion
repository." \
% path)
}}}
It's not clear to me whether the same fix should be applied to
`_normalize_path()`, which also strips slashes.
And with that, I've officially doubled my knowledge of the versioncontrol
layer :)
--
Ticket URL: <http://projects.edgewall.com/trac/ticket/3012>
The Trac Project <http://trac.edgewall.com/>
_______________________________________________
Trac-Tickets mailing list
[email protected]
http://lists.edgewall.com/mailman/listinfo/trac-tickets