どんな実施のCommitフックTrac&SVNは、Windows専用のソフトウェア?
質問
私の走行は、windows専用のソフトウェアTrac/SVNいることを約束し、リポジトリの統合にTracのバグを総合的に判断することが重要であるSVNコメントとなります。
いのあるポストcommitフックが、ありがとうござい情報についwindows上でしか利用できません。
誰でもで順調に進んでいるのでしょうか?どのようなワークショップをお勧めしま続療です。
こちらは、フックしたい場合にはSVNありません(正確にどのようなことは、Windows専用のソフトウェアです。
解決 2
大丈夫、私にはある私の経験の後、コーヒーに飽きたら寿司にとして、クレイグのために取得をしました。こちらは必要ない(少なくともSVN v1.4Trac v0.10.3):
- お客様のSVNリポジトリのことを有効にするポストCommitフックします。
- 内部のSVNリポジトリがあるというディレクトリのフックにあることができますか配置のcommitフック。
- ファイルを作成し後のコミットするbat(このバッチファイルが自動的に呼ばれていSVN後のコミット).
- 場所は以下のコード内のコミットするbatファイル(通話後のコミットcmdファイルを渡すと、パラメータSVN自動的にパス%1は、リポジトリ、%2の改訂した。
%~dp0 rac-ポスト-commitフック.cmd%1%2
- 現在のtrac-ポスト-commitフック.cmdファイルに以下の
@ECHO OFF
::
::Trac ポスト-commitフックスクリプト Windows
::
::寄 パトリシアフィスター変更によるcboos.
::使用量:
::
::1)に挿入し インストール後のコミットするバット スクリプト
::
::電話 %~dp0 rac-ポスト-commitフック.cmd%1 %2
::
::2)チェックインの変更 パス'セクション以下、電池が漏液するおそれがあ 少なくともTRAC_ENV
:: ----------------------------------------------------------
::変更-パスはこちら
::-- この 必要 設定する
セット TRAC_ENV=C: rac\MySpecialProject
::--セットがPythonでないの システムパス
::セット PYTHON_PATH=
::--設定 フォルダを含むtrac/インストールされた場合、 標準以外の場所
::セット TRAC_PATH=
:: ----------------------------------------------------------
::実行しないフックの場合trac 環境が存在しない
ない場合 存在%TRAC_ENV%後藤EOF
set PATH=%PYTHON_PATH%;%PATH%
セット PYTHONPATH=%TRAC_PATH%;%PYTHONPATH%
設定REV=%2
::を取得し 著者のログメッセージ
のために/F %%A('svnlook著者-r%REV%%1') doセットAUTHOR=%%A
のために/F "delims=="%%B('svnlookログ-r %REV%%1')な設定ログ=%%B
::のPYTHONスクリプト
Python "%~dp0 rac-ポスト-commitフック"-p "%TRAC_ENV%"-r"%REV%"-u"%著%" -m%ログ%"
最も重要な部品はここでの設定によりTRAC_ENVるリポジトリへのパスを根(TRAC_ENV=C: rac\MySpecialProject)
次に大きく重要なことでこのスクリプトは、次のように行います:
::の著者のログ メッセージ
のために/F%%A('svnlook 著者-r%REV%%1')セット AUTHOR=%%A
のために/F"delims=="%%B ('svnlookログ-r%REV%%1')セット ログ=%%B
された場合は、スクリプトファイル上記を使用していsvnlook(コマンドライン用とSVN)を取得し、ログメッセージの著者としてのコミットのリポジトリ
そして、次の行のスクリプトは、実際にはPythonコードの実行を終了チケットと構文解析では、ログメッセージ。があったのをいつでも変更することを通のログメッセージの著者は、ユーザ名を使用しているTracのユーザ名にSVNでいる。
のPYTHONスクリプト
Python "%~dp0 rac-ポスト-commitフック"-p "%TRAC_ENV%"-r"%REV%"-u"%著%" -m%ログ%"
上記のスクリプトは、pythonスクリプトのTrac環境の改正では、人とのコミットし、そのコメントとなります。
ここではPythonスクリプトを使いました。もしっかりとした追加のスクリプトを使用していまカスタムフィールド(fixed_in_verに使われている当社のQAチームだ場合、直ちの妥当性を検証では、バージョンのコードが彼らの試験にQA.そこで、変更のコードをpythonスクリプトをアップデート分野でのチケットとなります。を除去することができるコードなので、そのために何ができるか更新カスタム項目をTracきたいと思いました。
かったことにより、任意のユーザーなどのコメントのようなもの:
(バージョン2.1.2223.0)
その後、同じ技術を使用するにはpythonスクリプト用の正規表現情報を取得します。ないと言えるでしょう。
とにかく、ここでは、pythonスクリプトを使って、今のストリートビューなどかったのですが、windowsの世界ですべて活用できる自分の店...
ない場合でも思った私は追加のコードを更新するためのカスタムフィールドを取得しベースのスクリプトからこの場所として記述したクレイグ上記(スクリプトからEdgewall)
#!/usr/bin/env python
# trac-post-commit-hook
# ----------------------------------------------------------------------------
# Copyright (c) 2004 Stephen Hansen
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
# ----------------------------------------------------------------------------
# This Subversion post-commit hook script is meant to interface to the
# Trac (http://www.edgewall.com/products/trac/) issue tracking/wiki/etc
# system.
#
# It should be called from the 'post-commit' script in Subversion, such as
# via:
#
# REPOS="$1"
# REV="$2"
# LOG=`/usr/bin/svnlook log -r $REV $REPOS`
# AUTHOR=`/usr/bin/svnlook author -r $REV $REPOS`
# TRAC_ENV='/somewhere/trac/project/'
# TRAC_URL='http://trac.mysite.com/project/'
#
# /usr/bin/python /usr/local/src/trac/contrib/trac-post-commit-hook \
# -p "$TRAC_ENV" \
# -r "$REV" \
# -u "$AUTHOR" \
# -m "$LOG" \
# -s "$TRAC_URL"
#
# It searches commit messages for text in the form of:
# command #1
# command #1, #2
# command #1 & #2
# command #1 and #2
#
# You can have more then one command in a message. The following commands
# are supported. There is more then one spelling for each command, to make
# this as user-friendly as possible.
#
# closes, fixes
# The specified issue numbers are closed with the contents of this
# commit message being added to it.
# references, refs, addresses, re
# The specified issue numbers are left in their current status, but
# the contents of this commit message are added to their notes.
#
# A fairly complicated example of what you can do is with a commit message
# of:
#
# Changed blah and foo to do this or that. Fixes #10 and #12, and refs #12.
#
# This will close #10 and #12, and add a note to #12.
import re
import os
import sys
import time
from trac.env import open_environment
from trac.ticket.notification import TicketNotifyEmail
from trac.ticket import Ticket
from trac.ticket.web_ui import TicketModule
# TODO: move grouped_changelog_entries to model.py
from trac.util.text import to_unicode
from trac.web.href import Href
try:
from optparse import OptionParser
except ImportError:
try:
from optik import OptionParser
except ImportError:
raise ImportError, 'Requires Python 2.3 or the Optik option parsing library.'
parser = OptionParser()
parser.add_option('-e', '--require-envelope', dest='env', default='',
help='Require commands to be enclosed in an envelope. If -e[], '
'then commands must be in the form of [closes #4]. Must '
'be two characters.')
parser.add_option('-p', '--project', dest='project',
help='Path to the Trac project.')
parser.add_option('-r', '--revision', dest='rev',
help='Repository revision number.')
parser.add_option('-u', '--user', dest='user',
help='The user who is responsible for this action')
parser.add_option('-m', '--msg', dest='msg',
help='The log message to search.')
parser.add_option('-c', '--encoding', dest='encoding',
help='The encoding used by the log message.')
parser.add_option('-s', '--siteurl', dest='url',
help='The base URL to the project\'s trac website (to which '
'/ticket/## is appended). If this is not specified, '
'the project URL from trac.ini will be used.')
(options, args) = parser.parse_args(sys.argv[1:])
if options.env:
leftEnv = '\\' + options.env[0]
rghtEnv = '\\' + options.env[1]
else:
leftEnv = ''
rghtEnv = ''
commandPattern = re.compile(leftEnv + r'(?P<action>[A-Za-z]*).?(?P<ticket>#[0-9]+(?:(?:[, &]*|[ ]?and[ ]?)#[0-9]+)*)' + rghtEnv)
ticketPattern = re.compile(r'#([0-9]*)')
versionPattern = re.compile(r"\(version[ ]+(?P<version>([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+))\)")
class CommitHook:
_supported_cmds = {'close': '_cmdClose',
'closed': '_cmdClose',
'closes': '_cmdClose',
'fix': '_cmdClose',
'fixed': '_cmdClose',
'fixes': '_cmdClose',
'addresses': '_cmdRefs',
're': '_cmdRefs',
'references': '_cmdRefs',
'refs': '_cmdRefs',
'see': '_cmdRefs'}
def __init__(self, project=options.project, author=options.user,
rev=options.rev, msg=options.msg, url=options.url,
encoding=options.encoding):
msg = to_unicode(msg, encoding)
self.author = author
self.rev = rev
self.msg = "(In [%s]) %s" % (rev, msg)
self.now = int(time.time())
self.env = open_environment(project)
if url is None:
url = self.env.config.get('project', 'url')
self.env.href = Href(url)
self.env.abs_href = Href(url)
cmdGroups = commandPattern.findall(msg)
tickets = {}
for cmd, tkts in cmdGroups:
funcname = CommitHook._supported_cmds.get(cmd.lower(), '')
if funcname:
for tkt_id in ticketPattern.findall(tkts):
func = getattr(self, funcname)
tickets.setdefault(tkt_id, []).append(func)
for tkt_id, cmds in tickets.iteritems():
try:
db = self.env.get_db_cnx()
ticket = Ticket(self.env, int(tkt_id), db)
for cmd in cmds:
cmd(ticket)
# determine sequence number...
cnum = 0
tm = TicketModule(self.env)
for change in tm.grouped_changelog_entries(ticket, db):
if change['permanent']:
cnum += 1
# get the version number from the checkin... and update the ticket with it.
version = versionPattern.search(msg)
if version != None and version.group("version") != None:
ticket['fixed_in_ver'] = version.group("version")
ticket.save_changes(self.author, self.msg, self.now, db, cnum+1)
db.commit()
tn = TicketNotifyEmail(self.env)
tn.notify(ticket, newticket=0, modtime=self.now)
except Exception, e:
# import traceback
# traceback.print_exc(file=sys.stderr)
print>>sys.stderr, 'Unexpected error while processing ticket ' \
'ID %s: %s' % (tkt_id, e)
def _cmdClose(self, ticket):
ticket['status'] = 'closed'
ticket['resolution'] = 'fixed'
def _cmdRefs(self, ticket):
pass
if __name__ == "__main__":
if len(sys.argv) < 5:
print "For usage: %s --help" % (sys.argv[0])
else:
CommitHook()
他のヒント
ベンヤミンから回答ありがWindowsであらかじめ与えておく必要があり、フックスクリプトファイル、実行ファイル拡張しています。batいます。cmd.は使用します。cmd.きのテンプレートスクリプトをunixのシェルスクリプト、シェルスクリプトに変換します。bat/.cmd構文です。
もとは何者か"という問いに答えを統合Trac、下記の手順をお試しください。
保Python.exe のシステムのパスです。ここにつけることができます。
ェクトを作り出す。cmdりフックのフォルダにまとめた。これは、実際のフックスクリプトとSubversionを実行しのコミットイベントです。
@ECHO OFF :: 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.collab.net/repos/svn/trunk/tools/hook-scripts/ and :: http://svn.collab.net/repos/svn/trunk/contrib/hook-scripts/ setlocal :: Debugging setup :: 1. Make a copy of this file. :: 2. Enable the command below to call the copied file. :: 3. Remove all other commands ::call %~dp0post-commit-run.cmd %* > %1/hooks/post-commit.log 2>&1 :: Call Trac post-commit hook call %~dp0trac-post-commit.cmd %* || exit 1 endlocal
をtrac-ポスト。cmdりフックのフォルダ:
@ECHO OFF :: :: Trac post-commit-hook script for Windows :: :: Contributed by markus, modified by cboos. :: Usage: :: :: 1) Insert the following line in your post-commit.bat script :: :: call %~dp0\trac-post-commit-hook.cmd %1 %2 :: :: 2) Check the 'Modify paths' section below, be sure to set at least TRAC_ENV setlocal :: ---------------------------------------------------------- :: Modify paths here: :: -- this one *must* be set SET TRAC_ENV=D:\projects\trac\membershipdnn :: -- set if Python is not in the system path SET PYTHON_PATH= :: -- set to the folder containing trac/ if installed in a non-standard location SET TRAC_PATH= :: ---------------------------------------------------------- :: Do not execute hook if trac environment does not exist IF NOT EXIST %TRAC_ENV% GOTO :EOF set PATH=%PYTHON_PATH%;%PATH% set PYTHONPATH=%TRAC_PATH%;%PYTHONPATH% SET REV=%2 :: Resolve ticket references (fixes, closes, refs, etc.) Python "%~dp0trac-post-commit-resolve-ticket-ref.py" -p "%TRAC_ENV%" -r "%REV%" endlocal
の作成trac-post-commit-resolve-ticket-ref.py りフックのフォルダにまとめた。使用した 同スクリプトからEdgeWall, みっと改称により明確にします。
ポストcommitフックスの"フック"ディレクトリがままのリポジトリに住む、サーバ側です。がわかりませんそのときには、この、あくまで目安ですが、例えば、
例えば(windows):
C:\Subversion\repositories\repo1\hooks\post-commit
例えば(llinux/unix):
/usr/local/subversion/repositories/repo1/hooks/post-commit
一つのこと私は追加のコードサルの答えは完璧"では注意が必要なこ(失敗)
:: Modify paths here:
:: -- this one must be set
SET TRAC_ENV=d:\trac\MySpecialProject
:: -- set if Python is not in the system path
:: SET PYTHON_PATH=**d:\python**
:: -- set to the folder containing trac/ if installed in a non-standard location
:: SET TRAC_PATH=**d:\python\Lib\site-packages\trac**
したことがなかったのでセットのシステムの経路からの明らかなD
で試合を確かなものと同じ間違い無し!ココモンキーです!1000000000ポイント:D
最初の大きさをコードモンキーです!
しかし、大切なのは、正しい知識を身につけましょうpythonスクリプトによってtracバージョン。の適切なバージョン,SVNのフォルダー:
http://svn.edgewall.com/repos/trac/branches/xxx-安定した/contrib
場所 xxx に対応したドはオートメーションだけで使用し、たとえば、次のようになります。0.11
その他多くの後のコミットエラーが発生するようになります:
コミットに失敗した(詳細従):合併の'/svn/プロジェクトの/trunk/web/ディレクトリ/':200OK
すべてのWindowsユーザーにしたいト最新のtrac(0.11.5):の指示に従って操作してくださいTracのサイト名TracOnWindows.
ダウンロード32bit1.5Pythonいていても、64bitのosはWindowsです。注意:見どこかにコンパイルのtracで働ネイティブに64bitシステム。
インストールするとすべての必要なく、リポジトリのフォルダにまとめた。あるフォルダのフック.内部でファイルのコードモンキ、ゴの作成"trac-post-commit-resolve-ticket-ref.py"のように同じものができた。相談Quantアナリストを行ないつもりだと公式に述べている
"しかし、大切なのは、正しい知識を身につけましょうpythonスクリプトによってtracバージョン。の適切なバージョン,SVNのフォルダー:http://svn.edgewall.com/repos/trac/branches/xxx-安/contrib xxxに対応したドはオートメーションだけで使用し、たとえば、次のようになります。0.11"
からあdownoadファイル"trac-ポスト-commitフック"に入れてフックフォルダにまとめた。
編集これらのラインのtrac-ポスト。cmd
設定PYTHON_PATH="パスへのpythonインストールフォルダ"
設定TRAC_ENV="パフォルダの場所 たtracd initenv"
覚えていない最後\!!!
私は外からの引用は前線-r"%REV%"する-r%REV%があまりないと思いますかこれが必要です。これは動作しない(少なくとも私の勝利2008年のサーバー)がフックに失敗します(コミットまでokを押します。こういったとのアクセス権を表します。デフォルトのアクセス権が制限されていま択することを許容する必要があるpythonはsvnはtrac(どっかの変更tracます。なので自分のtracのフォルダー、プロジェクトのフォルダに、dbフォルダを右クリックしてtrac.dbプロパティ]を選択します。の安全保障のタブでの編集権限を可能に制御が移ります。こないのではないの確保が無駄にすべて日本セキュリティの問題およびならないようにしたい廃棄物を別のグラフィティのためのユーザーを有効にする必要があアクセス権を表します。
武器agiは、dexで下がらないboxerぐ....