View removed files between revisions in perforce - perforce

Can anyone point me to how i can view files that have been removed between revisions in Perforce? i am a new user and the latest revision has some build failures due to missing files that must have been left out in the previous revision. I need an easy way to identify these files.
Thanks

The easiest way is to use P4V's Folder Diff. From the command line you can run p4 diff2 and look for cases where the file is present in one revision but not the other.

Related

Perforce Revision of Files

Cannot over write files on Perforce
A file with errors was uploaded to Perforce, we are now trying to overwrite that file and update it with the correct file. Unfortunately many of the character assets will not resolve showing a padlock, yellow triangle and a red tick.
The error messages are telling us that we can't overwrite the files unless we have an up to date version. The most up to date version is the one with errors! How do we unlock and resolve these assets
Get the latest revisions. You can browse submitted changelists and identify a changelist that introduces the error. You can back out that changelist which will create changelist on which the files will be edited that way that their content will be reverted. Submit that changelist.
I'm not sure which UI you're using (P4V? P4Win? One of the IDE plugins?), so I'll just give the command line instructions:
p4 sync FILE
p4 resolve -ay
The sync tells Perforce that you want to sync up with the latest depot revision of the file. Since the file is open for edit, this won't actually modify the file on disk, and will instead set up a resolve operation.
The resolve -ay (accept yours) tells Perforce that you want to ignore the latest revision from the depot, and keep your workspace revision instead, which is the one that you want to submit.
Now the "yellow triangle" should go away and you'll be able to submit. (Unless that "padlock" belongs to someone else...)

Perforce: move directory with keeping history

Colleagues,
I have two different directories:
- path/animals/dir1
- path/cars/dir2
I want to move dir1 into path/cars/ with keeping all history of this folder.
I tried several ways: merge, copy and rename/move using P4V,
but all of them leads to erasing history in moved directory.
If there is a way how can I do it?
Thanks in advance!
We have used p4 move extensively in recent versions of P4 to do these kinds of directory moves.
In my experience, if you branch/delete (or more recently move) the files, you'll have the history of the original location intact (with delete/move records), but if you look on a revision graph in P4V, you should see all of the older revisions in the previous locations before they were moved (deleted).
If you use p4 sync with a particular date or changelist, you should also get the original directory back with the versions of the files at that time (and the newly moved versions should be removed after the sync, assuming both directories were in the area that you were syncing).
I have experienced problems (this probably will change in 2013.2, as I've read that Perforce is changing the default integration engine) with integration across move/delete and move/add transactions which require the use "generation 3" integration option, but once that's specified (which you can do by adding a -3 to the command line p4 integrate command, everything works better for me across those moves.
The history of the moved directory has not been erased. I'm guessing you think this is the case because the files are longer visible in P4V. By default, P4V does not display deleted files in the depot tree. Since you moved the files to a new location, they were deleted from their old location and are now no longer displayed. You need to turn on the option to "Show Deleted Depot Files". If you click on the yellow funnel icon to the right of the Depot/Workspace tabs you'll see that option. Check it and P4V will then display the deleted files in their original location.
While moving folder to another destination all history still present but only for appropriate files, not for a directories.
Here is a proof:
http://comments.gmane.org/gmane.comp.version-control.perforce/19820

Can I re-merge one file from the previous merge in perforce?

I did a merge of bunch of files in perforce from one project into another. Turns out one of the file (VC++ .rc) file didn't merge properly and can't even open this in IDE as a result. I just want to remerge this single file again and leave the rest as is. Is this possible?
I did try 'rollback' on the file in target project but haven't checked in yet. Than I tried to re-merge/integrate just this file but it doesn't really work.
Perforce has a couple of suggestions in their knowledgebase: http://kb.perforce.com/article/517
Essentially what you probably have to do is to "update" the .rc file to the revision prior to the failed merge (probably using rollback) and then re-integrate that file. If it mumbles something about already having been integrated you should be able to use the "force" flag (-f) for p4 integrate.

How to revert to an earlier revision of a project in Perforce following a deletion?

Let's say I have a project under //depot/MyProject. At changelist 1001, this project took a major change in direction, changing everything about it. At changelist 2001, it got p4 deleted. The depot is now at change 3000.
I'd like to restore //depot/MyProject back to its state at changelist 1000. Specifically, I'd like the revision history to record the fact that change 3001 is an integration of change 1000 - i.e. the last version of this project before the major change.
Can Perforce do this at all? Or do I have to rename it into something like //depot/MyProjectOriginal, because //depot/MyProject is now tainted with all those deleted revisions?
(the naive attempt to p4 integrate //depot/MyProject/...#1000 //depot/MyProject/... fails with an "all revision(s) already integrated" message)
You cannot force the integration.
You have two options: you can create a branch using changelist 1000 as the base; or sync to changelist 1000, check out all files, and then submit (a.k.a rolling back).
Option 1
If you do want the history of your changes between 1001-3000 (i.e. a fresh start from changelist 1000) then this is the better option. Using P4V, create a new branchspec and then perform an integrate from your current project to the new branch at changelist 1000. This will be submitted as changelist 3001, when you compare differences between revisions, you will not see of the changes between 1001-3000.
In the P4 visualizer this will appear as a new branch creation at 1000.
Option 2
Sync to changelist 1000, check out all files, and then submit. There should not be any conflicts to resolve. This will be submitted as changelist 3001, however when you review history you will see the everything.
I hope this makes sense, any questions, please ask.
I don't believe that you can integrate files on top of one another like that. I think that you have two options.
If you are willing to move the files, you can do a
p4 integ //depot/MyProject/...#1000 //depot/MyOriginal/Project/...
and that will integrate MyProject at changelist 1000 to the new location.
If you'd like to keep the project at the same place, you can do that as well. It's really easiest in p4v - you can right click on the folder in workspace or depot view and choose "rollback...". In the subsequent dialog, you can then pick a changelist (or date, revision, etc) to roll the folder back to. In your case, I think that you would choose changelist 1000. Stick the files into a new pending changelist (I think that this is always good practice). You can then run a preveiw (to see what would happen), save the contents to a new changelist (so that you can inspect file contents before submitting), or just go for broke and pull the trigger and submit (I generally wouldn't recommend this).
HTH
Just do:
p4 copy //depot/MyProject/...#1000 //depot/MyProject/...
This also make a nice revision graph.
Though there is an accepted answer and plenty of other solutions, none of them works for me coz I need to rollback a large directory (with GBs of data)
Here is the way I used, which works fine for huge directory:
(Suggested to do in a new and clean workspace, though not strictly required)
Assuming the directory to rollback is //depot/foo/bar and you want to rollback to changelist 1234
Make sure no one is locking any files, and make sure the directory you are trying to rollback exists in your client spec
p4 copy -v //depot/foo/bar/...#1234 //depot/foo/bar/...
p4 submit
p4 copy -v is the meat of the solution. It tells Perforce server to perform virtual copy, which means Perforce copies the files but not actually in your workspace. This avoid huge data transfer for file content (when copying and when submitting). In my case, by using "rollback" in P4V (which is doing non-virtual copy), it took over an hour just for copy, and over an hour for submit for my folder. With virtual copy, whole process took me around 1 minute.
The most important thing is, it keep a sensible history. You can see your files being updated and rolled back, and all previous history exists.
use
p4 integrate -f //depot/MyProject/...#1000 //depot/MyProject/...
The -f flag means force an integration even if they have already been integrated.
From http://www.perforce.com/perforce/doc.current/manuals/cmdref/integrate.html

In perforce, how do I remove pending changes for NEW/ADDED files not submitted?

I am trying to remove a pending changelist in perforce. All the files (20 old) are new but have not be committed/submitted yet. So in p4Win, they show a RED + cross. I am failing to remove these files from the change list. How do I go about getting rid of these files?
Thanks for the answers to right-click and revert. I have tried that but it fails with the example error strings below.
Operation: user-revert
Librarian digest source/.../foo.c failed.
RCS checkout 1.715484 failed!
RCS no such revision 1.715484!
//source/.../foo.c#1 - was add, reverted
I've also tried the p4 revert command but it fails with same error(s).
Fixed with "revert -k" by perforce support group. They suspect it may be due to overlay values in the client workspace but have not been very specific.
How are you trying to remove the files?
It's been a while since I used Perforce in anger but I seem to remember that you just had to right click and revert the file.
I've just tried this and it worked OK for me (the programmer's lament!). It uses the following p4 command:
p4 revert //depot/test.txt
Where test.txt is the name of the test file.
Update
Does the new file still exist locally on your hard drive?
Does the path where the file would be in the depot still exist? ie. what's in the "..." of your path.
Revert files, right-click on file in change list and select revert, this will remove added files.
Maybe try Perforce support at this stage.
To remove all added files in current and sub directories:
p4 revert ...
In my case this happened because the RCS files (the actual files with ,v extension in the depot that contain all the revision information) were literally missing the information for the revision in question. I was able to restore the files from backup.
I had the same problem, I had added the .exe files but wanted to exclude them afterwards. The perforce documentation helped:
http://www.perforce.com/perforce/doc.current/manuals/p4eclipse/topics/adding.html
Excluding Files from Source Control
Important: you cannot exclude files after you have placed them under
Perforce control. If you have files opened in a changelist and you
want to exclude them from Perforce control, revert them from the
changelist before excluding them.
Worked like a charm.

Resources