import re report = '/home/fvlingen/programFiles/CMS_CVS/PRODAGENT/cvsStatusPC.txt' release = 'PRODCOMMON_0_12_10_pre2' prefix = 'CMSSW/COMP/PRODCOMMON' pattern = re.compile('(.*'+release+' |.*'+release+'\t)') reportFile = open(report, 'r') line = reportFile.readline() #add whitespace to prevent finding substrings release = ' '+release+' ' state = 'file' fileName = ' ' currentVersion= ' ' tagRevision= ' ' #files that where updated since the release updated = [] # files that where missed missed = [] isItTagged = False while line: if line.startswith('File:'): # process last file data. if fileName != ' ': if isItTagged and currentVersion != tagRevision: updated.append(fileName) if not isItTagged: missed.append(fileName) state = 'file' isItTagged = False if line.find('Working revision') > -1: currentVersion = line.split(' ')[-1].split('\t')[-1].split('\n')[0] if line.find('Repository revision') > -1: fileName = line.split('\t')[-1].split(',')[0] index = fileName.find(prefix) fileName = fileName[index + 10:] state = 'tag' if pattern.match(line) and state == 'tag': state = 'file' tagRevision = line.split(' ')[-1].split(')\n')[0] isItTagged = True line = reportFile.readline() #check last analyzed file. if fileName != ' ': if isItTagged and currentVersion != tagRevision: updated.append(fileName) if not isItTagged: missed.append(fileName) reportFile.close() print 'summary for checking head against tag: '+release print 'Updated files:' updated.sort() for file in updated: print file print 'Missed files:' missed.sort() for file in missed: print file