diff options
Diffstat (limited to 'project.py')
-rw-r--r-- | project.py | 31 |
1 files changed, 23 insertions, 8 deletions
@@ -748,16 +748,31 @@ class Project(object): | |||
748 | def StartBranch(self, name): | 748 | def StartBranch(self, name): |
749 | """Create a new branch off the manifest's revision. | 749 | """Create a new branch off the manifest's revision. |
750 | """ | 750 | """ |
751 | branch = self.GetBranch(name) | 751 | try: |
752 | branch.remote = self.GetRemote(self.remote.name) | 752 | self.bare_git.rev_parse(R_HEADS + name) |
753 | branch.merge = self.revision | 753 | exists = True |
754 | except GitError: | ||
755 | exists = False; | ||
756 | |||
757 | if exists: | ||
758 | if name == self.CurrentBranch: | ||
759 | return True | ||
760 | else: | ||
761 | cmd = ['checkout', name, '--'] | ||
762 | return GitCommand(self, cmd).Wait() == 0 | ||
754 | 763 | ||
755 | rev = branch.LocalMerge | ||
756 | cmd = ['checkout', '-b', branch.name, rev] | ||
757 | if GitCommand(self, cmd).Wait() == 0: | ||
758 | branch.Save() | ||
759 | else: | 764 | else: |
760 | raise GitError('%s checkout %s ' % (self.name, rev)) | 765 | branch = self.GetBranch(name) |
766 | branch.remote = self.GetRemote(self.remote.name) | ||
767 | branch.merge = self.revision | ||
768 | |||
769 | rev = branch.LocalMerge | ||
770 | cmd = ['checkout', '-b', branch.name, rev] | ||
771 | if GitCommand(self, cmd).Wait() == 0: | ||
772 | branch.Save() | ||
773 | return True | ||
774 | else: | ||
775 | return False | ||
761 | 776 | ||
762 | def CheckoutBranch(self, name): | 777 | def CheckoutBranch(self, name): |
763 | """Checkout a local topic branch. | 778 | """Checkout a local topic branch. |