import sys
from p4 import P4
import tracker
p4 = P4()
p4.client = 'bruno_ws'
p4.port = '1888'
p4.user = 'P4DTI-replicator0'
p4.parse_forms()
sys.stdout.write('*** Warning - do you want to delete jobs for server %s?' %(p4.port))
sys.stdout.write(' ')
sys.stdout.flush()
if sys.stdin.readline()[0] in 'yY':
sys.stdout.write('Enter job id upto which to delete issues:')
sys.stdout.write(' ')
sys.stdout.flush()
endid = int(sys.stdin.readline())
endjob = "SCR%06d" % endid
try:
p4.connect()
jobs = p4.run_jobs()
for j in jobs:
if j['Job'] == endjob:
break
print p4.run("job", "-d", j['Job'])
except:
print p4.errors