# Path: config.py
# REPOS_DIRS='d:\SVNMaster\Repos\\'
# 
# Path: config.py
# REPOS_BASE_URL='http://127.0.0.1/svn/'


from wtforms import Form, BooleanField, TextField, PasswordField, validators
from config import REPOS_DIRS
from config import REPOS_BASE_URL
import os,os.path,time, platform,re,subprocess
        subprocess.check_output(['svnadmin', 'create',os.path.join(REPOS_DIRS,reponame)]).decode('utf-8').strip()
    elif(sysstr == "Linux"):
        #os.system("mkdir -p " + REPOS_DIRS + reponame)
        subprocess.check_output(['svnadmin', 'create',os.path.join(REPOS_DIRS,reponame)]).decode('utf-8').strip()
    else:
        pass
    if os.path.isdir(REPOS_DIRS + reponame):
        return True
    return False

#删除配置库
def del_repo(reponame):
    sysstr = platform.system()
    if(sysstr =="Windows"):
        os.system("rd /s /q  " + REPOS_DIRS + reponame)
    elif(sysstr == "Linux"):
        os.system("rm -rf " + REPOS_DIRS + reponame)
    else:
        pass
    if os.path.isdir(REPOS_DIRS + reponame):
        return False
    return True

#修改配置库名称
def change_repo(before_name,after_name):
    sysstr = platform.system()
    if(sysstr =="Windows"):
        #print("move  " + REPOS_DIRS + before_name + ' ' + REPOS_DIRS + after_name)
        os.system("move  " + REPOS_DIRS + before_name + ' ' + REPOS_DIRS + after_name)
    elif(sysstr == "Linux"):

# Path: config.py
# REPOS_DIRS='d:\SVNMaster\Repos\\'
# 
# Path: config.py
# REPOS_BASE_URL='http://127.0.0.1/svn/'


# Path: mos/utils/functions.py
from wtforms import Form, BooleanField, TextField, PasswordField, validators
from config import REPOS_DIRS
from config import REPOS_BASE_URL
import os,os.path,time, platform,re,subprocess

        subprocess.check_output(['svnadmin', 'create',os.path.join(REPOS_DIRS,reponame)]).decode('utf-8').strip()
    elif(sysstr == "Linux"):
        #os.system("mkdir -p " + REPOS_DIRS + reponame)
        subprocess.check_output(['svnadmin', 'create',os.path.join(REPOS_DIRS,reponame)]).decode('utf-8').strip()
    else:
        pass
    if os.path.isdir(REPOS_DIRS + reponame):
        return True
    return False

#删除配置库
def del_repo(reponame):
    sysstr = platform.system()
    if(sysstr =="Windows"):
        os.system("rd /s /q  " + REPOS_DIRS + reponame)
    elif(sysstr == "Linux"):
        os.system("rm -rf " + REPOS_DIRS + reponame)
    else:
        pass
    if os.path.isdir(REPOS_DIRS + reponame):
        return False
    return True

#修改配置库名称
def change_repo(before_name,after_name):
    sysstr = platform.system()
    if(sysstr =="Windows"):
        #print("move  " + REPOS_DIRS + before_name + ' ' + REPOS_DIRS + after_name)
        os.system("move  " + REPOS_DIRS + before_name + ' ' + REPOS_DIRS + after_name)
    elif(sysstr == "Linux"):

        os.system("mv  " + REPOS_DIRS + before_name + ' ' + REPOS_DIRS + after_name)