Take the 2-minute tour ×

Hello, my question is regarding a Python script I am trying to get to work. The point of this is that when someone makes a SVN Commit they see a login template with four lines: Branch, Bug_Number, Feature affected and Overview. Now I am trying to write a script to make sure that they wrote something on it to make sure no one enters a empty log to commit.

Here is what I have so far in python its based on a old python script.

    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:  

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    
 ret = 0  
 print "Finishing the script"  

Any advice would help. I am using Windows XP and currently nothing is happening. I am also using collabnet svn. Currently nothing is happening when I try to run this script. I know I haven't added svnlook in the script I cant really think of where to add and for the variable for it. Thank you.

share|improve this question
Your indentation is all screwed up... –  Colin Dunklau Aug 7 '12 at 19:49
How is my indentation messed up? I am adding it as good as I can, and it seems readable compared to before. Or are you saying my "indentation" as something else besides grammer that is causing the code to not work? –  Gilbert V Aug 7 '12 at 19:55
It's screwed up because we should be able to just cut and paste this into a program and run it and we can't...because it's screwed up. Try it! –  Gerrat Aug 7 '12 at 19:58
I have no idea if the code you've provided matches the code you're running. In Python, indentation is used for more than readability, it has actual syntactical significance. If I copy that script and try to run it, I get IndentationErrors. –  Colin Dunklau Aug 7 '12 at 19:59
Ahh okay then, That would explain it. Sorry this was an old python script and I didn't know about those errors, And yes it is the code I am running but since nothing is happening I goes through it I guess. This was actually used on the old CVS repository and they wanted it back there and said it should just be able to drop right in. Guesss not. Will try to look at it to see what is happening. –  Gilbert V Aug 7 '12 at 20:15

Your Answer



Browse other questions tagged or ask your own question.