Commit f69b9654 authored by Michal Čihař's avatar Michal Čihař

Simplify git branch update logic

parent 759f5bde
...@@ -247,11 +247,8 @@ class SubProject(models.Model): ...@@ -247,11 +247,8 @@ class SubProject(models.Model):
Ensures local tracking branch exists and is checkouted. Ensures local tracking branch exists and is checkouted.
''' '''
gitrepo = self.get_repo() gitrepo = self.get_repo()
try: if not self.branch in gitrepo.heads:
head = gitrepo.heads[self.branch]
except:
gitrepo.git.branch('--track', self.branch, 'origin/%s' % self.branch) gitrepo.git.branch('--track', self.branch, 'origin/%s' % self.branch)
head = gitrepo.heads[self.branch]
gitrepo.git.checkout(self.branch) gitrepo.git.checkout(self.branch)
del gitrepo del gitrepo
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment