Support new urls in git-cl
This adds support for the new urls (which contain the project) to
git-cl [description|checkout|issue|patch] and others.
Bug: 757602
Change-Id: I6e854a85e655e14daa7e4172ca938953778bf514
Reviewed-on: https://chromium-review.googlesource.com/634518
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
diff --git a/git_cl.py b/git_cl.py
index 58605c8..569408c 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -2835,19 +2835,19 @@
def ParseIssueURL(parsed_url):
if not parsed_url.scheme or not parsed_url.scheme.startswith('http'):
return None
- # Gerrit's new UI is https://domain/c/<issue_number>[/[patchset]]
- # But current GWT UI is https://domain/#/c/<issue_number>[/[patchset]]
+ # Gerrit's new UI is https://domain/c/project/+/<issue_number>[/[patchset]]
+ # But old GWT UI is https://domain/#/c/project/+/<issue_number>[/[patchset]]
# Short urls like https://domain/<issue_number> can be used, but don't allow
# specifying the patchset (you'd 404), but we allow that here.
if parsed_url.path == '/':
part = parsed_url.fragment
else:
part = parsed_url.path
- match = re.match('(/c)?/(\d+)(/(\d+)?/?)?$', part)
+ match = re.match('(/c(/.*/\+)?)?/(\d+)(/(\d+)?/?)?$', part)
if match:
return _ParsedIssueNumberArgument(
- issue=int(match.group(2)),
- patchset=int(match.group(4)) if match.group(4) else None,
+ issue=int(match.group(3)),
+ patchset=int(match.group(5)) if match.group(5) else None,
hostname=parsed_url.netloc,
codereview='gerrit')
return None