Page MenuHomePhabricator
Paste P476

Convert bug numbers to Phabricator ticket numbers
ActivePublic

Authored by Krenair on Apr 4 2015, 8:37 PM.
import glob, os, re
for fileName in glob.glob('*.php'):
outFile = open(fileName + '.out', 'w')
for line in open(fileName).read().splitlines():
matches = re.findall(r'Bug (\d+)', line, re.IGNORECASE)
if matches:
line = line.replace('Bug ' + matches[0], 'Bug T' + str(int(matches[0]) + 2000))
line = line.replace('bug ' + matches[0], 'Bug T' + str(int(matches[0]) + 2000))
outFile.write(line + "\n")
outFile.close()
os.rename(fileName + '.out', fileName)

Event Timeline

Krenair changed the title of this paste from untitled to Convert bug numbers to Phabricator ticket numbers.
Krenair updated the paste's language from autodetect to autodetect.
Krenair updated the paste's language from autodetect to python.Aug 12 2015, 4:21 PM