mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
Update abandon to support multiple branches
This change updates `repo abandon` command to take multiple space-separated branchnames as parameters. Bug: https://crbug.com/gerrit/13354 Change-Id: I00ad7a79872c0e4161f8183843835f25cd515605 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/365524 Tested-by: Aravind Vasudevan <aravindvasudev@google.com> Reviewed-by: Mike Frysinger <vapier@google.com> Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
This commit is contained in:
parent
21cc3a9d53
commit
e74d9046ee
@ -48,9 +48,15 @@ It is equivalent to "git branch -D <branchname>".
|
||||
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 <branchname>".
|
||||
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 <branchname>".
|
||||
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(
|
||||
|
Loading…
Reference in New Issue
Block a user