perforceperforce-client-spec

through command line automation, create/edit client specification view


I have two directories like:

//A/B/C/Folder-One/

//A/B/C/D/Folder-Two/

Now, in automation I want to map above these paths to one client and sync it.

like //A/B/C/Folder-One/ //MYClient/Folder-One/... //A/B/C/Folder-Two/ //MYClient/Folder-Two/...

Can any one help me how can I achieve that through automation?

Assumption note: In the current directory, I have .perforce file where respective variables are configured and p4 client -o is also working correctly.


Solution

  • The --field undoc option makes this pretty easy:

    p4 --field "View+=//A/B/C/Folder-One/... //MYClient/Folder-One/..." client -o | p4 client -i
    p4 --field "View+=//A/B/C/Folder-Two/... //MYClient/Folder-Two/..." client -o | p4 client -i
    

    See p4 help undoc and also this blog post: https://www.perforce.com/blog/vcs/20161-command-line-roundup