mirror of
https://git.codelinaro.org/clo/tools/repo.git
synced 2025-06-19 18:04:26 +08:00
Add a repo branches subcommand to describe current branches
We now display a summary of the available topic branches in this client, based upon a sorted union of all existing projects. Bug: REPO-21 Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
26
project.py
26
project.py
@ -306,6 +306,32 @@ class Project(object):
|
||||
"""
|
||||
return self.config.GetBranch(name)
|
||||
|
||||
def GetBranches(self):
|
||||
"""Get all existing local branches.
|
||||
"""
|
||||
current = self.CurrentBranch
|
||||
all = self.bare_git.ListRefs()
|
||||
heads = {}
|
||||
pubd = {}
|
||||
|
||||
for name, id in all.iteritems():
|
||||
if name.startswith(R_HEADS):
|
||||
name = name[len(R_HEADS):]
|
||||
b = self.GetBranch(name)
|
||||
b.current = name == current
|
||||
b.published = None
|
||||
b.revision = id
|
||||
heads[name] = b
|
||||
|
||||
for name, id in all.iteritems():
|
||||
if name.startswith(R_PUB):
|
||||
name = name[len(R_PUB):]
|
||||
b = heads.get(name)
|
||||
if b:
|
||||
b.published = id
|
||||
|
||||
return heads
|
||||
|
||||
|
||||
## Status Display ##
|
||||
|
||||
|
Reference in New Issue
Block a user