Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

p4 sync, how do you exclude files while using wildcards?

Tags:

perforce

I'm trying to use p4 sync to sync a specific directory to a given changelist number using wildcards but I also want to exclude a list of files that are under that directory (in subdirectories), I tried using - (both before and after using a path with wildcards) but the file never gets excluded, this the command I'm trying:

p4 sync //Repo/Foo/... -//Repo/Foo/Bar/Foobar.txt

The file exclusion seems to only work when the files/directories you are syncing don't match the files you're trying to exclude.

like image 230
snk_kid Avatar asked Oct 12 '11 13:10

snk_kid


2 Answers

In your client, you would have multiple lines:

//Repo/Foo/... //my_client/Repo/Foo/...
-//Repo/Foo/subdirectory/... //my_client/Repo/Foo/subdirectory/...

This would allow you to get everything in the Foo directory and all subdirectories except "subdirectory".

like image 105
Graeme Perrow Avatar answered Jan 02 '23 19:01

Graeme Perrow


You can do this if you use a label. Create a label in your favorite editor (p4v or command line p4 label and add your two lines:

//Repo/Foo/...
-//Repo/Foo/Bar/Foobar.txt

In the revision field put "#head" (including quotes!) if you want the latest or a change list number. Give the label a name - for instance "sync_butnot_foobar"

On the command line you can now sync:

p4 sync @sync_butnot_foobar,@sync_butnot_foobar

This has a huge benefit over the modify your client spec and sync head model. If you exclude a file in your client spec, the next time you sync that file will be brought to revision 0 which probably isn't what you wanted.

like image 45
John Harvey Avatar answered Jan 02 '23 21:01

John Harvey