2

您好,我的问题是关于我要开始工作的 Python 脚本。这样做的重点是,当有人进行 SVN 提交时,他们会看到一个包含四行的登录模板:BranchBug_Number和。现在我正在尝试编写一个脚本,以确保他们在上面写了一些东西,以确保没有人输入一个空日志来提交。Feature affectedOverview

这是我迄今为止在 python 中所拥有的,它基于一个旧的 python 脚本。

    print "Importing the items"

import re  
 import sys  
 import os   

print "Initializing the list."  

argsList = []  
 hndFile = open(sys.argv[1],"r")  
 for line in hndFile:  
 argsList.append(line)  
 hndFile.close()   

print "Checking what is blank"  
 faOK = ovOK = False  
 for line in argsList:  
 line = line.strip()  
 if line.startswith('FEATURE_AFFECTED:'):  
 faOK = line[17:] != ''    
 if line.startswith('OVERVIEW:'):  
 ovOK = line[9:] != ''   

if not faOK:      
 print "You Must Enter the Feature Affected"    
 ret = -1  
 elif not ovOK:  
 print "You Must Enter an Overview of the Fix"  
 ret = -1    
 else:  
 ret = 0  
 print "Finishing the script"  
 sys.exit(ret)   

任何建议都会有所帮助。我正在使用 Windows XP,目前没有任何事情发生。我也在使用collabnet svn。目前,当我尝试运行此脚本时,什么都没有发生。我知道我没有在脚本中添加 svnlook,我真的想不出在哪里添加以及为它添加变量。谢谢你。

4

0 回答 0