[git-cl] Expose Gerrit host and project

Make
  git cl issue --json=-
print Gerrit host and project as well.

Change-Id: If53d681252eaa738f044a724ee45e70df4b1eef1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2766153
Commit-Queue: Nodir Turakulov <nodir@chromium.org>
Reviewed-by: Dean Berris <dberris@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
changes/53/2766153/5
Nodir Turakulov 5 years ago committed by LUCI CQ
parent 48492322a0
commit 2737963b46

@ -3746,8 +3746,10 @@ def CMDissue(parser, args):
print('Issue number: %s (%s)' % (cl.GetIssue(), cl.GetIssueURL()))
if options.json:
write_json(options.json, {
'issue': cl.GetIssue(),
'gerrit_host': cl.GetGerritHost(),
'gerrit_project': cl.GetGerritProject(),
'issue_url': cl.GetIssueURL(),
'issue': cl.GetIssue(),
})
return 0

@ -2350,12 +2350,22 @@ class TestGitCl(unittest.TestCase):
self.mockGit.config['branch.master.gerritissue'] = '123'
self.mockGit.config['branch.master.gerritserver'] = (
'https://chromium-review.googlesource.com')
self.calls = [
(('write_json', 'output.json',
{'issue': 123,
'issue_url': 'https://chromium-review.googlesource.com/123'}),
''),
]
self.mockGit.config['remote.origin.url'] = (
'https://chromium.googlesource.com/chromium/src'
)
self.calls = [(
(
'write_json',
'output.json',
{
'issue': 123,
'issue_url': 'https://chromium-review.googlesource.com/123',
'gerrit_host': 'chromium-review.googlesource.com',
'gerrit_project': 'chromium/src',
},
),
'',
)]
self.assertEqual(0, git_cl.main(['issue', '--json', 'output.json']))
def _common_GerritCommitMsgHookCheck(self):

Loading…
Cancel
Save