Add checkout command.
Teach repo how to checkout a branch in all projects or a list
of specific projects.
Bug: REPO-21
diff --git a/project.py b/project.py
index 8ed6155..2425467 100644
--- a/project.py
+++ b/project.py
@@ -733,6 +733,20 @@
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.
"""