Create integration batch file for Perforce using PERL
Posted on 2004-09-01
We use Perforce and are constantly having to create batch files for branching reasons (branching = integration in Perforce).
The current process is fairly tedious and seems like a good candidate for some PERL functionality. So, let's see if I can 'splain it Lucy:
On a Free BSD UNIX box I create a text file with the following:
"p5 pkg 021638 > 021638.txt"
Where "021638" is our Change request number, although it's frequently referenced as "21638" so a check for the leading zero would be helpful.
The contents of 021638.txt contains (partial cut & paste):
Normally, I mail this file to myself and change the entries as follows:
p4 integ -b DevMaintBranch -s "//system/dev/DevMaintBranch/ECS/WebCode/bin/course/cust/terc/BioFormPreview.learn" //...
p4 integ -b DevMaintBranch -s "//system/dev/DevMaintBranch/ECS/WebCode/bin/course/cust/terc/BioFormView.learn" //...
p4 integ -b DevMaintBranch -s "//system/dev/DevMaintBranch/ECS/WebCode/bin/course/cust/terc/FormIncludes/Edit_ASLP.inc" //...
p4 integ -b DevMaintBranch -s "//system/dev/DevMaintBranch/ECS/WebCode/bin/course/cust/terc/FormIncludes/Edit_ESTU.inc" //...
So basically, I add
p4 integ -b DevMaintBranch -s "
to the beginning and
to the end of the line.
In "p4 integ -b DevMaintBranch -s ", the "DevMaintBranch" portion is derived from the path of the file (//system/dev/*DevMaintBranch*/ECS/...)
Seems easy enough for PERL...I would really appreciate any help you may be able to provide. I'd like to simply call the perl script with the change number and end up with a batch file (for WinXP) that performs the Perforce integrations.