def main(): """Main function""" args = _parse_args() if args.gerrit: args.gerrit = normalize_gerrit_name(args.gerrit) else: try: args.gerrit = find_gerrit_name() # pylint: disable=bare-except except: print('gerrit instance not found, use [-g GERRIT]') sys.exit(1) # Query change lists url_opener = create_url_opener_from_args(args) change_lists = query_change_lists(url_opener, args.gerrit, args.query, args.limits) # Download patch files num_changes = len(change_lists) num_changes_width = len(str(num_changes)) for i, change in enumerate(change_lists, start=1): print('{:>{}}/{} | {} {}'.format(i, num_changes_width, num_changes, change['_number'], change['subject'])) patch_file = get_patch(url_opener, args.gerrit, change['id']) with open('{}.patch'.format(change['_number']), 'wb') as output_file: output_file.write(patch_file)
def main(): args = _parse_args() # Query change lists url_opener = create_url_opener_from_args(args) change_lists = query_change_lists(url_opener, args.gerrit, args.query, args.limits) # Download patch files num_changes = len(change_lists) num_changes_width = len(str(num_changes)) for i, change in enumerate(change_lists, start=1): print('{:>{}}/{} | {} {}'.format(i, num_changes_width, num_changes, change['_number'], change['subject'])) patch_file = get_patch(url_opener, args.gerrit, change['id']) with open('{}.patch'.format(change['_number']), 'wb') as output_file: output_file.write(patch_file)
def main(): args = _parse_args() # Query change lists url_opener = create_url_opener_from_args(args) change_lists = query_change_lists( url_opener, args.gerrit, args.query, args.limits) # Download patch files num_changes = len(change_lists) num_changes_width = len(str(num_changes)) for i, change in enumerate(change_lists, start=1): print('{:>{}}/{} | {} {}'.format( i, num_changes_width, num_changes, change['_number'], change['subject'])) patch_file = get_patch(url_opener, args.gerrit, change['id']) with open('{}.patch'.format(change['_number']), 'wb') as output_file: output_file.write(patch_file)