Add checkout command.

Teach repo how to checkout a branch in all projects or a list
of specific projects.

Bug: REPO-21
This commit is contained in:
Wink Saville
2009-04-10 13:01:24 -07:00
parent 8f82a4f828
commit 02d7945eb8
2 changed files with 59 additions and 0 deletions

View File

@ -733,6 +733,20 @@ class Project(object):
else:
raise GitError('%s checkout %s ' % (self.name, rev))
def CheckoutBranch(self, name):
"""Checkout a local topic branch.
"""
# Be sure the branch exists
try:
tip_rev = self.bare_git.rev_parse(R_HEADS + name)
except GitError:
return False;
# Do the checkout
cmd = ['checkout', name, '--']
return GitCommand(self, cmd, capture_stdout=True).Wait() == 0
def AbandonBranch(self, name):
"""Destroy a local topic branch.
"""