2016-11-09 9 views
0

は私がポストcommit.tmplを削除し、コミット後のファイルには、ここのコードです:変更されたファイルを更新するためにSVNにpost-commitスクリプトを設定するには?

#!/bin/sh 

export LANG=en_US.UTF-8 
SVN_Path=/root/svn/myblog 
WEB_Path=/home/app/myblog 
echo `date "+%Y-%m-%d %H:%M:%S"` 
$SVN_Path update --username xxx --password yyy $WEB_Path --no-auth-cache 

# POST-COMMIT HOOK 
# 
# The post-commit hook is invoked after a commit. Subversion runs 
# this hook by invoking a program (script, executable, binary, etc.) 
# named 'post-commit' (for which this file is a template) with the 
# following ordered arguments: 
# 
# [1] REPOS-PATH (the path to this repository) 
# [2] REV   (the number of the revision just committed) 
# 
# The default working directory for the invocation is undefined, so 
# the program should set one explicitly if it cares. 
# 
# Because the commit has already completed and cannot be undone, 
# the exit code of the hook program is ignored. The hook program 
# can use the 'svnlook' utility to help it examine the 
# newly-committed tree. 
# 
# On a Unix system, the normal procedure is to have 'post-commit' 
# invoke other programs to do the real work, though it may do the 
# work itself too. 
# 
# Note that 'post-commit' must be executable by the user(s) who will 
# invoke it (typically the user httpd runs as), and that user must 
# have filesystem-level permission to access the repository. 
# 
# On a Windows system, you should name the hook program 
# 'post-commit.bat' or 'post-commit.exe', 
# but the basic idea is the same. 
# 
# The hook program typically does not inherit the environment of 
# its parent process. For example, a common problem is for the 
# PATH environment variable to not be set to its usual value, so 
# that subprograms fail to launch unless invoked via absolute path. 
# If you're having unexpected problems with a hook program, the 
# culprit may be unusual (or missing) environment variables. 
# 
# Here is an example hook script, for a Unix /bin/sh interpreter. 
# For more examples and pre-written hooks, see those in 
# the Subversion repository at 
# http://svn.apache.org/repos/asf/subversion/trunk/tools/hook-scripts/ and 
# http://svn.apache.org/repos/asf/subversion/trunk/contrib/hook-scripts/ 

# REPOS="$1" 
# REV="$2" 

# mailer.py commit "$REPOS" "$REV" /path/to/mailer.conf 

は残念ながら、何も(プロジェクトパスは/ home /アプリ/ myblog)私のプロジェクトファイルに起こりません後私は変更されたコードをサーバーにコミットします。私は、コマンドラインでこのファイルを実行した場合でも、私はこの情報を取得します:

2016-11-09 16:32:10 
./post-commit: line 9: /root/svn/myblog: Is a directory 

一方、フォローパスに:/ルート/ SVN/myblog/DB /リビジョン属性/ 0、私はすべてのログファイルをコミット見つけることができます。私は、変更されたファイルがサーバーにコミットされていることを意味しますね。

私はCentOS、Expressを使用しています。

だから、誰でもこのことについて私を助けることができますか?どうも!!

答えて

0

2016-11-09 16:32:10 ./post-commit: line 9: /root/svn/myblog: Is a directory

コードによると、$SVN_PathはSubversionのコマンドラインクライアントsvnを指している必要があります。しかし、それは代わりに、ディレクトリ/myblogを指す:

SVN_Path=/root/svn/myblog

あなたがコンピュータ上svnクライアントを指すように$SVN_Pathを調整する必要があります。

一方、フォローパスで:/ルート/ SVN/myblog/DB /リビジョン属性/ 0、私は すべてのログファイルをコミットする見つけることができます。私は、変更されたファイルが サーバにコミットされていることを意味すると思いますか?

ポストコミットフックコミット後に実行します。だから、コミットはリポジトリにそれを作った。ただし、フックは入力したために実行されませんでした$SVN_Path

+0

ご返信ありがとうございます。私は$ SVN_PATHを修正し、サーバ上でsvnを再起動しましたが、何も変わりませんでした。私はコミットして、プロジェクトパスに更新はありません。コマンドラインで変更後のコミットスクリプトを実行しようとしましたが、私はまだこれを取得します:./post-commit:9行目:/ root/svn:ディレクトリです。私が逃したものはありますか? –

+0

@HenryYongパスはまだ無効です。 '/ root/svn'は実行ファイルではありません。システム上の 'svn'への実際のパスを探してください:http://unix.stackexchange.com/questions/28555/how-to-find-applications-path-from-command-line – bahrep

+0

私は実際のパスを見つけました。/usr/bin/svnです。しかし、それはまだ動作しません。コマンドラインで、私はこれを取得しました: '/ home/app/myblog'をスキップしました 競合の概要:スキップされたパス:1 –

関連する問題