diff options
author | Thierry Reding <treding@nvidia.com> | 2023-09-01 12:28:31 +0200 |
---|---|---|
committer | Thierry Reding <treding@nvidia.com> | 2023-09-01 12:28:58 +0200 |
commit | 749878cdc6c5a9171298f169cbc26d541c59ac04 (patch) | |
tree | 3c6942abdda2203c06b97c1d50749c22f1e1bb96 | |
parent | b9e6d7e7c44f091500999e50130759c2f90df676 (diff) | |
download | maint-scripts-749878cdc6c5a9171298f169cbc26d541c59ac04.tar.gz |
tms: Allow proper branch filtering for tag and request-pull
Previously the tag and request-pull commands matched the branch names
specified on the command-line against the top-level branch, which isn't
really useful since we usually only have one of them.
Push down the filter into the individual branch operations so that
branches can be filtered out more fine-grainedly.
Signed-off-by: Thierry Reding <treding@nvidia.com>
-rwxr-xr-x | tms | 24 |
1 files changed, 12 insertions, 12 deletions
@@ -539,7 +539,7 @@ class Branch: if status != 0: sys.exit(status) - def request_pull(self, repo, targets = None, iteration = 1, dry_run = False): + def request_pull(self, repo, targets = None, branches = None, iteration = 1, dry_run = False): git_config = repo.config_reader() config = read_dotconfig() buckets = {} @@ -549,6 +549,9 @@ class Branch: if targets and branch.target.name not in targets: continue + if branches and branch.name not in branches: + continue + if branch.target not in buckets: buckets[branch.target] = [ ] @@ -649,12 +652,15 @@ class Branch: with io.open(filename, 'w') as output: print(message, file = output, end = '') - def tag(self, repo, prefix, targets = None, iteration = 1, dry_run = False): + def tag(self, repo, prefix, targets = None, branches = None, iteration = 1, dry_run = False): for branch in self.branches: if branch.target and not branch.merged: if targets and branch.target.name not in targets: continue + if branches and branch.name not in branches: + continue + if prefix is None: tag_prefix = branch.target.prefix else: @@ -1002,12 +1008,9 @@ class CommandRequestPull(Command): tree = load_tree() for branch in tree: - if args.branches and branch.name not in args.branches: - continue - print('request-pull for %s...' % branch) - branch.request_pull(repo, targets = args.targets, iteration = args.iteration, - dry_run = args.dry_run) + branch.request_pull(repo, targets = args.targets, branches = args.branches, + iteration = args.iteration, dry_run = args.dry_run) class CommandTag(Command): name = 'tag' @@ -1035,12 +1038,9 @@ class CommandTag(Command): tree = load_tree() for branch in tree: - if args.branches and branch.name not in args.branches: - continue - print('tagging branch %s...' % branch) - branch.tag(repo, args.prefix, targets = args.targets, iteration = args.iteration, - dry_run = args.dry_run) + branch.tag(repo, args.prefix, targets = args.targets, branches = args.branches, + iteration = args.iteration, dry_run = args.dry_run) commands = [ CommandBuild, |