# Trigger to block submission of changelists which contain any variation of # "do not submit" (case/spacing insensitive) on the first line of the changelist # description. # # Author: Joe Robinson # Created: 2013/06/26 # Edited: %% # File: DoNotSubmit.py from sys import argv import sys, re, marshal #filename, changelistNum, serverDirectory, dictionaryFile = argv # TEST PARAMS #----- valid = re.compile(r"^..(DO).(NOT).(SUBMIT)$") changelistNum = 0 dictionaryFile = open('text.txt', 'rb') dictionary = marshal.load(dictionaryFile) # Assign description field to string #----- descField = str(dictionary[b'desc']) print ("DESC: %s" % (descField)) re.sub('_', '') print("Top comment line is: %s" % "placeholderline") # Exit with error message if string is found. # if desc field matches regular expression: ^do.not.submit$ if (valid.match(descField)): print(" --- REJECTED submitted changelist.") sys.exit("PY script rejecting \'DO NOT SUBMIT\' changelist %i." % changelistNum) # Else if string is not found: print(" --- ACCEPTED submitted changelist %i." % changelistNum) sys.exit(0)
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#5 | 8328 | Joe Robinson |
Added completed bash script. License file. |
||
#4 | 8325 | Joe Robinson |
File housekeeping - cleaned up spacing and obsolete comments. Removed '-u' flag. 'userArg' now part of admin options. |
||
#3 | 8323 | Joe Robinson |
Fixed regex matching. Command-line options parsing and changelist dictionary retrieval implemented. Does not check for Python version. Works with Python3.3+. |
||
#2 | 8321 | Joe Robinson |
Almost fixed regex matcher. Detects built-in test string, does not detect dictionary test string. |
||
#1 | 8320 | Joe Robinson |
First test version of py version. Fixed file paths. |
||
//guest/joe_robinson/main/projects/DoNotSubmit/src/DoNotSubmit.py | |||||
#1 | 8316 | Joe Robinson | Added blank .rb and .py files. |