diff --git a/plugins/csvn/hook/commit.tpl b/plugins/csvn/hook/commit.tpl index 94cc3b0ad..842eabea1 100755 --- a/plugins/csvn/hook/commit.tpl +++ b/plugins/csvn/hook/commit.tpl @@ -10,7 +10,11 @@ WEB_PATH={$PROJECT_DIR}/wwwroot/$REPOS_NAME SVN_PATH=http://127.0.0.1:{$PORT}/svn/$REPOS if [ ! -d $WEB_PATH ]; then - svn co $SVN_PATH $WEB_PATH --username={$CSVN_USER} --password={$CSVN_PWD} + svn co $SVN_PATH $WEB_PATH \ + --username={$CSVN_USER} \ + --password={$CSVN_PWD} \ + --no-auth-cache \ + --non-interactive fi cd $WEB_PATH && svn update --username={$CSVN_USER} --password={$CSVN_PWD} \ No newline at end of file diff --git a/plugins/csvn/index.py b/plugins/csvn/index.py index 216346760..ab826363f 100755 --- a/plugins/csvn/index.py +++ b/plugins/csvn/index.py @@ -518,16 +518,26 @@ def projectScriptLoad(): if not 'pname' in args: return 'project name missing' + post_commit_tpl = getPluginDir() + '/hook/post-commit.tpl' + hook_path = getServerDir() + '/data/repositories/' + \ + args['pname'] + '/hooks' + post_commit_file = hook_path + '/post-commit' + + pct_content = public.readFile(post_commit_tpl) + public.writeFile(pro_commit_file, pct_content) + public.execShell('chmod 777 ' + post_commit_file) + commit_tpl = getPluginDir() + '/hook/post-commit.tpl' - pro_commit_file = getServerDir() + '/data/repositories/' + '/' + \ - args['pname'] + '/hooks/post-commit' + commit_file = hook_path + '/commit' - content = public.readFile(commit_tpl) - content = content.replace('{$PRJOECT_DIR}', public.getRootDir()) - content = content.replace('{$PORT}', getHttpPort()) + ct_content = public.readFile(post_commit_tpl) + ct_content = ct_content.replace('{$PRJOECT_DIR}', public.getRootDir()) + ct_content = ct_content.replace('{$PORT}', getHttpPort()) + ct_content = ct_content.replace('{$CSVN_USER}', 'admin') + ct_content = ct_content.replace('{$CSVN_PWD}', 'admin123Q') - public.writeFile(pro_commit_file, content) - public.execShell('chmod 777 ' + pro_commit_file) + public.writeFile(commit_file, ct_content) + public.execShell('chmod 777 ' + commit_file) return 'ok' @@ -537,9 +547,13 @@ def projectScriptUnload(): if not 'pname' in args: return 'project name missing' - pro_commit_file = getServerDir() + '/data/repositories/' + '/' + \ + post_commit_file = getServerDir() + '/data/repositories/' + '/' + \ args['pname'] + '/hooks/post-commit' - public.execShell('rm -f ' + pro_commit_file) + public.execShell('rm -f ' + post_commit_file) + + commit_file = getServerDir() + '/data/repositories/' + '/' + \ + args['pname'] + '/hooks/commit' + public.execShell('rm -f ' + commit_file) return 'ok' @@ -549,11 +563,11 @@ def projectScriptEdit(): return 'project name missing' data = {} - pro_commit_file = getServerDir() + '/data/repositories/' + \ - args['pname'] + '/hooks/post-commit' - if os.path.exists(pro_commit_file): + commit_file = getServerDir() + '/data/repositories/' + \ + args['pname'] + '/hooks/commit' + if os.path.exists(commit_file): data['status'] = True - data['path'] = pro_commit_file + data['path'] = commit_file else: data['status'] = False data['msg'] = 'file does not exist'