Helix P4V Server IGNORE file not working with P4V client - perforce

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).

Related

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

How to link to the same workspace?

I have two computers: Work, and Home.
My workspace in my Work Laptop is synced in a Dropbox. That's why I could access my work at home.
But when I try to setup my Perforce at home, I don't know how to link or detect that I have an existing workspace in my Dropbox.
How?
First, I'll assume you can access your Perforce server from home, since you don't mention this in your problem statement.
Next, I'll assume you're able to use the same directory structure at home that you use at work (e.g. C:\Dropbox\projx).
When you create your client spec at work, be sure to edit out the HOST: line, since you'll be using it on two machines.
Use the same client name at home that you use at work.
If for some reason you are unable to use the same directory structure on both machines, you may have to use "p4 client" to change the ROOT: line of your client spec every time you switch between home and work.
Alternatively, you could use two different clients, and use "p4 shelve" to move files to the server when you're done for the day.
You basically just need to tell Perforce the name of your client. Usually you'll do this by adding a .p4config file in your Perforce client's root directory (or in one of its parent directories) that contains the line:
P4CLIENT=your-perforce-client-name
You might also need to add an environment variable that points to this file: P4CONFIG=.p4config.
If the local path to your client's root is different between your work and home machines, you'll also need to set AltRoots in your Perforce client specification and add the path for your home machine.

Perforce deleting a file from workspace and reflecting that in Perforce

Is it possible to delete a file from your workspace and then hitting submit in perforce and that file being deleted from the perforce server?
open for read: F
\LocalSource\Perforce\MainBranch\blah\New Text Document.txt: The system cannot find the file specified.
Submit aborted -- fix problems then use 'p4 submit -c 4799463'.
Some file(s) could not be transferred from client.
I get this message when I try to submit. In Subversion I could do this. I had a look on the internet and it looks like this isn't possible, but I thought I'd check on here.
(The reason I want this is because I have a spreadsheet and I want to extract the modules from the spreadsheet and put them into source control. But sometimes modules in that spreadsheet may be removed and I want to be able to just checkin the modules that are changed and do deletions on the server, without having to go into the perforce client and deleting the files marked for deletion in there.) One method was to delete all the files in perforce and then do a dummy commit of an empty directory. And then add all the files again extracted from the spreadsheet and do an add. But then in my version history I always will have a version with a full delete.
Any simple ideas, special commands that I can use?
Thanks,
Chris
If you delete files directly on disk, without using the Perforce client to delete them (e.g., you use your spreadsheet command to delete those files directly), that's called "offline work", and in order to tell Perforce that you've made those changes, you just need to go back into your P4V window and use "Reconcile Offline Work".
See Working Disconnected From The Perforce Server for complete instructions.
See also this related question: Sync offline changes to a workspace into Perforce
Perforce has a command-line client (http://www.perforce.com/product/components/perforce_commandline_client) you should be able to execute from Excel as any exe file via the Shell function.

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.

How do I delete a file from depot, but leave local copy in tact?

I'm trying to learn Perforce and want to delete a file from the depot(easy to do with p4 delete, p4 submit), but that deletes it from the client machine dir structure as well. I want to keep my local file in my directory intact.
The only way I can see to do this would be to move it out of the hierarchy that is under Perforce control before deleting. I was able to get my file back by syncing an earlier version.
Maybe I set up my client workspace wrong? Or am I misunderstanding a fundamental concept of source control? The client workspace is /home/user and I did it this way so I could add any file under my home directory without getting an error about the file not being under client's root.
FYI - Linux client and server running P4D/LINUX26X86/2009.1/222893 (2009/11/12)
Any advice appreciated.
Thanks.
There is a way to do this, by going behind Perforce's back. Do the following:
Rename the file you want to delete to something new
Run p4 delete on the original filename
p4 submit the change
Rename the file back to the original name
I don't believe there is any way to keep a file you are deleting under Perforce. There is good reason for this, as if the file is deleted in the depot there is no reason (from a source code control perspective) to keep a copy in the client workspace.
I suspect the issue is the way you are using Perforce.
From what you have written it seems that you are using Perforce to backup/track files in your home directory structure. So the way you are using Perforce the "master" is in your home directory and the "copies" are in the depot.
This is not the intended use of a source control system as I understand it.
The master copy of all files are actually what is in the depot. From the depot, multiple clients (views) are made for purposes such as making changes, testing, and so on. The clients are transitory and can be created and deleted as required.
To do what you want to do you may need to rethink how you are using Perforce.
some of the other commands take a parameter that lets you fake the action, but delete doesn't. You could always make a new client, do the delete in that workspace.
In the Workspace tab go to folder containing file(s) to remove from source
Right-click on that directory (or from File menu) and choose Open command window here
Note - If you open your own command prompt in the source directory you may encounter this error:
"Client 'your-client' unknown - use 'client' command to create it."
Enter command p4 delete -k <file_to_delete>
Change will be added to your P4V Helix changelist ready to check in

Resources