| #!/usr/bin/python3 |
| # SPDX-License-Identifier: GPL-2.0-or-later |
| # Copyright 2023 Google LLC |
| |
| import argparse |
| |
| from stable_utils import * |
| |
| parser = argparse.ArgumentParser( |
| formatter_class=argparse.RawDescriptionHelpFormatter, |
| description= |
| """Finds the original patch series from a git commit. Uses the message ID from |
| the commit message if possible, otherwise falls back to a search of |
| lore.kernel.org by commit title.""") |
| parser.add_argument('commit_id') |
| args = parse_args(parser) |
| |
| commit = Commit(args.commit_id) |
| message_id = commit.find_original_email() |
| if not message_id: |
| error(f'Cannot find original patch for {commit}') |
| patches = find_patches_in_same_series(message_id) |
| if not patches: |
| error(f'Cannot find original series for {commit}') |
| |
| if patches[0]: |
| print(patches[0]) |
| for patch in patches[1:]: |
| print(patch) |