I'm migrating a large codebase (> 200k files) to a perforce repository, and during that process I added a number of folders and file types that I now want to ignore using the p4ignore. I've set up the correct filters in the p4ignore which will catch new files added or generated, but I somehow need to find and delete the files and folders already in the depot that would have been ignored by p4ignore changes if I'd gotten it right in the first place.
Is there a standard way to do this? Seems like it would be a common issue.
Reconcile Offline Work doesn't do it, have searched for a p4 command that would do it but there doesn't seem to be one.
Unfortunately, there is not a built-in command to fix that. The risk of permanently losing data would be way to high for something like that to be built in.
In order to remove those files, you will need to run the obliterate command on them, rather than just marking them for delete, which I would cause your workspace to try and delete those files off your computer and would cause lots of confusion when using reconcile offline work in the future.
I would recommend the script route that you mentioned, since it sounds like manually might be tedious, unless the ignore paths are mostly identified by folder, in which case, doing it manually wouldn't be so bad. Something like this:
p4 obliterate //.../FolderToObliterate/...
Or, if you want to restrict to a specific Depot (probably safer)
p4 obliterate //DepotName/.../FolderToObliterate/...
(This will NOT actually obliterate the files, but will output the list of files that would be obliterated without actually doing it. Run it again with -y
after obliterate
to actually permanently purge those files and their history)