[p4perl] Help creating client workspace from template
Tony Smith
tony at smee.org
Thu Apr 26 07:45:57 PDT 2007
Hi Nathan,
> I have the following code that uses an existing client workspace
> template to create a new client workspace. The client workspace seems to
> get created by the options and view mappings from the template are not
> preserved in the new client workspace. Here's a snipet of the code:
I think the problem is that you're not saving the output of the 'p4
client -o -t template client' command below:
> $p4->Run("client", "-o", "-t", $client_template, $client_name);
That command probably produces almost exactly what you want, but your script
discards it and then tries to recreate its effects, unsuccessfully.
> Does anyone have some code sample to create a new client workspace based
> on an existing template?
Try:
my $spec = $p4->FetchClient( "-t", $template, $clientName );
$spec->{ 'Root' } = $clientRoot;
$p4->SaveClient( $spec );
Obviously the variables used will need to be initialised, but that should do
the trick.
Tony
More information about the p4perl
mailing list