Mercurial > gub
changeset 5859:b25a304ef105
repository.Git.is_downloaded (): check for specific branch. Fixes stable/2.12.
In fact, fixes building of a Git branch after already downloaded
another branch.
author | Jan Nieuwenhuizen <janneke@gnu.org> |
---|---|
date | Wed, 09 Dec 2009 09:37:53 +0100 |
parents | 9adef27dc033 |
children | 6e19e7c1931a |
files | gub/repository.py |
diffstat | 1 files changed, 11 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/gub/repository.py Mon Dec 07 22:25:20 2009 +0100 +++ b/gub/repository.py Wed Dec 09 09:37:53 2009 +0100 @@ -614,6 +614,9 @@ def is_downloaded (self): if not os.path.isdir (os.path.join (self.dir, 'refs')): return False + ref = 'refs/heads/%(url_host)s/%(url_dir)s/%(branch)s' % self.__dict__ + if not os.path.isdir (os.path.join (self.dir, ref)): + return False if self.revision: result = self.git_pipe ('cat-file commit %s' % self.revision, ignore_errors=True) @@ -650,14 +653,15 @@ branch = self.get_ref () if branch in self.checksums: return self.checksums[branch] - if os.path.isdir (self.dir): - ## can't use describe: fails in absence of tags. - cs = self.git_pipe ('rev-list --max-count=1 %(branch)s' % locals ()) - cs = cs.strip () - self.checksums[branch] = cs - return cs - else: + if not self.is_downloaded (): + self.download () + if not self.is_downloaded () or not os.path.isdir (self.dir): return 'invalid' + # can't use describe: fails in absence of tags. + cs = self.git_pipe ('rev-list --max-count=1 %(branch)s' % locals ()) + cs = cs.strip () + self.checksums[branch] = cs + return cs def all_files (self): branch = self.get_ref () str = self.git_pipe ('ls-tree --name-only -r %(branch)s' % locals ())