diff options
author | Shawn O. Pearce <sop@google.com> | 2009-03-25 13:54:54 -0700 |
---|---|---|
committer | Shawn O. Pearce <sop@google.com> | 2009-03-25 13:54:54 -0700 |
commit | 13cc3844d7426d547a718946ecf365330cc0784c (patch) | |
tree | c68fbaacd9bc707f35a1b3fc3b87afa59771daa4 | |
parent | feabbdb44064888a6f0f1bf8bd0049f7162206c9 (diff) | |
download | git-repo-13cc3844d7426d547a718946ecf365330cc0784c.tar.gz |
Handle review URLs pointing directly at Gerrit
If a review URL is set to 'http://host/Gerrit' because the user
thinks that is the correct way to point repo at Gerrit, we should
be a bit more flexible and fix the URL by dropping the '/Gerrit'
suffix and replace it with '/ssh_info'.
Likewise, if a review URL points already at '/ssh_info' for a Gerrit
instance, we should leave it alone.
Signed-off-by: Shawn O. Pearce <sop@google.com>
-rw-r--r-- | git_config.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/git_config.py b/git_config.py index ed5a44a4..971d1467 100644 --- a/git_config.py +++ b/git_config.py | |||
@@ -273,9 +273,12 @@ class Remote(object): | |||
273 | u = self.review | 273 | u = self.review |
274 | if not u.startswith('http:') and not u.startswith('https:'): | 274 | if not u.startswith('http:') and not u.startswith('https:'): |
275 | u = 'http://%s' % u | 275 | u = 'http://%s' % u |
276 | if not u.endswith('/'): | 276 | if u.endswith('/Gerrit'): |
277 | u += '/' | 277 | u = u[:len(u) - len('/Gerrit')] |
278 | u += 'ssh_info' | 278 | if not u.endswith('/ssh_info'): |
279 | if not u.endswith('/'): | ||
280 | u += '/' | ||
281 | u += 'ssh_info' | ||
279 | 282 | ||
280 | try: | 283 | try: |
281 | info = urlopen(u).read() | 284 | info = urlopen(u).read() |