Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set client root in Perforce P4 when client unknown error comes

Suddenly, when I run p4 info in terminal, I notice that the client root is not set (not sure why it got unset all of a sudden. Following is the output which shows "client unknown" in place of client root. What is the command through which I can set the same? I have tried p4 client and p4 set but may be, with wrong syntaxes.

BANL121b92746:Applications bagarwal2$ p4 info
User name: bagarwal2
Client name: BANL121b92746
Client host: BANL121b92746.local
Client unknown.
Current directory: /Applications

And is the value of this client root be the same as "Workspace Root" set in my P4V client under Connections->Edit Workspace . My P4V client is working perfectly. I found this problem with p4 info when my Intellij IDEA started showing connection problems in P4. On testing the connection in IDEA, below is the error screenshot, which is same as when I do p4 info in terminal.

enter image description here

Regarding my p4settings.txt config, below are the configs which were working for months till now:

P4HOST=<hidden hostname>:2500
P4CLIENT=bagarwal2_BANL121b92746_trunk
P4USER=bagarwal2
P4POST=<hidden hostname>:2500

My P4V connection (which works all fine), uses the same details/config which are mentioned above, still I find this problem in terminal and hence in Intellij IDEA.

like image 830
Bhavesh Agarwal Avatar asked Oct 12 '15 07:10

Bhavesh Agarwal


People also ask

What is p4 client root?

To specify the effective workspace, set P4CLIENT . The client workspace root is the top directory of your client workspace, where Helix Server stores your working copies of depot files. Be sure to set the workspace root, or you might inadvertently sync files to your computer's root directory.

How do I find my Perforce client?

Use the p4 info command to display the root being used. This enables users to use the same Perforce client workspace specification on multiple platforms, even those with different directory naming conventions.

What is client spec in Perforce?

Your Perforce client spec defines your workspace location, the depot files you plan to work with, and their location in your workspace when you invoke Perforce commands.

What does p4 Sync do?

p4 sync brings the client workspace into sync with the depot by copying files matching its file pattern arguments from the depot to the client workspace. When no file patterns are specified on the command line, p4 sync copies a particular depot file if it meets all three criteria: Visible through the client view.


2 Answers

Try p4 set p4client=my_client.

This stores your preferred client in the registry. There are other ways to set your client, with different precedence and scope:

  • environment variables (potentially different per process)
  • P4CONFIG files (potentially different per filesystem location)
  • command-line options (potentially different for every invocation of p4.exe)

but for simplicity, using p4 set is all you should need.

BTW, P4V uses its own setting (there's a dialog that comes up by default when you start P4V).

like image 154
sferencik Avatar answered Sep 27 '22 17:09

sferencik


It looks like your p4settings.txt config file isn't being used; otherwise the client name returned by "p4 info" would match the P4CLIENT value in the config file. Run:

p4 set P4CONFIG=p4settings.txt

and make sure that when you run "p4 info" you're doing it from a directory underneath ~/dev/trunk. (Your "p4 info" output in the question shows your current directory as /Applications, so that might explain the problem on its own -- just do "cd ~/dev/trunk" and try again.)

The "client unknown" error suggests that maybe your client spec got deleted (this is assuming you're connecting to the same server and using the same client name you were successfully using before). If that's what happened you can create a new one with the same name by running:

p4 client
like image 45
Samwise Avatar answered Sep 27 '22 17:09

Samwise