Dachary has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316699

Change subject: repository: add cvs support
......................................................................

repository: add cvs support

Change-Id: Ied2516c4cee2ec6c70f8c9100ad822329aa92eed
Signed-off-by: Loic Dachary <l...@dachary.org>
---
M FLOSSbot/repository.py
1 file changed, 17 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/bots/FLOSSbot 
refs/changes/99/316699/1

diff --git a/FLOSSbot/repository.py b/FLOSSbot/repository.py
index 220d317..8b2036a 100644
--- a/FLOSSbot/repository.py
+++ b/FLOSSbot/repository.py
@@ -17,6 +17,7 @@
 import argparse
 import logging
 import re
+from urllib.parse import urlparse
 
 import pywikibot
 import requests
@@ -232,7 +233,21 @@
             return self.Q_Subversion
         if url.startswith('ftp://'):
             return self.Q_File_Transfer_Protocol
+        if url.startswith('cvs://'):
+            return self.Q_Concurrent_Versions_System
         return None
+
+    def verify_cvs(self, url, credentials):
+        parsed = urlparse(url)
+        cvsroot = ':pserver:' + parsed.netloc + ':' + parsed.path
+        return util.sh_bool("""
+        set -e
+        rm -fr /tmp/tmpclone
+        mkdir -p /tmp/tmpclone
+        cd /tmp/tmpclone
+        timeout 30 cvs -d {cvsroot} -z3 get . || true
+        test -d CVSROOT
+        """.format(cvsroot=cvsroot))
 
     def verify_git(self, url):
         return util.sh_bool("timeout 30 git ls-remote " + url + " HEAD")
@@ -309,6 +324,8 @@
             return self.verify_http(url)
         elif protocol == self.Q_File_Transfer_Protocol:
             return self.verify_ftp(url)
+        elif protocol == self.Q_Concurrent_Versions_System:
+            return self.verify_cvs(url, credentials)
         return None
 
     def try_protocol(self, url, credentials):

-- 
To view, visit https://gerrit.wikimedia.org/r/316699
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ied2516c4cee2ec6c70f8c9100ad822329aa92eed
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/bots/FLOSSbot
Gerrit-Branch: master
Gerrit-Owner: Dachary <l...@dachary.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to