Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get the perforce root directory from command line?

Tags:

perforce

How do I get the perforce root directory from the command line? I've tried p4 info but I'd rather not have to filter this to get at the root. I'm sure there's a way, but I couldn't find it.

Is there a way to get the root in a context sensitive way? For example if I have two workspaces with a hierarchy like A/.../script vs B/.../script I'd expect that the script would return either A or B depending on where it was run from.

like image 247
thisisdog Avatar asked Feb 16 '14 08:02

thisisdog


2 Answers

If you want your client root in one command run:

p4 -F %clientRoot% -ztag info

You will need the 2014.1 later version of p4 to use this flag.

like image 131
Matt Avatar answered Sep 28 '22 15:09

Matt


From OP’s description, they probably want p4 where. For example, if the client root is /perforce/projects, then

p4 where //depot/project-1/module-2

will give /perforce/projects/project-1/module-2. Credit from Bryan’s comment.

like image 30
Franklin Yu Avatar answered Sep 28 '22 15:09

Franklin Yu