BugTracker.Net设置问题

ExpandedBlockStart.gif 代码
#  Copyright 2009 Corey Trager
#
 Distributed under the terms of the GNU General Public License

import  sys
import  subprocess
import  re
import  urllib
import  os

# ######################################################################
#
#
 See svn documentation for how to install a hook script.
#
#
######################################################################


# ######################################################################
#
#
 !!!   Start of stuff you need to change
#
#
#######################################################################

#  BugTracker.NET username and password.  The username needs to match
#
 a setting in Web.config.
btnet_username  =   " wxy "
btnet_password 
=   " wxy "

#  The path to the svn executable
#
 下面这一行,不能依照官方模板的格式来,,这一行花了我整整一个晚上
svn_path  =   " C:\\Program Files\\CollabNet\\Subversion Server\\svn.exe "
#  The URL needs to be reachable from the machine where this script is
#
 running.  (I have a virtual directory named "btnet").  Don't
#
 use IIS windows security on svn_hook.aspx.
btnet_url  =   " http://10.129.250.99/BugTracker/svn_hook.aspx "

#  The repository URL. BugTracker.NET web pages will use this URL to 
#
 interact with this repository.  If you need a username and password
#
 to access this repo, you configure that in Web.config.  See
#
 Web.config for more info.
this_repository_url  =   " http://10.129.250.99:81/svn/TeacherManager "

bDebug 
=  True

# ######################################################################
#
#
 !!!   End of stuff you need to change
#
#
######################################################################


# ######################################################################
#
 for debugging, display info and keep a log
#
######################################################################
def  debug_out(s):
    
if  (bDebug):
        f 
=  open((os.environ[ " TEMP " ])  +   ' \\btnet_svn_hook_log.txt ' ' a ' )
        f.write(s)
        f.write(
' \n ' )
        f.close    
        
print  s

repo 
=  sys.argv[ 1 ]
rev 
=  sys.argv[ 2 ]
debug_out(repo)
debug_out(rev)

# ######################################################################
#
#
 This is where this script keeps track of previously processed
#
 revisions. If you delete this file, this script will send log info
#
 for ALL revisions to BugTracker.NET.  You might want to do that to
#
 reload the svn_revisions and svn_affected_paths tables.
#
#
######################################################################

prev_revision_file 
=  repo  +   " \\hooks\\btnet_prev_revision.txt "
debug_out(prev_revision_file)


# ######################################################################
#
 Get the log info from svn
#
 If we've already fetched info in the past, just fetch the info
#
 since the last revision
#
######################################################################

#  get the previous revision
try :
    most_recent_revision_file 
=  open(prev_revision_file, " r " )
    prev_revision 
=  most_recent_revision_file.read( 40 )
    most_recent_revision_file.close() 
except :
    prev_revision 
=   ""

debug_out(
" prev_revision " )
debug_out(prev_revision)

#  just since previously processed revision

file_url 
=   "  file:/// "   +  repo.replace( " \\ " , " / " )
subcommand 
=   "  log --verbose --xml  "

if  prev_revision  !=   "" :
    cmd 
=  svn_path  +  subcommand  +   "  -r  "   +  prev_revision  +   " : "   +  rev  +  file_url
else :
    cmd 
=  svn_path  +  subcommand  +  file_url

debug_out(cmd)

process 
=  subprocess.Popen(cmd, stdout = subprocess.PIPE, stderr = subprocess.PIPE)
debug_out(
" log stdout: " )
log_string 
=  process.stdout.read()
debug_out(log_string)
debug_out(
" stderr: " )
debug_out(process.stderr.read())

#  remember that we already processed this revision
most_recent_revision_file  =  open(prev_revision_file, " w " )
most_recent_revision_file.write(rev)
most_recent_revision_file.close()


#  get the first revision in the log string and save it to the file.

# ######################################################################
#
 send an http request to BugTracker.NET, the svn_hook.aspx page.
#
######################################################################

params 
=  urllib.urlencode({
    
' svn_log ' : log_string,
    
' repo ' : this_repository_url,
    
' username ' : btnet_username,
    
' password ' : btnet_password})

response 
=  urllib.urlopen(btnet_url, params)
data 
=  response.read()
debug_out(data)

 

转载于:https://www.cnblogs.com/shiningrise/archive/2009/12/02/1614968.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值