Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps!

We spend hours on Instagram and YouTube and waste money on coffee and fast food, but won’t spend 30 minutes a day learning skills to boost our careers.
Master in DevOps, SRE, DevSecOps & MLOps!

Learn from Guru Rajesh Kumar and double your salary in just one year.


Get Started Now!

Customize changelist description field with templates

rajeshkumar created the topic: Customize changelist description field with templates
The way most of our customers add additional fields to the change description is with the use of triggers and scripts that add extra fields within the “description” field.
www.perforce.com/perforce/doc.current/ma…cmdref/triggers.html
As an example:
add-fields.py:

*********************

#!/usr/bin/python

import os
import sys
import re
import random

users = [ “cpflaum”,”cpflaum2″ ]
user = sys.argv[2]
user = user.lower()

if user in users:
tempfile = str(random.random())
input = open(sys.argv[1], “r”)
output = open(tempfile, “w”)

for line in input.readlines():
if re.search(““, line):
output.write(line)
output.write(“\n\tMy Additonal field 1=\n”)
output.write(“\n\tMy Additonal field 2=\n”)
else:
output.write(line)

input.close()
output.close()

os.remove(sys.argv[1])
os.rename(tempfile, sys.argv[1])

********************
By – Chuck Pflaum <support@perforce.com>
Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
DevOps Certification, SRE Certification, and DevSecOps Certification by DevOpsSchool

Explore our DevOps Certification, SRE Certification, and DevSecOps Certification programs at DevOpsSchool. Gain the expertise needed to excel in your career with hands-on training and globally recognized certifications.

0
Would love your thoughts, please comment.x
()
x