diff --git a/git_cl.py b/git_cl.py index c4737f937..a98107b02 100755 --- a/git_cl.py +++ b/git_cl.py @@ -2604,28 +2604,31 @@ class _GerritChangelistImpl(_ChangelistCodereviewBase): return data['revisions'][current_rev]['commit']['message'] def UpdateDescriptionRemote(self, description, force=False): - if gerrit_util.HasPendingChangeEdit(self._GetGerritHost(), self.GetIssue()): + if gerrit_util.HasPendingChangeEdit( + self._GetGerritHost(), self._GerritChangeIdentifier()): if not force: confirm_or_exit( 'The description cannot be modified while the issue has a pending ' 'unpublished edit. Either publish the edit in the Gerrit web UI ' 'or delete it.\n\n', action='delete the unpublished edit') - gerrit_util.DeletePendingChangeEdit(self._GetGerritHost(), - self.GetIssue()) - gerrit_util.SetCommitMessage(self._GetGerritHost(), self.GetIssue(), - description, notify='NONE') + gerrit_util.DeletePendingChangeEdit( + self._GetGerritHost(), self._GerritChangeIdentifier()) + gerrit_util.SetCommitMessage( + self._GetGerritHost(), self._GerritChangeIdentifier(), + description, notify='NONE') def AddComment(self, message, publish=None): - gerrit_util.SetReview(self._GetGerritHost(), self.GetIssue(), - msg=message, ready=publish) + gerrit_util.SetReview( + self._GetGerritHost(), self._GerritChangeIdentifier(), + msg=message, ready=publish) def GetCommentsSummary(self, readable=True): # DETAILED_ACCOUNTS is to get emails in accounts. messages = self._GetChangeDetail( options=['MESSAGES', 'DETAILED_ACCOUNTS']).get('messages', []) file_comments = gerrit_util.GetChangeComments( - self._GetGerritHost(), self.GetIssue()) + self._GetGerritHost(), self._GerritChangeIdentifier()) # Build dictionary of file comments for easy access and sorting later. # {author+date: {path: {patchset: {line: url+message}}}} @@ -2691,11 +2694,13 @@ class _GerritChangelistImpl(_ChangelistCodereviewBase): return summary def CloseIssue(self): - gerrit_util.AbandonChange(self._GetGerritHost(), self.GetIssue(), msg='') + gerrit_util.AbandonChange( + self._GetGerritHost(), self._GerritChangeIdentifier(), msg='') def SubmitIssue(self, wait_for_merge=True): - gerrit_util.SubmitChange(self._GetGerritHost(), self.GetIssue(), - wait_for_merge=wait_for_merge) + gerrit_util.SubmitChange( + self._GetGerritHost(), self._GerritChangeIdentifier(), + wait_for_merge=wait_for_merge) def _GetChangeDetail(self, options=None, no_cache=False): """Returns details of associated Gerrit change and caching results. @@ -3279,8 +3284,9 @@ class _GerritChangelistImpl(_ChangelistCodereviewBase): } labels = {'Commit-Queue': vote_map[new_state]} notify = False if new_state == _CQState.DRY_RUN else None - gerrit_util.SetReview(self._GetGerritHost(), self.GetIssue(), - labels=labels, notify=notify) + gerrit_util.SetReview( + self._GetGerritHost(), self._GerritChangeIdentifier(), + labels=labels, notify=notify) def CannotTriggerTryJobReason(self): try: diff --git a/tests/git_cl_test.py b/tests/git_cl_test.py index d78a5bc7d..7addf2d7c 100755 --- a/tests/git_cl_test.py +++ b/tests/git_cl_test.py @@ -2130,7 +2130,12 @@ class TestGitCl(TestCase): ((['git', 'config', 'branch.feature.gerritissue'],), '123'), ((['git', 'config', 'branch.feature.gerritserver'],), 'https://chromium-review.googlesource.com'), - ((['SetReview', 'chromium-review.googlesource.com', 123, + ((['git', 'config', 'branch.feature.merge'],), 'refs/heads/master'), + ((['git', 'config', 'branch.feature.remote'],), 'origin'), + ((['git', 'config', 'remote.origin.url'],), + 'https://chromium.googlesource.com/infra/infra.git'), + ((['SetReview', 'chromium-review.googlesource.com', + 'infra%2Finfra~123', {'Commit-Queue': vote}, notify],), ''), ] @@ -3218,7 +3223,8 @@ class TestGitCl(TestCase): 'origin/master'), ((['git', 'config', 'remote.origin.url'],), 'https://chromium.googlesource.com/infra/infra'), - (('SetReview', 'chromium-review.googlesource.com', 10, 'msg', None), + (('SetReview', 'chromium-review.googlesource.com', 'infra%2Finfra~10', + 'msg', None), None), ] self.assertEqual(0, git_cl.main(['comment', '--gerrit', '-i', '10', @@ -3328,7 +3334,8 @@ class TestGitCl(TestCase): }, ] }), - (('GetChangeComments', 'chromium-review.googlesource.com', 1), { + (('GetChangeComments', 'chromium-review.googlesource.com', + 'infra%2Finfra~1'), { '/COMMIT_MSG': [ { 'author': {'email': u'reviewer@example.com'},