aboutsummaryrefslogtreecommitdiffstats
path: root/MgaRepo/svn.py
blob: cc1ed1b9ee6d02e6d8c6a4bbe59814fa7601fe1a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from MgaRepo.util import execcmd
from MgaRepo.VCS import *
import sys
import os
import re
import time

__all__ = ["SVN", "SVNLook", "SVNLogEntry"]

class SVNLogEntry(VCSLogEntry):
    def __init__(self, revision, author, date):
        VCSLogEntry.__init__(self, revision, author, data)

class SVN(VCS):
    vcs_dirname = ".svn"
    vcs_name = "svn"
    def __init__(self, path=None, url=None):
        VCS.__init__(self, path, url)
        self.vcs_command = config.get("global", "svn-command", ["svn"])
        self.env_defaults = {"SVN_SSH": self.vcs_wrapper}

    def drop_ssh_if_no_auth(self, url):
        if url and url.startswith("svn+ssh://"):
            cmd = ["info", "--non-interactive", "--no-newline", "--show-item", "url", url]
            status, output = self._execVcs(*cmd, local=True, noerror=True, show=False)
            if status == 1 and (("E170013" in output) or ("E210002" in output)):
                url = url.replace("svn+ssh://", "svn://")
                status, output = self._execVcs(*cmd, local=True, noerror=True, show=False)
                if status == 0 and output == url:
                    pass
        return url

class SVNLook(VCSLook):
    def __init__(self, repospath, txn=None, rev=None):
        VCSLook.__init__(self, repospath, txn, rev)
        self.execcmd = "svnlook"

# vim:et:ts=4:sw=4