Correct project source guessing for OpenStack
The links to the project source in all the developer docs are
incorrect. The link for keystone is like
http://git.openstack.org/cgit/p/openstack/keystone
when it should be
http://git.openstack.org/cgit/openstack/keystone
See the link to "Project Source" on the left on
http://docs.openstack.org/developer/keystone/ for example.
Also, developers sometimes use a ".git" URL when they clone so
strip off the .git.
Change-Id: I8e7620119a169e3322d602ea633303cf9f941605
Brant Knudson
8 years ago
12 | 12 | # under the License. |
13 | 13 | |
14 | 14 | import os |
15 | import re | |
15 | 16 | import six |
16 | 17 | from six.moves.urllib import parse |
17 | 18 | import subprocess |
32 | 33 | if six.PY3: |
33 | 34 | git_remote = os.fsdecode(git_remote) |
34 | 35 | parsed = parse.urlparse(git_remote) |
35 | return CGIT_BASE + parsed.path.lstrip('/') | |
36 | parsed = '/'.join(parsed.path.rstrip('/').split('/')[-2:]) | |
37 | parsed = re.sub(r'\.git$', '', parsed) | |
38 | return CGIT_BASE + parsed | |
36 | 39 | |
37 | 40 | |
38 | 41 | def _html_page_context(app, pagename, templatename, context, doctree): |