def CMDPatchWithParsedIssue(self, parsed_issue_arg, reject, nocommit, directory):
    assert (not reject)
    assert (not nocommit)
    assert (not directory)
    assert parsed_issue_arg.valid
    self._changelist.issue = parsed_issue_arg.issue
    if parsed_issue_arg.hostname:
        self._gerrit_host = parsed_issue_arg.hostname
        self._gerrit_server = ('https://%s' % self._gerrit_host)
    detail = self._GetChangeDetail(['ALL_REVISIONS'])
    if (not parsed_issue_arg.patchset):
        revision_info = detail['revisions'][detail['current_revision']]
        patchset = int(revision_info['_number'])
    else:
        patchset = parsed_issue_arg.patchset
        for revision_info in detail['revisions'].itervalues():
            if (int(revision_info['_number']) == parsed_issue_arg.patchset):
                break
        else:
            DieWithError(("Couldn't find patchset %i in issue %i" % (parsed_issue_arg.patchset, self.GetIssue())))
    fetch_info = revision_info['fetch']['http']
    RunGit(['fetch', fetch_info['url'], fetch_info['ref']])
    RunGit(['cherry-pick', 'FETCH_HEAD'])
    self.SetIssue(self.GetIssue())
    self.SetPatchset(patchset)
    print(('Committed patch for issue %i pathset %i locally' % (self.GetIssue(), self.GetPatchset())))
    return 0
def CMDPatchWithParsedIssue(self, parsed_issue_arg, reject, nocommit, directory):
    assert (not reject)
    assert (not nocommit)
    assert (not directory)
    assert parsed_issue_arg.valid
    self._changelist.issue = parsed_issue_arg.issue
    if parsed_issue_arg.hostname:
        self._gerrit_host = parsed_issue_arg.hostname
        self._gerrit_server = ('https://%s' % self._gerrit_host)
    detail = self._GetChangeDetail(['ALL_REVISIONS'])
    if (not parsed_issue_arg.patchset):
        revision_info = detail['revisions'][detail['current_revision']]
        patchset = int(revision_info['_number'])
    else:
        patchset = parsed_issue_arg.patchset
        for revision_info in detail['revisions'].itervalues():
            if (int(revision_info['_number']) == parsed_issue_arg.patchset):
                break
        else:
            DieWithError(("Couldn't find patchset %i in issue %i" % (parsed_issue_arg.patchset, self.GetIssue())))
    fetch_info = revision_info['fetch']['http']
    RunGit(['fetch', fetch_info['url'], fetch_info['ref']])
    RunGit(['cherry-pick', 'FETCH_HEAD'])
    self.SetIssue(self.GetIssue())
    self.SetPatchset(patchset)
    print(('Committed patch for issue %i pathset %i locally' % (self.GetIssue(), self.GetPatchset())))
    return 0