chiark / gitweb /
common: print VCS client version
authorrelan <email@hidden>
Fri, 6 Oct 2017 06:37:47 +0000 (09:37 +0300)
committerrelan <email@hidden>
Fri, 6 Oct 2017 06:41:24 +0000 (09:41 +0300)
This may help to debug issues with too old VCS clients.

fdroidserver/common.py

index 794504e311798a44a3b033caa73c1df40a80addf..8e580971d085b50d87eccc919d620e26c02edfbe 100644 (file)
@@ -586,6 +586,7 @@ def setup_vcs(app):
     else:
         remote = app.Repo
     vcs = getvcs(app.RepoType, remote, build_dir)
+    logging.debug("Using %s" % vcs.clientversion())
 
     return vcs, build_dir
 
@@ -638,6 +639,13 @@ class vcs:
     def repotype(self):
         return None
 
+    def clientversion(self):
+        versionstr = FDroidPopen(self.clientversioncmd()).output
+        return versionstr[0:versionstr.find('\n')]
+
+    def clientversioncmd(self):
+        return None
+
     def gotorevision(self, rev, refresh=True):
         """Take the local repository to a clean version of the given
         revision, which is specificed in the VCS's native
@@ -735,6 +743,9 @@ class vcs_git(vcs):
     def repotype(self):
         return 'git'
 
+    def clientversioncmd(self):
+        return ['git', '--version']
+
     def checkrepo(self):
         """If the local directory exists, but is somehow not a git repository,
         git will traverse up the directory tree until it finds one
@@ -847,6 +858,9 @@ class vcs_gitsvn(vcs):
     def repotype(self):
         return 'git-svn'
 
+    def clientversioncmd(self):
+        return ['git', 'svn', '--version']
+
     def checkrepo(self):
         """If the local directory exists, but is somehow not a git repository,
         git will traverse up the directory tree until it finds one that
@@ -973,6 +987,9 @@ class vcs_hg(vcs):
     def repotype(self):
         return 'hg'
 
+    def clientversioncmd(self):
+        return ['hg', '--version']
+
     def gotorevisionx(self, rev):
         if not os.path.exists(self.local):
             p = FDroidPopen(['hg', 'clone', self.remote, self.local], output=False)
@@ -1020,6 +1037,9 @@ class vcs_bzr(vcs):
     def repotype(self):
         return 'bzr'
 
+    def clientversioncmd(self):
+        return ['bzr', '--version']
+
     def gotorevisionx(self, rev):
         if not os.path.exists(self.local):
             p = FDroidPopen(['bzr', 'branch', self.remote, self.local], output=False)