Perforce Windows Explorer plugin: No workspace has been set for this connection - perforce

I'm trying to use Perforce from Windows Explorer (Windows 7), but the Perforce context menu doesn't have any of the useful commands (checkout, submit, etc). Instead it has a disabled entry that says, "No workspace has been set for this connection."
The troubleshooting page I found says, "The problem is that P4EXP [Perforce's Windows Explorer plugin) ignores p4v’s configuration. You can configure P4EXP from the command line." It then explains how to do that by entering three "p4 set" commands.
But when I enter those commands, they have no effect whatever. And I'm not sure why they should; I got the information I needed to enter (client name, port, and username) by running the "p4 client -o" command. In other words, I entered setting into P4 that I got from P4. There must be something else I need to do, or it would have worked from the get-go. But what?

It is great that you have the context menu set with perforce with windows explorer plugin. In order to make it work, one needs to set up the environment variables that point to correct workspace (in contrast to svn, perforce does not have .svn directory in each versioning folder). This can be achieved with the following command:
p4 set P4CLIENT=my_perforce_workspace
given, e.g., that your path is in D:\my_perforce_workspace. If you do not have p4 on your system, install it from helix-command-line-client-p4.
Additional links:
http://maillist.perforce.com/pipermail/perforce-user/2009-September/025858.html
https://www.perforce.com/perforce/r17.1/manuals/cmdref/Content/CmdRef/P4CLIENT.html

If p4 set shows the right settings but the Explorer plugin shows something else, the difference could be P4CONFIG (which lets you have different settings per-directory). cd to the same folder you're trying to use the Explorer plugin in, and run p4 set there -- any difference?
Your comment about p4 client -o is a little confusing -- note that if you have no workspace defined, p4 client -o will give you a template for a new workspace, but it will not create it (you'd have to pipe it to p4 client -i). The command you should be running to verify your connection is p4 info.

Related

Helix P4V Server IGNORE file not working with P4V client

I setup a P4V server on my machine successfully and was able to set a P4IGNORE file.
To test this, I added a test.txt file to be ignore on add. When I add a test.txt file to my local repo and mark it for add it isn't ignored and gets pushed to the server. On the other hand when I p4 add -f test.txt it will work and say the file is ignored in the terminal. I have no idea why this is? Thanks.
P4IGNORE is a client setting, not a server setting. Your P4V client might not be configured to read your ignore file.
If you want server-side enforcement of which files go into the server, use either the protection table (which can be applied across all users) or the client view (which will apply any time you use that workspace, regardless of whether you're using p4 or P4V or any other client app).

Use command options (like -f) from Perforce Visual Client

I get an error while adding few files to Perforce which has WILDCARD characters in their name. The error is clear, asking to use the '-f' option while running p4 add.
Now I am using the p4 visual client app on my work machine and could not find a way to add options while running the command. Is this something that we can do only on the command line ?
P.S - I am on a corporate network. And I don't have rights to install softwares freely from internet and as such can't install the perforce command line.
P4V should give you the option to add the files (i.e. it should use the -f option for you when appropriate). If it's instead giving you the command line error message that sounds buggy; I'd recommend raising it with Perforce tech support.
I would also recommend negotiating with your IT team to allow you to install the p4 command line tool; if they've already approved P4V there's no earthly reason to not approve P4 (which is just a very thin wrapper around the p4 client libraries that P4V is built on, and also completely open-source so therefore easily auditable). Once you're able to run the appropriate p4 add command, the server commands will return the escaped versions of the wildcards and other commands based on those escaped paths will work without any special handling, so P4V might just work correctly from that point on.

I cannot remove a workspace form P4V because its relative folder deleted in windows file explorer

I was setting up a small server to allow my friends to access Unreal Engine documents. I am completely new to this. I accidentally made an extra folder. I didn't notice I didn't need it at the time and made it a workspace. Then I realized and deleted it in the window file explorer. However, as I figured out it did not remove it from P4V.
Now, when I try to delete the workspace in P4V, I get the error message:
"Client 'UE4Workspace1' has files opened. To delete the client, revert any opened files and delete any pending changes first. An administrator may specify -f to force the delete of another user's client."
I do not know how to use -f. What can I do?
According to the error message, you have checked out some files in the workspace which you were trying to delete.
So to fix the problem:
1 switch to the workspace you want to delete.
2 revert these files in your pending change list (Or possibly in other changelist in that workspace)
3 delete any numbered changelists in that workspace.
4 switch to other workspace(this step is possibly optional)
5 delete the problemetic workspace in p4v.
I guess P4 maintains status of every workspace in the server. And to avoid mis-deleting local edited files, they will prevent users from deleting workspaces if the workspaces still have pending files.
Assuming you have the correct rights, you can from a command line, while being logged in the server,
p4 client -d -f <workspace_name>
-d : means delete
-f : means force
A client or a workspace in Perforce speak is the same thing. (I am not quite sure why there are two terms for the same thing.)
Full reference : https://www.perforce.com/perforce/r15.2/manuals/cmdref/p4_client.html

Adding files to perforce client

I have a handful of new files I want to add to my client. I moved my files to the proper location but every time I do "p4 add" I get the error "file(s) not in client view". I am confused why I am getting this error message since I am trying to add new files for the first time.
Perforce correlates the location of the files on your workstation with the location of the files in the server's repository using your "workspace view", which is a crucial concept that you need to become familiar with.
Here's where to learn about it: http://www.perforce.com/perforce/doc.current/manuals/intro/01_intro.html#1079899
Since you're working with the command line p4 tool, you'll use 'p4 client' to update your workspace definition and its view mapping.
You can also use the 'p4 where' command to understand how the mapping is translating filenames to and from the client and server formats.

Perforce command line only showing local users/changelists/workspaces, but P4V shows all

We are using P4 for free with two users. In the P4V admin gui I can see both myself and my partner as users, and in the P4V gui I can see all workspaces (clients) and all changelists (both mine and my partner's). From the command line, 'p4 users' only shows me, 'p4 clients' only shows my local workspace, etc. Is there some mode, environment setting, or special directory from which I have to use the p4 command line to see those global objects? I believe I am a p4 superuser (since I read this is the default on installation and we didn't change anything). I'm obviously missing something very basic about the relationship between p4 command line and P4V.
The reason I need to use the command line is to delete an old client workspace (used on a different machine) that has an empty changelist associated with it. I therefore need to use 'p4 client -d -f old-workspace-name' from the command line. But when I do it tells me client 'old-workspace-name' doesn't exist.
D'oh! I had a setup with two p4 servers (one that I had set up briefly as an experiment and forgot about). My gui was pointing to the real one and my command line was pointing to the experimental one. They both had a client with a certain name, so I was confusing them for being the same. Hope this helps someone else who makes the same mistake.

Resources