diff --git a/subcmds/abandon.py b/subcmds/abandon.py index 1f687f53..4036f306 100644 --- a/subcmds/abandon.py +++ b/subcmds/abandon.py @@ -48,9 +48,15 @@ It is equivalent to "git branch -D ". self.Usage() if not opt.all: - nb = args[0] - if not git.check_ref_format("heads/%s" % nb): - self.OptionParser.error("'%s' is not a valid branch name" % nb) + branches = args[0].split() + invalid_branches = [ + x for x in branches if not git.check_ref_format(f"heads/{x}") + ] + + if invalid_branches: + self.OptionParser.error( + f"{invalid_branches} are not valid branch names" + ) else: args.insert(0, "'All local branches'") @@ -59,7 +65,7 @@ It is equivalent to "git branch -D ". if all_branches: branches = project.GetBranches() else: - branches = [nb] + branches = nb ret = {} for name in branches: @@ -69,7 +75,7 @@ It is equivalent to "git branch -D ". return (ret, project) def Execute(self, opt, args): - nb = args[0] + nb = args[0].split() err = defaultdict(list) success = defaultdict(list) all_projects = self.GetProjects(