[p4] Modify the default changelist description

Noah Salzman noah at ncircle.com
Thu Jun 1 19:30:56 PDT 2006


On Jun 1, 2006, at 9:04 AM, Adam Howitt wrote:

> I have looked in p4 client and p4 change but I can't find a way to
> edit the <enter description here> piece on a per user basis to let
> each of our team members start with our custom outline:
> <client - branch - description of change>


You want a "form out / change" trigger. Haven't done it myself but  
I'm guessing the trigger would run a script similar to this. I have  
no idea if this works... haven't tried it... just modified the  
example in the Perforce docs.


Trigger
----------
sample3  form-out  change  "default_change.pl %formname% %formfile%"


default_change.pl
--------------------------
#!/usr/bin/perl

$p4 = "p4 -p localhost:1666";
$formname = $ARGV[0];  # from %formname% in trigger table
$formfile = $ARGV[1];  # from %formfile% in trigger table

# Default server-generated workspace view and modified view
# (Note: this script assumes that //depot is the only depot defined)
$defaultin = "\t<enter description here>\n";
$defaultout = "\t<client - branch - description of change>\n";


# Build a modified spec based on contents of %formfile%
$modifiedform = "";
open FORM, $formfile or die "Trigger couldn't read form tempfile";
while ( <FORM> )
{       ## Do the substitution as appropriate.
         if ( m:$defaultin: ) { $_ = "$defaultout"; }
         $modifiedform .= $_;
}

# Write the modified spec back to the %formfile%,
open MODFORM, ">$formfile" or die "Couldn't write form tempfile";
print MODFORM $modifiedform;
exit 0;



More information about the perforce-user mailing list