mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
Refactor part of GetUploadableBranches to lookup one specific branch
This way project.GetUploadableBranch(project.CurrentBranch) can tell us how (if at all) to upload the currently checked out branch. Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
parent
5d40e26201
commit
35f2596c27
14
project.py
14
project.py
@ -428,13 +428,21 @@ class Project(object):
|
||||
if branch in pubed and pubed[branch] == id:
|
||||
continue
|
||||
|
||||
branch = self.GetBranch(branch)
|
||||
rb = self.GetUploadableBranch(branch)
|
||||
if rb:
|
||||
ready.append(rb)
|
||||
return ready
|
||||
|
||||
def GetUploadableBranch(self, branch_name):
|
||||
"""Get a single uploadable branch, or None.
|
||||
"""
|
||||
branch = self.GetBranch(branch_name)
|
||||
base = branch.LocalMerge
|
||||
if branch.LocalMerge:
|
||||
rb = ReviewableBranch(self, branch, base)
|
||||
if rb.commits:
|
||||
ready.append(rb)
|
||||
return ready
|
||||
return rb
|
||||
return None
|
||||
|
||||
def UploadForReview(self, branch=None):
|
||||
"""Uploads the named branch for code review.
|
||||
|
Loading…
Reference in New Issue
Block a user