Fix Python3 compatibility of submodule view.
Jelmer Vernooij
8 years ago
0 | from io import StringIO | |
0 | from io import BytesIO | |
1 | 1 | import os |
2 | 2 | import sys |
3 | 3 | |
81 | 81 | """Retrieve submodule URL and path.""" |
82 | 82 | submodule_blob = repo.get_blob_or_tree(commit, '.gitmodules') |
83 | 83 | config = dulwich.config.ConfigFile.from_file( |
84 | StringIO(submodule_blob.as_raw_string())) | |
85 | key = ('submodule', path) | |
86 | submodule_url = config.get(key, 'url') | |
87 | submodule_path = config.get(key, 'path') | |
84 | BytesIO(submodule_blob.as_raw_string())) | |
85 | key = (b'submodule', path) | |
86 | submodule_url = config.get(key, b'url') | |
87 | submodule_path = config.get(key, b'path') | |
88 | 88 | return (submodule_url, submodule_path) |
89 | 89 | |
90 | 90 | |
327 | 327 | 'tags': repo.get_tag_names(), |
328 | 328 | 'path': path, |
329 | 329 | 'subpaths': list(subpaths(path)) if path else None, |
330 | 'submodule_url': submodule_url, | |
331 | 'submodule_path': submodule_path, | |
332 | 'submodule_rev': submodule_rev, | |
330 | 'submodule_url': force_unicode(submodule_url), | |
331 | 'submodule_path': force_unicode(submodule_path), | |
332 | 'submodule_rev': force_unicode(submodule_rev), | |
333 | 333 | 'base_href': None, |
334 | 334 | } |
335 | 335 |