P4V Get Latest does nothing - perforce

I do not want to go "Get Revision" > "Force". Because half of my stuff is already downloaded. I don't want to overwrite what I already have. P4V Can clearly see that what is in the depot and what is local is completely different. How can I get Perforce to retrieve the files I do not have, and ignore the ones I already do?

Select your workspace root, go to File > Open Command Window Here, and run:
p4 clean
This will scan your workspace and force-sync everything that's different or missing, as well as deleting unadded files. Note that if you have local work that isn't in a changelist, this will irrevocably erase it. If you only want to "clean" files that are edited/present but out of date (and disregard added/deleted files), do p4 clean -e instead. If you want to preview the operation before doing it for real, do p4 clean -n.
I think you can do the equivalent via the "Reconcile Offline Work" tool in P4V, but it may require additional manual steps.
To make working with Perforce easier, try to avoid modifying files in your workspace that are read-only -- if you want to remove a file from your workspace, use "remove from workspace" in P4V rather than manually deleting it, etc. Perforce is able to make file operations very fast by virtue of knowing what's in your workspace and not having to re-check it each time, but you eliminate that benefit when you mess with your workspace manually.

Instead of p4 clean, you could do:
reconcile offline work on root of workspace then a pop-up saying that you deleted some files and it is going to delete them from Depot of the server as well make sure you added to default or new changelist or whatever. Accept.
Go to changelist and right-click press revert files to bring back the deleted/missing files.

Related

Track changes missed by not using "check out and open" a file in perforce

I have a few files that have been edited by an external IDE, I forgot to Check Out the files before making the changes however when I look at the files through P4V the files have changed but the indicator for the file itself shows as nothing has changed. How can I ensure my changes are committed without loosing what I have done?
One way I was thinking was to making a copy of the file, revert, check out, copy content or replace file.
That is OK with a few files but what happens when you have done so with hundreds of files?
The "check out" command doesn't modify the local file, so you can just do that on its own without having to make a backup copy of the file first. (What you want to avoid doing is "get latest", although if the local files are writable, Perforce will automatically balk at updating them by default because of this exact situation.)
If you have lots of files that might or might not have been modified in different ways, use Actions > Reconcile Offline Work, or "p4 reconcile" from the command line. This will find the locally modified files and open them for the appropriate action.
The P4V way to do this is called "Reconcile Offline Work": http://www.perforce.com/perforce/doc.current/manuals/p4v/Offline.html
Or, at the command line, you can use 'p4 reconcile': http://www.perforce.com/perforce/doc.current/manuals/cmdref/p4_reconcile.html

Recover deleted files from Perforce

I deleted a file from Perforce in the last month. Is there a way to retrieve it from P4?
If so, what command can I use?
Note: I'm not the admin for p4. And I don't want the file back in P4 but I just want it in my local workspace.
Also, I don't know the exact timeframe when I deleted it in last month...What command can I run?
I'm running P4 on windows. I'll appreciate if someone can provide equivalent command for windows
Thanks!
When you delete a file in Perforce, it creates a "deleted" revision, but the archive file is still there.
In the Perforce P4V GUI in the depot veiw, there is a filter symbol on top of the explore pane .
Click on this and select "Show Deleted Depot Files".
Find the file you want to restore and right-click on it. Select "Rollback..." and revert it to the previous revision of that file (before it was deleted.)
By default it will create a new changelist, be sure to select the one you want if you already have one.
On the command line:
p4 sync //depot/folder/subfolder/filename#changelist
You can use either the command line or the GUI, from the command line p4 sync -f forces the files to be resynchronized. For more information see the Perforce Knowledge Base.
If you haven't committed the change list of deleted files to the repository, right click on the folder containing the deleted files in p4v and choose Get Revision. Be sure to check Force Operation and then Click Get Revision. Then the deleted files will be restored from p4 server.
ref: https://forums.perforce.com/index.php?/topic/1479-how-to-restore-files-deleted-in-p4c-workspace/#entry4726

Perforce Revert Shows "file(s) not opened on this client"

I'm trying to open an existing Perforce application. I made some local changes, like deleting files, which I want to undo (that is, I want my local copy to exactly match the repository once more -- delete added files, restore deleted files, and undo changes).
When I try to revert using the p4v gui client, I see this error:
file(s) not opened on this client
What am I doing wrong?
I did manage to revert all the changed files, but not the added/removed files.
Edit: I did the following:
Connect to a Perforce server using p4v
Map a directory to my local file system (lets say C:\Perforce)
Get the latest version of the repository
Go to C:\Perforce in Windows Explorer
Delete some files and folders
Add some files and folders
I would like to get back to the "pristine" state, the copy of exactly what's on the server when I got the latest version of the repository for the first time.
By the looks of the edited description you added and deleted files directly on the filesystem and not through perforce. Therefore Perforce doesn't know anything about those changes so there is nothing to revert. Typically when you want to add a file you use 'p4 add" (or the equivalent p4v operation), and when you delete, you should use 'p4 delete' (or again, the equivalent p4v operation).
Really, the best option to get back to a pristine state is to nuke the local copy of the code in c:\perforce (in windows explorer), go to p4v, right click the area you want to sync, and choose "Get Revision..." and in the subsequent dialog, make sure that the "force operation" checkbox is checked. This will tell Perforce that you want a new copy of everything regardless of whether you had it synced or not.
You can also run "reconcile offline work" in p4v. Right click the depot area and choose that option. It will scan through the local folder structure and give you a report of what files have been added that don't exist in perforce, what files were deleted, and what files were modified. From that dialog, you can right click on local files that don't exist in perforce and delete them, or you can 'p4 add' them. You can also sync deleted files.
HTH.
Just an extra not to point out another cause for this.
If the file name contains an unusual character that cannot be translated correctly the name on the client will never match that on the server.
The solution in this case is to spot that character in the file name (it will be a question mark emblem on Linux) and use a wildcard to help identify the file to the server so it can delete it etc (p4 deleting the file is a way to go).
This answer may not be your case. This happened to me when I edited the files on my local disk without logging into p4.
A quick fix at commandline is:
p4 login # make sure you've logged in
p4 edit <filename> # let p4 know you've edited the file
p4 revert <filename> # revert to "pristine" state
You can use p4 reconcile -w to restore your client to the state of the server. There is an alias called clean, which is also available in P4V on the right-click context menu as Clean....
There are several additional flags to control whether added and deleted files are deleted or restored, respectively.
The -w flag forces the workspace files to be updated to match the
depot rather than opening them so that the depot can be updated to
match the workspace. The -a, -d, and -e flags when used with -w
update workspace files as follows:
-a Files with no corresponding depot file are deleted.
-d Depot files not in the workspace are added.
-e Modified files are restored to the last version synced.

"Actually, Perforce I don't want you tracking that file after all ..." how do I get Perforce to listen?

Sometimes I "Mark for Add" and add files to Perforce which I actually didn't want Perforce to worry about.
Is there a way to revert it so it just goes back to showing in P4V as an "untracked" item?
See my example:
I've added mil.ico and mil3.ico by mistake. I just want them to go back to looking like test.ico, ie. ignored by Perforce:
Even if I save a copy of the files, then delete, then put them back (all of which is a serious bore), P4V still knows they have a history and marks them as shown:
I just want Perforce to leave a file alone when I tell it to.
If you want to remove the last traces of the files from perforce, your only chance is through p4 obliterate. This will irreversibly remove file revisions or even file's complete history from perforce and will only work with administrator privileges. I don't know if obliterate is available through p4v, on the command line you would issue:
cd directory_of_accident
p4 obliterate accidentally_submitted_file
and if it looks like you and perforce agree on the file to forget
p4 obliterate -y accidentally_submitted_file
to seal the issue.
You can delete the items from the Perforce depot. Keep in mind Perforce will want to delete your local copy of that file so you should save it off in a different location, delete the file in Perforce and move the local version back.
Are you looking at your file structure through the Depot tab or the Workspace tab? It looks like it may be your Depot tab.
Try going to your Workspace tab then click on the Filter icon (looks more like a funnel) and ensure that "Show Files Not in Depot" is selected.
Hopefully looking through the Workspace tab, as opposed to Depot, will hide the deleted files, and selecting the appropriate filters will show your non-Perforce files.

Perforce changelist does not show any files

Using P4V 2009.2.
I have used P4Win in the past, but this is a new setup for me.
The problem is that the files I have checked out disappear from the changelists, so I cannot check them in.
To reproduce:
Check out a file, make a change to it.
Go to the 'pending changelist' tab.
There will be a + sign on the default changelist.
Click on the plus, or on the changelist line, the plus will disappear, there will be nothing in the changelist.
Try to check the file in by right-click on the file itself, the changelist dialog will show up but NO files are listed.
You can transfer the file to a new changelist, the same thing happens.
Looking at the file in the 'checked out by' window does correctly show the changelist number & description.
It sometimes happens to me, and what I normally do is change workspace and then change back again. Not sure if there is an easier way to get it to realise the files are checked out.
the only thing I can imagine is that you are looking at a different client workspace. Notice that the "Pending Changes" tab has a filter on the top, where you can separately filter for folder/files, user and workspace. Maybe the filter is set to something so that it doesn't match the client workspace where you have actually checked out the file.
Good luck,
Henrik
You may get this if the perforce server has not been upgraded. Old versions of P4D have this error: http://kb.perforce.com/article/1167/opened-files-missing-in-default-changelist
If that is not an option, use p4Win.
I agree with jhwist,sounds like your looking at a different client spec.
P4V is a bit confusing on this front, IMO and I personally prefer P4 Win but to check, open up a command prompt and type p4 changes -s pending -c YOURCLIENTSPEC - chances are that the changes you think you have aren't in your current clientspec
This can happen sometimes and in my experience it is a refresh issue with p4v. Often simply closing the pending tab or reopening p4v solves the problem.
In my case, the pending List has over 4000 files, (due to eclipse created so many files after mvn tasks) so none of them are shown. I created a different pending list, then cleared all contents, then moved the files to the new change list. Then it is appearing in the new change list.
Modify the file directly in the correctly mapped client folder (i.e. your current workspace). You will see the changelist for sure. As jhwist mentioned clear filters if any and choose your current workspace (since you may have many)

Resources