Try the old git svn find-rev format as well

This commit is contained in:
Daniel Martí 2014-07-05 12:15:20 +02:00
parent 452c13907c
commit 7d07e52e1f

View file

@ -622,19 +622,24 @@ class vcs_gitsvn(vcs):
# No tag found, normal svn rev translation # No tag found, normal svn rev translation
# Translate svn rev into git format # Translate svn rev into git format
rev_split = rev.split('/') rev_split = rev.split('/')
p = None
for treeish in ['origin/', '']:
if len(rev_split) > 1: if len(rev_split) > 1:
treeish = 'origin/' + rev_split[0] treeish += rev_split[0]
svn_rev = rev_split[1] svn_rev = rev_split[1]
else: else:
# if no branch is specified, then assume trunk (ie. 'master' # if no branch is specified, then assume trunk (i.e. 'master' branch):
# branch): treeish += 'master'
treeish = 'origin/master'
svn_rev = rev svn_rev = rev
p = SilentPopen(['git', 'svn', 'find-rev', 'r' + svn_rev, treeish], cwd=self.local) p = SilentPopen(['git', 'svn', 'find-rev', 'r' + svn_rev, treeish], cwd=self.local)
git_rev = p.output.rstrip() git_rev = p.output.rstrip()
if p.returncode == 0 and git_rev:
break
if p.returncode != 0 or not git_rev: if p.returncode != 0 or not git_rev:
# Try a plain git checkout as a last resort # Try a plain git checkout as a last resort
p = SilentPopen(['git', 'checkout', rev], cwd=self.local) p = SilentPopen(['git', 'checkout', rev], cwd=self.local)