P4 - Purge File State - perforce

I'm doing a script for clean history and revision of selected files.
I change the FileType of a binary file to binary+S3, so this file will now just keep the 3 last revision.
When i use this method i always see on my depot files history of others revisions but they are now "purge", instead of using the p4 obliterate function which delete all revisions and dont keep some "purge" revisions.
My question : What is the differents between a file which on all revisions expect 5 are deleted and a file using the +S5 attribute.
Thanks !

If you use 'p4 delete', the file is logically deleted, but the previous revision remains in the repository and so you can access it by specifying that previous revision explicitly.
If you use a filetype such as +S, the previous revision is purged from the repository and you cannot sync your workspace to that previous revision.
That is, purging old revisions saves on disk space on the server, but means you can't access those old versions anymore.
The difference between purged revisions and obliterated revisions is that the history of the purged revision remains, so you know when that revision was submitted and by which changelist, etc., whereas with obliterated revisions Perforce can tell you nothing about those older revisions. Obliterating saves even more disk space on the server, but of course does so by removing even more information.

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

How to only receive get file changed by revision In perforce P4

In P4, I only want to pull file changed my client workspace from server. But When I use "p4 sync", this command get all files from server. So, How to get files changed from list revision ? with the files were existed on local and not changed, the command P4 sync do not need sync. My command is here:
p4 sync -f //depot/...#Revision
If you want to restore a file you deleted with p4 delete file, use p4 revert file, not p4 sync. p4 sync is for getting the changes that other people made to the files, not for altering the changes that you made.
There are three different reasons that the files in your workspace might differ from the current head revision in the depot:
A new revision has been submitted to the depot since the last time you synced.
You have opened the files (e.g. with p4 edit) and made changes to them that are not yet submitted.
You have modified the read-only synced files in your workspace without opening them.
(You don't say in your question which of these is the case, which is why you've gotten a couple of different answers that are based on different assumptions about your workspace state -- I'm guessing it's #3, personally, but I'll give the answer for each one so you can understand how it's "supposed" to work vs what's actually going on here.)
In case 1, a normal p4 sync command will update only the files with new revisions. If the revision you previously synced is the same as the head revision, p4 sync won't update it. This makes p4 sync very fast -- you can have a million files in your workspace, and if only one of them has changed since you last sync, only that one file is affected.
In case 2, no p4 sync command will update the files, in the interest of preserving your open changes. To submit your changes to the depot, use p4 submit; to discard them, use p4 revert. Again, only the open files are affected by these commands, so a revert operation affecting only a few files isn't slowed down by however many other files are in your workspace.
In case 3, your workspace is in an inconsistent state -- Perforce's standard workflow is that any time you modify a local file you should "open" it so that the server can track your local work (and optimize operations like sync, submit, etc, as well as alert other users who open those files simultaneously to potential conflicts). If you modify a file locally without modifying it, commands like sync will no longer work as well because the state of your client is not known to the server.
You can recover from an inconsistent state by using the p4 reconcile command (which will open all the inconsistent files so that you can either submit or revert them), or the p4 clean command (which irrevocably discards the inconsistent local changes, as if you'd done p4 reconcile immediately followed by p4 revert). These commands are significantly slower than a normal sync operation since they need to scan the entire workspace rather than only the changed files, but they are still significantly faster than a sync -f since only the changed files are actually re-transferred.

delete a submitted changelist from perforce history

I accidentally submitted a wrong changelist to my perforce server. I then backed out that changelist using the "backout changelist" option. But, these two changes appear in the history of all those affected files that they were once deleted and then added back again.
I want to be able to delete the history from perforce server of these two changelists. Is it possible. Can it be done via some Perforce administrator command.
EDIT: I have seen p4 change -d -f which can delete a changelist but this requires to use p4 obliterate on the files which were there in the changelist. Does this mean that I have to obliterate all the files which were affected by the changelist. This doesnt seem a viable solution for me as I do not want to delete those files. Should I only obliterate those specific two revisions of the files due to the two submitted changelists?
Your perforce administrator could call p4 obliterate to completely wipe out files, revisions and history.
But I'd strongly advise not to do so. It's a perfectly normal thing to rollback files/changes and to see the history of it.
In case you still decide to use p4 obliterate make sure you call it without the "-y" option first (preview) and then (if the output of what perforce says will happen is ok) call the same command with the "-y" option (to actually perform the obliterate).
If you call p4 obliterate with a file revision (e.g. p4 obliterate //depot/dir/file#5) then only the changes and history of that revision will be removed leaving all previous revisions and history intact. You can also obliterate a revision range.

re-submit changelist with new changelist number

I have submitted one file in perforce, and changes submitted by other user got reverted in merge.
Changes were not conflicting.
Is their a way, I can get that user's changes back. Means revert the revert.
Also how to submit a changelist again with new changelist number?
In order to revert a file (fall back to its previous version) you simply sync the previous version and submit that again.
For a single file the procedure goes like this:
# sync file at old revision (#3 in this example)
p4 sync //depot/file#3
# mark the file for edit
p4 edit //depot/file
# make perforce aware that something has to be merged
p4 sync //depot/file
# resolve (i.e. throw away the head revision changes and save those from #3)
p4 resolve -ay
p4 submit
If you have a changelist with several files (and not only edits, but also deletes & adds) the rollback is a bit more difficult.
See also this question.
Here's a smart script for that purpose and more info.
The 2nd part of your question I did not understand.
Submitting a change again with a new changelist number doesn't make sense, since a changelist contains diffs. If it was submitted once, then the diffs are already in the depot, so you can't submit the same diffs again.

Files marked for delete, have actually also replaced on filesystem, would like to mark for edit

In Perforce, I deleted a number of files, which was recorded in an (unsubmitted) changelist. I then added replacement files in the filesystem, in the exact same locations as those that were deleted. As reverting them just fetches the old version back, how can I amend the changelist so that the files are as marked for edit with the new version?
You can run p4 revert -k to clear the files from the changelist without fetching the old copies back into your workspace. Then just run p4 edit on them.

Resources