Add comments option to query

This commit adds a new option to the query function for returning
comments for the commit.

Change-Id: I67d52f64a92cedc8ca449f0e54c2d1da2766c0a2
This commit is contained in:
Matthew Treinish 2013-09-19 11:02:14 -04:00
parent e652bf2a60
commit 139c168bb3
1 changed files with 11 additions and 4 deletions

View File

@ -145,12 +145,19 @@ class Gerrit(object):
out, err = self._ssh(cmd)
return err
def query(self, change, commit_msg=False):
def query(self, change, commit_msg=False, comments=False):
if commit_msg:
cmd = 'gerrit query --format json --commit-message %s"' % (
change)
if comments:
cmd = ('gerrit query --format json --commit-message --comments'
' %s"' % change)
else:
cmd = 'gerrit query --format json --commit-message %s"' % (
change)
else:
cmd = 'gerrit query --format json %s"' % (change)
if comments:
cmd = 'gerrit query --format json --comments %s"' % (change)
else:
cmd = 'gerrit query --format json %s"' % (change)
out, err = self._ssh(cmd)
if not out:
return False