Treat git-svn git checkouts correctly. Mute tags/*

This commit is contained in:
Daniel Martí 2013-05-28 16:25:23 +02:00
parent 1ad1e85373
commit 86cff4e49c

View file

@ -233,22 +233,25 @@ class vcs_gitsvn(vcs):
raise VCSException("Git svn rebase failed") raise VCSException("Git svn rebase failed")
self.refreshed = True self.refreshed = True
if rev: if rev:
if rev == 'trunk': # Try finding a svn tag
if subprocess.call(['git', 'checkout', 'trunk'], cwd=self.local) != 0: p = subprocess.Popen(['git', 'checkout', 'tags/' + rev],
raise VCSException("Git checkout failed") cwd=self.local, stderr=subprocess.PIPE)
if p.returncode == 0:
print p.communicate()[0]
else: else:
# Try finding a svn tag # No tag found, normal svn rev translation
if subprocess.call(['git', 'checkout', 'tags/' + rev], cwd=self.local) != 0: # Translate svn rev into git format
# No tag found, normal svn rev translation p = subprocess.Popen(['git', 'svn', 'find-rev', 'r' + rev],
# Translate svn rev into git format cwd=self.local, stdout=subprocess.PIPE)
p = subprocess.Popen(['git', 'svn', 'find-rev', 'r' + rev], rev = p.communicate()[0].rstrip()
cwd=self.local, stdout=subprocess.PIPE) if p.returncode != 0 or len(rev) == 0:
rev = p.communicate()[0].rstrip() # If it's not a svn rev, do a normal git checkout (master,
if p.returncode != 0 or len(rev) == 0: # trunk, raw git sha, etc)
raise VCSException("Failed to get git treeish from svn rev") if subprocess.call(['git', 'checkout', 'trunk'], cwd=self.local) != 0:
# Check out the appropriate git revision... raise VCSException("No git treeish found and direct git checkout failed")
if subprocess.call(['git', 'checkout', rev], cwd=self.local) != 0: # Check out the appropriate git revision...
raise VCSException("Git checkout failed") if subprocess.call(['git', 'checkout', rev], cwd=self.local) != 0:
raise VCSException("Git checkout failed")
# Get rid of any uncontrolled files left behind... # Get rid of any uncontrolled files left behind...
if subprocess.call(['git', 'clean', '-dffx'], cwd=self.local) != 0: if subprocess.call(['git', 'clean', '-dffx'], cwd=self.local) != 0:
raise VCSException("Git clean failed") raise VCSException("Git clean failed")