From e9d6b611c5bec499360c175035770132f1e60c71 Mon Sep 17 00:00:00 2001 From: Daniel Sandler Date: Fri, 6 Apr 2012 10:39:32 -0400 Subject: [PATCH] New flag for repo upload: --current_branch (--cbr) A convenient equivalent to `repo upload --br=`. Note that the head branch will be selected for each project uploaded by repo, so different branches may be uploaded for different projects. Change-Id: I10ad8ceaa63f055105c2d847c6e329fa4226dbaf --- subcmds/upload.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/subcmds/upload.py b/subcmds/upload.py index 53118f6b..07bd4d81 100644 --- a/subcmds/upload.py +++ b/subcmds/upload.py @@ -123,6 +123,9 @@ Gerrit Code Review: http://code.google.com/p/gerrit/ p.add_option('--br', type='string', action='store', dest='branch', help='Branch to upload.') + p.add_option('--cbr', '--current-branch', + dest='current_branch', action='store_true', + help='Upload current git branch.') # Options relating to upload hook. Note that verify and no-verify are NOT # opposites of each other, which is why they store to different locations. @@ -351,7 +354,11 @@ Gerrit Code Review: http://code.google.com/p/gerrit/ branch = opt.branch for project in project_list: - avail = project.GetUploadableBranches(branch) + if opt.current_branch: + cbr = project.CurrentBranch + avail = [project.GetUploadableBranch(cbr)] if cbr else None + else: + avail = project.GetUploadableBranches(branch) if avail: pending.append((project, avail))