Example #1
0
 def push_patch(self, patch: Patch) -> Patch:
     self.apply_patch(patch)
     self.amend_commit()
     gerrit_output = self.push_changes()
     change_id = _parse_gerrit_patch_push(gerrit_output)
     patch.change_id = change_id
     return patch
Example #2
0
 def _push_patch(self, patch: Patch) -> Patch:
     self._apply_patch(patch)
     self._set_trailers(patch)
     gerrit_output = self._push_changes()
     change_id = _parse_gerrit_patch_push(gerrit_output)
     patch.change_id = change_id
     return patch
Example #3
0
def main():
    gerrit_git = GerritGit(git_dir='gerrit_git_dirT',
                           cookie_jar_path='gerritcookies',
                           url='http://linux.googlesource.com',
                           project='linux/kernel/git/torvalds/linux',
                           branch='master')
    gerrit_git.shallow_clone(depth=1)
    gerrit_git._git.config('http.cookiefile',
                           '../' + gerrit_git._cookie_jar_path)
    gerrit_git._git.config('user.name', 'lkml-gerrit-bridge')
    gerrit_git._git.config('user.email', '*****@*****.**')
    subprocess.run(CURL_CHANGE_ID_CMD, cwd=gerrit_git._git_dir, shell=True)
    print('Master branch cloned at ' + git('log', cwd='gerrit_git_dirT'))
    patch = archive_converter.generate_email_from_file("file.txt")
    text = 'From: {from_}\nSubject: {subject}\n\n{content}'.format(
        from_=patch.from_, subject=patch.subject, content=patch.content)
    actual_patch = Patch(message_id=patch.id,
                         text=patch.content,
                         text_with_headers=text,
                         set_index=0,
                         comments=[])
    gerrit_git.apply_patch(actual_patch)
Example #4
0
def find_and_label_revision_id(gerrit: Gerrit, patch: Patch):
    change_info = gerrit.get_change(patch.change_id)
    print(change_info)
    revision_id = change_info['current_revision']
    print(revision_id)
    patch.revision_id = revision_id
Example #5
0
def _find_and_label_revision_id(gerrit: Gerrit, patch: Patch):
    change_info = gerrit.get_change(patch.change_id)
    logging.info('Change info: %s', change_info)
    revision_id = change_info['current_revision']
    logging.info('Revision ID: %s', revision_id)
    patch.revision_id = revision_id