chiark / gitweb /
Try the old git svn find-rev format as well
authorDaniel Martí <mvdan@mvdan.cc>
Sat, 5 Jul 2014 10:15:20 +0000 (12:15 +0200)
committerDaniel Martí <mvdan@mvdan.cc>
Sat, 5 Jul 2014 10:15:20 +0000 (12:15 +0200)
fdroidserver/common.py

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