Commit 01b91069 authored by Aaron Gable's avatar Aaron Gable Committed by Commit Bot

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: 's avatarAndrii Shyshkalov <tandrii@chromium.org>
parent 77962551
...@@ -2835,19 +2835,19 @@ class _GerritChangelistImpl(_ChangelistCodereviewBase): ...@@ -2835,19 +2835,19 @@ class _GerritChangelistImpl(_ChangelistCodereviewBase):
def ParseIssueURL(parsed_url): def ParseIssueURL(parsed_url):
if not parsed_url.scheme or not parsed_url.scheme.startswith('http'): if not parsed_url.scheme or not parsed_url.scheme.startswith('http'):
return None return None
# Gerrit's new UI is https://domain/c/<issue_number>[/[patchset]] # Gerrit's new UI is https://domain/c/project/+/<issue_number>[/[patchset]]
# But current GWT UI is https://domain/#/c/<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 # 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. # specifying the patchset (you'd 404), but we allow that here.
if parsed_url.path == '/': if parsed_url.path == '/':
part = parsed_url.fragment part = parsed_url.fragment
else: else:
part = parsed_url.path part = parsed_url.path
match = re.match('(/c)?/(\d+)(/(\d+)?/?)?$', part) match = re.match('(/c(/.*/\+)?)?/(\d+)(/(\d+)?/?)?$', part)
if match: if match:
return _ParsedIssueNumberArgument( return _ParsedIssueNumberArgument(
issue=int(match.group(2)), issue=int(match.group(3)),
patchset=int(match.group(4)) if match.group(4) else None, patchset=int(match.group(5)) if match.group(5) else None,
hostname=parsed_url.netloc, hostname=parsed_url.netloc,
codereview='gerrit') codereview='gerrit')
return None return None
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment