mirror of
https://git.codelinaro.org/clo/tools/repo.git
synced 2025-09-11 14:13:41 +08:00
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:
14
project.py
14
project.py
@ -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.
|
||||
"""
|
||||
|
Reference in New Issue
Block a user