From: Daniel Martí Date: Mon, 3 Jun 2013 09:20:49 +0000 (+0200) Subject: Add support for spaces in git-svn tags, fixes X-Git-Tag: 0.1~555 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=785e17428a5c220f3e25570a3f0c95a3337fb268;p=fdroidserver.git Add support for spaces in git-svn tags, fixes --- diff --git a/fdroidserver/common.py b/fdroidserver/common.py index f25c3d98..43142a64 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -235,11 +235,13 @@ class vcs_gitsvn(vcs): raise VCSException("Git svn rebase failed") self.refreshed = True if rev: + nospaces_rev = rev.replace(' ', '%20') # Try finding a svn tag - p = subprocess.Popen(['git', 'checkout', 'tags/' + rev], - cwd=self.local, stderr=subprocess.PIPE) + p = subprocess.Popen(['git', 'checkout', 'tags/' + nospaces_rev], + cwd=self.local, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + out, err = p.communicate() if p.returncode == 0: - print p.communicate()[0] + print out else: # No tag found, normal svn rev translation # Translate svn rev into git format @@ -248,11 +250,22 @@ class vcs_gitsvn(vcs): git_rev = p.communicate()[0].rstrip() if p.returncode != 0 or len(git_rev) == 0: # Try a plain git checkout as a last resort - if subprocess.call(['git', 'checkout', rev], cwd=self.local) != 0: + p = subprocess.Popen(['git', 'checkout', rev], cwd=self.local, + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + out, err = p.communicate() + if p.returncode == 0: + print out + else: raise VCSException("No git treeish found and direct git checkout failed") - # Check out the appropriate git revision... - if subprocess.call(['git', 'checkout', git_rev], cwd=self.local) != 0: - raise VCSException("Git checkout failed") + else: + # Check out the git rev equivalent to the svn rev + p = subprocess.Popen(['git', 'checkout', git_rev], cwd=self.local, + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + out, err = p.communicate() + if p.returncode == 0: + print out + else: + raise VCSException("Git svn checkout failed") # Get rid of any uncontrolled files left behind... if subprocess.call(['git', 'clean', '-dffx'], cwd=self.local) != 0: raise VCSException("Git clean failed")