[p4] Better understanding of +/- client spec syntax

Stephen Vance steve at vance.com
Thu Aug 10 10:49:48 PDT 2006


The right hand side of a '-' is very useful. Let's say you have a 
workspace and inside it you have directories that you know contain built 
object files, libraries, and executables that you never want to check 
in. If you are operating disconnected or importing source code from a 
third part and want to do a mass add, Perforce will never consider those 
files on the right hand side for add. Don't forget that the right hand 
side applies to what in your workspace while the left hand side is 
what's in the depot.

For another example, let's take a different use for client views, 
remapping extensions.

//depot/main/...   //view/...
-//depot/main/include/....h   //view/include/....h
//depot/main/include/....h   //view/include/....hpp

Without the second line, if I create a .h file in //view/include, add 
it, and sync, it will come back as .hpp, as a different file from what I 
put in. With the second line, it prevents me from adding files that lead 
to ambiguous mappings.

As for the '+', it's a way to have files from two different directories 
sync to the same directory in your workspace, generally assuming that 
there aren't files of the same name in both locations. I try to avoid 
using it personally. I find that a better source organization is a 
better solution, but if you're stuck with a legacy tree or outvoted on 
the right way to do it, it's a good tool to have.

Steve

Steven W. Orr wrote:
> A while ago I asked a clientspec question, but I want to ask a new one of 
> a more general nature. I'm trying to understand the +/- usage.
>
> Given multiple view lines in a clientspec with destination files mapped 
> from multiple sources, the last line is the winner. I get that part. I 
> like it and it makes sense.
>
>
> MINUS SIGNS
> I can use the "-" to prevent something from being selected. That's fine 
> with me.
> 1. Is the "-" of use if I'm depending on multiple mappings? IOW, if I 
> expect a file to be created and it could come from more than one place, is 
> there value in deselecting it from where I don't want it even though I get 
> it from the later match?
>
> Here's a contrived example:
> //depot/a/b/...        /view/a/b/...
> -//depot/a/b/c         /view/a/b/c
> //depot/x/y/c          /view/a/b/c
>
> Is the deselected line of any use?
>
> 2. Is the right hand side of a "-" a dummy or does it have any value at 
> all?
>
> PLUS SIGNS
> I have no idea what the value of "+" is. If I specify a plus sign to 
> override something that was previously selected earlier, then it would 
> have been picked off anyways.
>
> //depot/a/b/...        /view/a/b/...
> +//depot/x/y/c          /view/a/b/c
>
> Does someone have an example of a plus usage that makes sense?
>
> TIA
>
>   


More information about the perforce-user mailing list