summaryrefslogtreecommitdiffstats
path: root/subcmds/abandon.py
diff options
context:
space:
mode:
Diffstat (limited to 'subcmds/abandon.py')
-rw-r--r--subcmds/abandon.py16
1 files changed, 11 insertions, 5 deletions
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 <branchname>".
48 self.Usage() 48 self.Usage()
49 49
50 if not opt.all: 50 if not opt.all:
51 nb = args[0] 51 branches = args[0].split()
52 if not git.check_ref_format("heads/%s" % nb): 52 invalid_branches = [
53 self.OptionParser.error("'%s' is not a valid branch name" % nb) 53 x for x in branches if not git.check_ref_format(f"heads/{x}")
54 ]
55
56 if invalid_branches:
57 self.OptionParser.error(
58 f"{invalid_branches} are not valid branch names"
59 )
54 else: 60 else:
55 args.insert(0, "'All local branches'") 61 args.insert(0, "'All local branches'")
56 62
@@ -59,7 +65,7 @@ It is equivalent to "git branch -D <branchname>".
59 if all_branches: 65 if all_branches:
60 branches = project.GetBranches() 66 branches = project.GetBranches()
61 else: 67 else:
62 branches = [nb] 68 branches = nb
63 69
64 ret = {} 70 ret = {}
65 for name in branches: 71 for name in branches:
@@ -69,7 +75,7 @@ It is equivalent to "git branch -D <branchname>".
69 return (ret, project) 75 return (ret, project)
70 76
71 def Execute(self, opt, args): 77 def Execute(self, opt, args):
72 nb = args[0] 78 nb = args[0].split()
73 err = defaultdict(list) 79 err = defaultdict(list)
74 success = defaultdict(list) 80 success = defaultdict(list)
75 all_projects = self.GetProjects( 81 all_projects = self.GetProjects(