git cl: use project~change_number when querying Gerrit for change Info.
R=ehmaldonado
Bug: 876910
Change-Id: I218a8198d06e51ac2eb57636bbccca9aadc7d81a
Reviewed-on: https://chromium-review.googlesource.com/1194312
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
diff --git a/git_cl.py b/git_cl.py
index b92cae1..c4737f9 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -2704,8 +2704,7 @@
thus new data will be fetched from Gerrit.
"""
options = options or []
- issue = self.GetIssue()
- assert issue, 'issue is required to query Gerrit'
+ assert self.GetIssue(), 'issue is required to query Gerrit'
# Optimization to avoid multiple RPCs:
if (('CURRENT_REVISION' in options or 'ALL_REVISIONS' in options) and
@@ -2713,15 +2712,15 @@
options.append('CURRENT_COMMIT')
# Normalize issue and options for consistent keys in cache.
- issue = str(self.GetIssue())
+ cache_key = str(self.GetIssue())
options = [o.upper() for o in options]
# Check in cache first unless no_cache is True.
if no_cache:
- self._detail_cache.pop(issue, None)
+ self._detail_cache.pop(cache_key, None)
else:
options_set = frozenset(options)
- for cached_options_set, data in self._detail_cache.get(issue, []):
+ for cached_options_set, data in self._detail_cache.get(cache_key, []):
# Assumption: data fetched before with extra options is suitable
# for return for a smaller set of options.
# For example, if we cached data for
@@ -2732,13 +2731,15 @@
return data
try:
- data = gerrit_util.GetChangeDetail(self._GetGerritHost(), issue, options)
+ data = gerrit_util.GetChangeDetail(
+ self._GetGerritHost(), self._GerritChangeIdentifier(), options)
except gerrit_util.GerritError as e:
if e.http_status == 404:
- raise GerritChangeNotExists(issue, self.GetCodereviewServer())
+ raise GerritChangeNotExists(self.GetIssue(), self.GetCodereviewServer())
raise
- self._detail_cache.setdefault(issue, []).append((frozenset(options), data))
+ self._detail_cache.setdefault(cache_key, []).append(
+ (frozenset(options), data))
return data
def _GetChangeCommit(self):