How to find the local perforce depot path? - perforce

I am trying to write a maven compile command and want it to work on my colleagues' machines as well, and since they have a different perforce depot path than mine, I need a unified way to find it.
I have tried p4 where but it didn't help.

When you run the p4 where command make sure that you're using the correct client workspace.
E.g.:
p4 set P4CLIENT=my_client_name
p4 where //depot/...
or:
p4 -c my_client_name where //depot/...
The example you describe of p4 where returning the wrong path indicates that it's giving the answer in terms of a different client workspace.

Related

perforce workspace command line

I'm trying to understand how perorce work and I'm struggling with command line
I have a single depot with 3 project inside
so depot:
projectA
projectB
now I have 2 workspaces, one mapped only on projectA and one on projectB.
Here I have my trouble , using interface everything works
but with command line I have not enough knoledge on perforce.
I use
p4 -c workspacA //to switch workspace
then I run: p4 cstat
and it give me all the information about changelist contained in all depot
not only depot/projectA
But I woul like to enter in a workspace and run my command only on that workspace
Is this normal? I see that I need to specify my depot mapping but this seems strange to me.
Can someone clarify me this?
Thanks
Do:
p4 set P4CLIENT=workspaceA
If you use -c workspaceA it applies only to that one command, whereas p4 set is persistent.
I also recommend looking at documentation on P4CONFIG, which lets you associate Perforce config settings with local directories (so you switch workspaces automatically when you cd to a different workspace root).
https://www.perforce.com/manuals/v16.2/cmdref/P4CONFIG.html

Perforce Code checkout in windows

My perforce server is running on Linux.
I installed Perforce client [command line] on windows. When I try to checkout the files using following commands:
p4 -u user -P passwd sync -f ...
I see that its refreshing all the files but not checking out. It could be related to directory structure problem in windows. [Linux and windows have different directory structures like "a/b" and "a\b".]
Please help me how to checkout the code base in this situation.
If by "refreshing all the files" you mean that you're getting their local copies, then that's exactly what p4 sync does. Don't expect it to check files out in the sense of marking them as being worked on by you. For that, use p4 edit.

Revert file in Perforce P4V from a different computer

I have a couple files checked out in Perforce on a different computer that I won't have access to until tomorrow. I received a request to revert them but I'm not sure how to do that from my home computer. I don't see an option and I can't find any results about this for the visual client. Is it even possible?
I ended up finding a suitable solution for myself.
I opened P4V and navigated to my workspaces. I edited the one with the checked out files and changed the workspace root and host to be from my current computer. After applying that, I was able to revert them as I normally would from the P4V client.
p4 revert takes as an option the client name, i.e workspace name.
From P4V>File> Open Command window here and try :
p4 revert -C *yourotherworkspace* -c changelist //...
If this is not enough you might have to add some global options settings like :
p4 -H remote_computer_name revert -C *yourotherworkspace* -c changelist //...

How to 'move' directories on Perforce/P4V without sync to local

I am trying to move a crazy amount of files on perforce.
It was almost done on my first attempt using p4 integ -v
However, the integ command 'copies' the selected files.
I have to delete the source files and leave only target files for some reason.
Next, I tried p4 move command. This command has no -v option with it.
It is also impossible to sync all files to my local machine. (tens of TB)
Does anyone know how to perform p4 move without actually sync it?
Now, I've tried -k option to fake perforce out:
p4 sync -k //src_dir/...
p4 edit //src_dir/...
p4 move -k //src_dir/... //tar_dir/...
But Perforce reports submit failed because I don't have //tar_dir in my local machine. Did I missed anything?
Unless you specifically require the "p4 move" semantics (e.g. maintaining atomicity of each add/delete pair when integrating to other branches -- and since it sounds like you're doing this on an entire branch or even multiple branches I'm guessing you DON'T want that), I'd recommend doing:
p4 copy -v //src_dir/... //tar_dir/...
p4 sync -k //src_dir/...
p4 delete -k //src_dir/...
p4 submit

P4 changes on a specific folder/file

I am trying to get the last checkin on a particular folder structure on perforce, I know "p4 changes -m1 'filepath" does the job, but the problem is the filepath has to be the depot file-path. What I have on the other hand is the local filepath something like "C:\Android\Version10.2\MyApp\" and not "//depot/Andoid/Version10.2/MyApp".
I tried using commands like "p4 fstat", "p4 where" and "p4 files", but for all of them it works fine with the depot file path, if I give the local file path, it keeps complaining file(s) not on client/no such file(s).
The other issue is I dont have rights to change the p4client on the machine. How do I get this to work?
Basic question then to sum up is being able to get the last change on a folder/file for which I have the local filepath.
Regards
If you're going to run any commands on files those files have to be in the workspace. The problem is probably that p4 on Windows defaults to the machine name as the workspace name if you don't supply one.
So you either have to run set P4CLIENT=<clientname> then run p4 changes -m1 <filename>,
or p4 -c <clientname> changes -m1 <filepath> where <filepath> can be the file on your local file system, so C:\Android\Version10.2\MyApp\ would be acceptable.
Does p4 filelog -m 1 <filename> give you what you want? You can add the -l (lowercase L, not one) switch to get more information.
If you have a local file (as opposed to the depot-path), then you also should have a client-spec. You need to specify this with the -c option:
p4 -c <name-of-client-spec> changes -m1 <filepath>

Resources