Source code for gdeps.svn
#!python3
# Copyright 2007-2017 Gemr. All Rights Reserved.
# Licensed to MIT see LICENSE.txt
import gdeps as GDeps
__author__ = 'Suryavarman (http://sourceforge.net/u/suryavarman/profile/)'
[docs]class Svn(GDeps.Versioning):
def __init__(self, inConfigFile, inFolderPath, inLogFileDirectory, inReposUrl, inCloneArgs="", inUpdateArgs="", inSectionName="svn", inExePath="C:\\Program Files\\TortoiseSVN\\bin\\svn.exe"):
""" :param inReposUrl: repository URL
Examples:
sourceforge:
https://svn.code.sf.net/p/REPONAME/code/
svn://svn.code.sf.net/p/REPONAME/code/
If you need an authentication go to the platform like
Sourceforge and create an asynchrone key and use a service
like pageant/keypass-pageant to automatically load the key
:type inReposUrl: str
"""
GDeps.Versioning.__init__(self, inConfigFile, inFolderPath, inLogFileDirectory, inReposUrl, inCloneArgs, inUpdateArgs, inSectionName, inExePath)
self.m_ErrorRegexp = r"(.*svn: E[0-9].*)" # has to be test
[docs] def clone(self):
aReport = GDeps.Versioning.clone(self)
aCommand = self.getCMDExePath() + 'co "' + self.m_ReposUrl + '" "' + self.getCloneTmpDir() + '"'
self.CloneNoEmptyDir(aCommand, "svn-clone", aReport)
if not aReport.getlen(aReport.m_Errors):
aReport.append2(self.update())
""" It's necessary a clean up or a revert with svn cannot restore the
missing files.
"""
return aReport
[docs] def update(self):
aReport = GDeps.Versioning.update(self)
aCommand = self.getCMDExePath() + 'update "' + self.m_FolderPath + '"'
self.callWithLogFile(aCommand, "svn-update", aReport, self)
return aReport
[docs] def clean(self):
aReport = GDeps.Versioning.clean(self)
aCommand = self.getCMDExePath() + 'cleanup "' + self.m_FolderPath + '"'
self.callWithLogFile(aCommand, "svn-clean", aReport, self)
return aReport
[docs] def getFolderRepoConfigPath(self):
return ".svn"