diff options
| author | Wink Saville <wink@google.com> | 2009-04-10 13:01:24 -0700 |
|---|---|---|
| committer | Wink Saville <wink@google.com> | 2009-04-10 13:01:24 -0700 |
| commit | 02d7945eb836f33f63b94fb2a556c844faf0ef8d (patch) | |
| tree | 5cbcbfd147616337aebec9d72b0fd0de3bf34b64 /project.py | |
| parent | 8f82a4f828c2765cc4585f9d749f5155f06fd9e9 (diff) | |
| download | git-repo-02d7945eb836f33f63b94fb2a556c844faf0ef8d.tar.gz | |
Add checkout command.
Teach repo how to checkout a branch in all projects or a list
of specific projects.
Bug: REPO-21
Diffstat (limited to 'project.py')
| -rw-r--r-- | project.py | 14 |
1 files changed, 14 insertions, 0 deletions
| @@ -733,6 +733,20 @@ class Project(object): | |||
| 733 | else: | 733 | else: |
| 734 | raise GitError('%s checkout %s ' % (self.name, rev)) | 734 | raise GitError('%s checkout %s ' % (self.name, rev)) |
| 735 | 735 | ||
| 736 | def CheckoutBranch(self, name): | ||
| 737 | """Checkout a local topic branch. | ||
| 738 | """ | ||
| 739 | |||
| 740 | # Be sure the branch exists | ||
| 741 | try: | ||
| 742 | tip_rev = self.bare_git.rev_parse(R_HEADS + name) | ||
| 743 | except GitError: | ||
| 744 | return False; | ||
| 745 | |||
| 746 | # Do the checkout | ||
| 747 | cmd = ['checkout', name, '--'] | ||
| 748 | return GitCommand(self, cmd, capture_stdout=True).Wait() == 0 | ||
| 749 | |||
| 736 | def AbandonBranch(self, name): | 750 | def AbandonBranch(self, name): |
| 737 | """Destroy a local topic branch. | 751 | """Destroy a local topic branch. |
| 738 | """ | 752 | """ |
