diff options
author | Mandeep Singh Baines <msb@google.com> | 2011-05-26 10:34:11 -0700 |
---|---|---|
committer | Mandeep Singh Baines <msb@google.com> | 2011-05-26 10:49:39 -0700 |
commit | d6c93a28ca8cb079f473f749d805dcff97990225 (patch) | |
tree | 21cd307899c2a5d1e59df9929d63651ac2ba1da1 | |
parent | d572a13021b0430eddf83e9caedc9d5add693c62 (diff) | |
download | git-repo-d6c93a28ca8cb079f473f749d805dcff97990225.tar.gz |
Add branch support to repo upload
This commit adds a --br=<branch> option to repo upload.
repo currently examines every non-published branch. This is problematic
for my workflow. I have many branches in my kernel tree. Many of these
branches are based off of upstream remotes (I have many remotes) and
will never be uploaded (they'll get sent upstream as a patch).
Having repo scan these branches adds to my upload processing time
and clutters the branch selection buffer. I've also seen repo get
confused when one of my branches is 1000s of commits different from
m/master.
Change-Id: I68fa18951ea59ba373277b57ffcaf8cddd7e7a40
-rw-r--r-- | project.py | 4 | ||||
-rw-r--r-- | subcmds/upload.py | 9 |
2 files changed, 11 insertions, 2 deletions
@@ -791,7 +791,7 @@ class Project(object): | |||
791 | if R_HEADS + n not in heads: | 791 | if R_HEADS + n not in heads: |
792 | self.bare_git.DeleteRef(name, id) | 792 | self.bare_git.DeleteRef(name, id) |
793 | 793 | ||
794 | def GetUploadableBranches(self): | 794 | def GetUploadableBranches(self, selected_branch=None): |
795 | """List any branches which can be uploaded for review. | 795 | """List any branches which can be uploaded for review. |
796 | """ | 796 | """ |
797 | heads = {} | 797 | heads = {} |
@@ -807,6 +807,8 @@ class Project(object): | |||
807 | for branch, id in heads.iteritems(): | 807 | for branch, id in heads.iteritems(): |
808 | if branch in pubed and pubed[branch] == id: | 808 | if branch in pubed and pubed[branch] == id: |
809 | continue | 809 | continue |
810 | if selected_branch and branch != selected_branch: | ||
811 | continue | ||
810 | 812 | ||
811 | rb = self.GetUploadableBranch(branch) | 813 | rb = self.GetUploadableBranch(branch) |
812 | if rb: | 814 | if rb: |
diff --git a/subcmds/upload.py b/subcmds/upload.py index c561b8aa..c1958373 100644 --- a/subcmds/upload.py +++ b/subcmds/upload.py | |||
@@ -120,6 +120,9 @@ Gerrit Code Review: http://code.google.com/p/gerrit/ | |||
120 | p.add_option('--cc', | 120 | p.add_option('--cc', |
121 | type='string', action='append', dest='cc', | 121 | type='string', action='append', dest='cc', |
122 | help='Also send email to these email addresses.') | 122 | help='Also send email to these email addresses.') |
123 | p.add_option('--br', | ||
124 | type='string', action='store', dest='branch', | ||
125 | help='Branch to upload.') | ||
123 | 126 | ||
124 | # Options relating to upload hook. Note that verify and no-verify are NOT | 127 | # Options relating to upload hook. Note that verify and no-verify are NOT |
125 | # opposites of each other, which is why they store to different locations. | 128 | # opposites of each other, which is why they store to different locations. |
@@ -336,9 +339,13 @@ Gerrit Code Review: http://code.google.com/p/gerrit/ | |||
336 | pending = [] | 339 | pending = [] |
337 | reviewers = [] | 340 | reviewers = [] |
338 | cc = [] | 341 | cc = [] |
342 | branch = None | ||
343 | |||
344 | if opt.branch: | ||
345 | branch = opt.branch | ||
339 | 346 | ||
340 | for project in project_list: | 347 | for project in project_list: |
341 | avail = project.GetUploadableBranches() | 348 | avail = project.GetUploadableBranches(branch) |
342 | if avail: | 349 | if avail: |
343 | pending.append((project, avail)) | 350 | pending.append((project, avail)) |
344 | 351 | ||