git cl: remove unused issue kwarg.

R=ehmaldonado

Change-Id: I5be27cb025f8237cef0186c90eb7b99d000076d9
Reviewed-on: https://chromium-review.googlesource.com/1185986
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
changes/86/1185986/3
Andrii Shyshkalov 7 years ago committed by Commit Bot
parent 29361ca11f
commit b7214602e3

@ -2493,7 +2493,6 @@ class _GerritChangelistImpl(_ChangelistCodereviewBase):
(self.GetIssue(), self.GetIssueOwner(), details['email'])) (self.GetIssue(), self.GetIssueOwner(), details['email']))
confirm_or_exit(action='upload') confirm_or_exit(action='upload')
def _PostUnsetIssueProperties(self): def _PostUnsetIssueProperties(self):
"""Which branch-specific properties to erase when unsetting issue.""" """Which branch-specific properties to erase when unsetting issue."""
return ['gerritsquashhash'] return ['gerritsquashhash']
@ -2661,15 +2660,14 @@ class _GerritChangelistImpl(_ChangelistCodereviewBase):
gerrit_util.SubmitChange(self._GetGerritHost(), self.GetIssue(), gerrit_util.SubmitChange(self._GetGerritHost(), self.GetIssue(),
wait_for_merge=wait_for_merge) wait_for_merge=wait_for_merge)
def _GetChangeDetail(self, options=None, issue=None, def _GetChangeDetail(self, options=None, no_cache=False):
no_cache=False): """Returns details of associated Gerrit change and caching results.
"""Returns details of the issue by querying Gerrit and caching results.
If fresh data is needed, set no_cache=True which will clear cache and If fresh data is needed, set no_cache=True which will clear cache and
thus new data will be fetched from Gerrit. thus new data will be fetched from Gerrit.
""" """
options = options or [] options = options or []
issue = issue or self.GetIssue() issue = self.GetIssue()
assert issue, 'issue is required to query Gerrit' assert issue, 'issue is required to query Gerrit'
# Optimization to avoid multiple RPCs: # Optimization to avoid multiple RPCs:
@ -2678,7 +2676,7 @@ class _GerritChangelistImpl(_ChangelistCodereviewBase):
options.append('CURRENT_COMMIT') options.append('CURRENT_COMMIT')
# Normalize issue and options for consistent keys in cache. # Normalize issue and options for consistent keys in cache.
issue = str(issue) issue = str(self.GetIssue())
options = [o.upper() for o in options] options = [o.upper() for o in options]
# Check in cache first unless no_cache is True. # Check in cache first unless no_cache is True.
@ -2697,8 +2695,7 @@ class _GerritChangelistImpl(_ChangelistCodereviewBase):
return data return data
try: try:
data = gerrit_util.GetChangeDetail( data = gerrit_util.GetChangeDetail(self._GetGerritHost(), issue, options)
self._GetGerritHost(), str(issue), options)
except gerrit_util.GerritError as e: except gerrit_util.GerritError as e:
if e.http_status == 404: if e.http_status == 404:
raise GerritChangeNotExists(issue, self.GetCodereviewServer()) raise GerritChangeNotExists(issue, self.GetCodereviewServer())

@ -3114,17 +3114,6 @@ class TestGitCl(TestCase):
def _mock_gerrit_changes_for_detail_cache(self): def _mock_gerrit_changes_for_detail_cache(self):
self.mock(git_cl._GerritChangelistImpl, '_GetGerritHost', lambda _: 'host') self.mock(git_cl._GerritChangelistImpl, '_GetGerritHost', lambda _: 'host')
def test_gerrit_change_detail_cache_normalize(self):
self._mock_gerrit_changes_for_detail_cache()
self.calls = [
(('GetChangeDetail', 'host', '2', ['CASE']), 'b'),
]
cl = git_cl.Changelist(codereview='gerrit')
self.assertEqual(cl._GetChangeDetail(issue=2, options=['CaSe']), 'b')
self.assertEqual(cl._GetChangeDetail(issue=2, options=['CASE']), 'b')
self.assertEqual(cl._GetChangeDetail(issue='2'), 'b')
self.assertEqual(cl._GetChangeDetail(issue=2), 'b')
def test_gerrit_change_detail_cache_simple(self): def test_gerrit_change_detail_cache_simple(self):
self._mock_gerrit_changes_for_detail_cache() self._mock_gerrit_changes_for_detail_cache()
self.calls = [ self.calls = [
@ -3132,13 +3121,14 @@ class TestGitCl(TestCase):
(('GetChangeDetail', 'host', '2', []), 'b'), (('GetChangeDetail', 'host', '2', []), 'b'),
(('GetChangeDetail', 'host', '2', []), 'b2'), (('GetChangeDetail', 'host', '2', []), 'b2'),
] ]
cl = git_cl.Changelist(issue=1, codereview='gerrit') cl1 = git_cl.Changelist(issue=1, codereview='gerrit')
self.assertEqual(cl._GetChangeDetail(), 'a') # Miss. cl2 = git_cl.Changelist(issue=2, codereview='gerrit')
self.assertEqual(cl._GetChangeDetail(), 'a') self.assertEqual(cl1._GetChangeDetail(), 'a') # Miss.
self.assertEqual(cl._GetChangeDetail(issue=2), 'b') # Miss. self.assertEqual(cl1._GetChangeDetail(), 'a')
self.assertEqual(cl._GetChangeDetail(issue=2, no_cache=True), 'b2') # Miss. self.assertEqual(cl2._GetChangeDetail(), 'b') # Miss.
self.assertEqual(cl._GetChangeDetail(), 'a') self.assertEqual(cl2._GetChangeDetail(no_cache=True), 'b2') # Miss.
self.assertEqual(cl._GetChangeDetail(issue=2), 'b2') self.assertEqual(cl1._GetChangeDetail(), 'a')
self.assertEqual(cl2._GetChangeDetail(), 'b2')
def test_gerrit_change_detail_cache_options(self): def test_gerrit_change_detail_cache_options(self):
self._mock_gerrit_changes_for_detail_cache() self._mock_gerrit_changes_for_detail_cache()

Loading…
Cancel
Save