Create Client Workspace Using Perforce Command-line On Ubuntu


Answer :

For my builds I have a text file, which I have in perforce, containing my client. That way I know what the client looked like at that build (I don't use a spec depot).


So on unix machines:


$ cat client.txt | p4 client -i


or for windows:


type client.txt | p4 client -i


creates the client from the txt file in perforce. You can create the text by doing a p4 client -o <client_name> >client.txt and change it from there.



You probably want to try p4 client -i. From the help page:




The -i flag reads a client specification from the standard input. The user's editor is not invoked.




So you construct your client-spec in a script and pass it to p4 client -i. Additionally, -t could be helpful, too:




The -t flag constructs the client view by using the specified client's view and options as a template, instead of using the existing view or creating a new default view.




I use heredocs to minimize the need for temporary files



export P4CLIENT=tmp_$$
p4 client -i <<HERE
Client: ${P4CLIENT}
Root: /tmp/${P4CLIENT}
Stream: //OurStreamDepot/${branch}
HERE


You only need to specify the Client:, Root: and Stream: fields (or View: if you are using the older //depot style)



Comments

Popular posts from this blog

C Perror Example

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"