From 02d7945eb836f33f63b94fb2a556c844faf0ef8d Mon Sep 17 00:00:00 2001 From: Wink Saville Date: Fri, 10 Apr 2009 13:01:24 -0700 Subject: Add checkout command. Teach repo how to checkout a branch in all projects or a list of specific projects. Bug: REPO-21 --- project.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'project.py') diff --git a/project.py b/project.py index 8ed61551..24254676 100644 --- a/project.py +++ b/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. """ -- cgit v1.2.3-54-g00ecf