diff options
| author | Shawn O. Pearce <sop@google.com> | 2009-04-10 16:02:48 -0700 |
|---|---|---|
| committer | Shawn O. Pearce <sop@google.com> | 2009-04-10 16:02:48 -0700 |
| commit | 27b07327bc9f4bcda2c29422e064bced092759e3 (patch) | |
| tree | 3eeee2ebd7314a35e9fadb317912791eecb8dbdf /project.py | |
| parent | 02d7945eb836f33f63b94fb2a556c844faf0ef8d (diff) | |
| download | git-repo-27b07327bc9f4bcda2c29422e064bced092759e3.tar.gz | |
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>
Diffstat (limited to 'project.py')
| -rw-r--r-- | project.py | 26 |
1 files changed, 26 insertions, 0 deletions
| @@ -306,6 +306,32 @@ class Project(object): | |||
| 306 | """ | 306 | """ |
| 307 | return self.config.GetBranch(name) | 307 | return self.config.GetBranch(name) |
| 308 | 308 | ||
| 309 | def GetBranches(self): | ||
| 310 | """Get all existing local branches. | ||
| 311 | """ | ||
| 312 | current = self.CurrentBranch | ||
| 313 | all = self.bare_git.ListRefs() | ||
| 314 | heads = {} | ||
| 315 | pubd = {} | ||
| 316 | |||
| 317 | for name, id in all.iteritems(): | ||
| 318 | if name.startswith(R_HEADS): | ||
| 319 | name = name[len(R_HEADS):] | ||
| 320 | b = self.GetBranch(name) | ||
| 321 | b.current = name == current | ||
| 322 | b.published = None | ||
| 323 | b.revision = id | ||
| 324 | heads[name] = b | ||
| 325 | |||
| 326 | for name, id in all.iteritems(): | ||
| 327 | if name.startswith(R_PUB): | ||
| 328 | name = name[len(R_PUB):] | ||
| 329 | b = heads.get(name) | ||
| 330 | if b: | ||
| 331 | b.published = id | ||
| 332 | |||
| 333 | return heads | ||
| 334 | |||
| 309 | 335 | ||
| 310 | ## Status Display ## | 336 | ## Status Display ## |
| 311 | 337 | ||
