chiark / gitweb /
Support origin/ checkouts with tags as well in gitsvn
[fdroidserver.git] / fdroidserver / common.py
index ce3acc12fa3a21bb0ac9d68ca7c9c297b55350c0..c542aa2d765d73ced6feb72b4259a6cd5f09096a 100644 (file)
@@ -617,7 +617,11 @@ class vcs_gitsvn(vcs):
         if rev:
             nospaces_rev = rev.replace(' ', '%20')
             # Try finding a svn tag
-            p = SilentPopen(['git', 'checkout', 'tags/' + nospaces_rev], cwd=self.local)
+            for treeish in ['origin/', '']:
+                p = SilentPopen(['git', 'checkout', treeish + 'tags/' + nospaces_rev],
+                                cwd=self.local)
+                if p.returncode == 0:
+                    break
             if p.returncode != 0:
                 # No tag found, normal svn rev translation
                 # Translate svn rev into git format
@@ -634,7 +638,8 @@ class vcs_gitsvn(vcs):
                         treeish += 'master'
                         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()
 
                     if p.returncode == 0 and git_rev:
@@ -1666,7 +1671,7 @@ def FDroidPopen(commands, cwd=None, shell=False, output=True):
     while not stdout_reader.eof():
         while not stdout_queue.empty():
             line = stdout_queue.get()
-            if output and options.verbose:
+            if output or options.verbose:
                 # Output directly to console
                 sys.stderr.write(line)
                 sys.stderr.flush()