Accidental mark for delete - entire depot and reverting - perforce ..How to remove that tag(Mark for delete) from all files - perforce

Whole workspace files marked as delete in local also and depot also.
Depot contains thousands of file ..While reverting file options P4 get's hanged..
Any Solution for this ...help me...
Thanks in advance.

When P4V hangs on these mass commands, I prefer using the command-line. In this case, p4 revert //depot/path/to/the/workspace/....
Make sure you don't actually revert things you want to keep though.

Related

Make the contents of a perforce directory exactly match the latest depot version

I would like to make the contents of a directory in a Perforce workspace be exactly the same as the latest depot contents. I want this to work no matter what has gone on in the workspace. (For example, editing files without opening them in perforce, creating unsubmitted changesets, etc.)
So far I have come up with running this series of commands, in order:
p4 clean ...
p4 revert ...
p4 sync ...
Will this do what I want? Is this the correct order? Is there a simpler way?
Those are the correct commands, and you do need all three:
revert is needed to discard changes to files you've opened
clean is needed to discard changes to files you haven't opened (including added files)
sync is needed to make sure you're at the very latest depot revision
You should either put clean after the revert or add -w to revert; otherwise files that were opened for add will be skipped by the clean (because they're open) and then revert will "abandon" them in the workspace (the -w option causes revert to delete/"wipe" added files instead of abandoning them). Other than that, I think the order is unimportant.

Automatically deleting newly added files when shelving in Perforce

When I shelve a pending changelist, changes to existing files are reverted, but newly added files are not deleted from the filesystem. I need to manually delete these files every time I perform a shelve operation. Is there anyway to automatically delete newly added files when shelving?
in p4, if you're willing to make it two operations, you can do a normal shelve on the changelist, and then do p4 revert -w on the same changelist, which deletes added files. i'm not sure how to do this in p4v.
It looks like P4V added this in a recent release!
https://www.perforce.com/perforce/doc.current/user/p4vnotes.txt
#40757 (Changes #1619278, #1618572)
The Shelve Dialog has an option to remove the files from disk that are marked for
'Add'.
To do this in p4v, you can create a custom tool, say "revert-added-file-and-delete", adding it to applicable context menus, with application p4 and arguments revert -w %F.
Unless someone knows of a way to chain custom tools together (and I couldn't find a way to do it), to do a shelve/revert will require a separate shelve followed by a use of the custom command, revert-added-file-and-delete.
Sure, except that shelving work is a fundamentally different beast. If I create a new class that uses a new function in an existing class, and then shelve both files, the new class remains, and is now referencing a non-existent function in the existing class. Now I've got build errors and have to manually delete the new file in order to get back to a clean slate, which is exactly what shelving work should do for me.
p4 shelve -c changelist_number
p4 revert -w -c changelist_number //...
I don't think that there is a way to do this. This behavior is consistent with reverting files that have been added. If you 'p4 add' a file and then revert it, it will not be deleted on revert. Seems like it would be bad behavior if it did! Losing a file and the work that has gone into the file on a revert would be very bad. Consider this: you code up a file in your editor, you save diligently, and finally you are ready to 'p4 add' it to perforce. Then you decide you don't want to do this so you revert and then you lose your file???
So reverting adds won't delete the file.

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.

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

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