How to remove reverted file from swarm review - perforce

I created swarm review, then decided to revert some changes, so deleted files from corresponding CL. But files are still in swarm. There are two types of such files:
Files existed before i made my changes and i reverted it.
Files created during my changes and i deleted it.
How can i remove these both types from swarm review?
EDIT:
As i wasn't able able to remove file from swarm, i added this file reverted again to the CL and after this in swarm i have
And then i removed the file from the CL. And it continued to be in swarm.

You need to get the files right in your pending changelist's shelf. Presumably using P4V or p4 or whatever client you are using. Once the shelf (as well as the pending changelist) only contain the files it/they should, update the review.

First get you files right in the Changelist, using p4 revert.
Then while you are shelving them again, use -r. It will replace the existing shelf with the current shelf completely. Normally it would do file by file, thus causing the issue for deleted files. Swarm will show the updated shelf after this.
p4 shelve -r -c 123456

Related

Perforce: How to mark for delete files present in depot but not in workspace?

We have a code base which is downloaded from internet (GitHub repository). Updating process is following:
p4 Checkout existing version
Download new version from internet and extract it over old version
p4 Revert unchanged files
p4 Submit changes
Problem with this approach is that files which are not present in downloaded repo (removed from GitHub repo) are still present in file system and considered as unchanged. Revert unchanged files will revert them back and keep in depot/workspace. This is particular problem for Java files since we compile by specify root folder. Remaining file is unreferenced in new source but you can't see it.
p4 clean has option -d
Deleted files: Find those files in the depot that do not exist in your workspace and add them to the workspace.
but I am looking for opposite
Find those files in the workspace that do not exist in your depot and delete them from the depot.
If I delete whole folder structure from file system, workspace goes out of sync.
How to find/mark for delete files which are not present in new folder structure?
This is my typically recommended workflow for this use case:
Start with an empty workspace
Extract the current version of the tree into the workspace
p4 flush to the revision you want to use as the base (if you've made no changes to this branch on the Perforce side, you can just use the default #head)
p4 reconcile to open all files for the appropriate action
p4 submit
To elaborate on step 3: the "base" should be whatever revision the two trees were last in sync at. If this is a one-way operation, it's always just the latest revision (which came directly from github). If you're making changes on both sides, you should have a separate branch on the Perforce side for your github imports, and only use it for imports; then do one-way merges from there into your development mainline so you can resolve differences with all the right history tracking.

How can I synchronize(submit) my local folder with depot, when I have lots of redundant files deleted manually from workspace,

I have never used P4 version control system before, and just come across with following problem:
I was submitted a project to server with lots of redundant files and have been working on the project actively. Now I have my project working and clean, and want to synchronize with depot. The problem is that I have deleted lots of files manually in windows file explorer(from my workspace),ignoring the rules of p4(mark for deletion, submit etc.).
How can I synchronize my project with depot? With another word, how can I delete files from depot that I have manually deleted from local folder, which are not shown in "workspace" tab.
Run the command:
p4 reconcile
This will automatically scan your entire workspace for added/deleted/modified/renamed files and open them for the appropriate actions. Once you've run reconcile you can just p4 submit as normal, and everything you did in your workspace should get submitted to the depot.
If you're using P4V, I think there's a "Reconcile..." menu command that will do something similar.

Perforce will not delete files and folders from Depot

I have a workspace that some files and folders were deleted offline. The workspace shows them there on the depot side. No matter what I do, I cannot get it to remove those files/folders. When I select "Mark for Delete" is says "file(s) not in client view." Well I KNOW that. That's why I want to remove them from the Depot!
The option for "Reconcile Offline Work" is grayed out. No idea why.
"Remove from Workspace" returns either "file(s) not in client view." or "no files updated" depending on its mood.
I have other folders in that area that I need to keep but I want to clean up the Depot so ONLY those folders are shown.
If I try "Get Latest Revision" with a force (I figured copy them back then delete while online), it says "11 Files Removed" but changes nothing. I have Refreshed and exited and restarted.
I am using P4V (GUI version)
Your description of the situation as having simply deleted the files offline is not accurate. If the files are not in your client view, it means you have ALSO either:
modified your client view
switched client workspaces
Undo whichever of these you did, and then Reconcile will see the missing files and open them for delete.
Since they are not currently in your client view, there is no association between the deleted files in your workspace and the corresponding depot files. Any time you want Perforce to do anything involving files in your workspace, the client view needs to specify how those files relate to the depot.
(adding more to take into account the comment about the client spec being deleted, and apparently recreated with a different view, which is pretty hard to tell you how to recover from since I don't know anything about the before/after state other than that there are files... somewhere. Unfortunately it's not possible to simply undo a client spec deletion, short of a checkpoint restore, since client specs aren't versioned objects.)
If you deleted your client spec, records of what you previously had synced to your client are deleted along with them (next time just update the Root if your workspace moves), and so Reconcile won't work, even if you recreate the client with the same View.
To be able to delete the files from P4V, you'll need to sync them, but it sounds like you have the additional problem of having re-created your client spec with an incorrect View, so you can't even sync the files yet. Here's what you'll need to do:
Add the depot path to your client view.
Sync the files to your workspace.
Mark for Delete.
Submit.
From the command line syncing is optional, so you could do these steps to delete your client (again), recreate it (with the wide-open default view this time), open the files for delete, and submit:
p4 client -d YOUR_CLIENT
p4 client -o | p4 client -i
p4 delete -v //depot/files/to/delete/...
p4 submit
If you have a spec depot, you may be able to use this to restore your workspace to a point before the view was changed.
More information about working with the spec depot is here:
http://answers.perforce.com/articles/KB/2445
Perforce doesn't recognize the offline deleted files, You have to get latest revision first with 'Fore Operation' Checked.
Now you will see all your deleted files in your depot.
If you still don't see your delete files in depot, then take a backup of the entire folder. Now delete the folder, and do a getlatest with 'Fore Operation' Checked.
Now you will for sure see the deleted files also under the depot.
Now you should do 'Mark for Delete' for the file u wish to delete from depot.

How to reconcile newer workspace files with depot in Perforce?

I have a situation where my depot is saying it has the latest version of a bunch of different files but my local workspace actually has newer revisions. My tools (P4V and VS plugin) are incorrectly telling me that everything is up-to-date.
I can prove this is the case because if I check out the file, make no changes, and submit, the changes are committed and the history appears correct and get latest operations on other machines pull the correct version of the file.
This isn't really a viable solution as there could be many files that require this fix and I have no way of knowing I have fixed them all.
I believe the issue has come about due to occasionally working offline and (incorrectly) twiddling the read only flag on the file when I needed to make a change.
So my question:
Is there a command (or similar) I can run that will look at my workspace files and see that there is a change that hasn't been committed. Essentially ignoring the 'reported' state of the file? Something like sync but in reverse? This would allow me to 'force commit' all those files and get the depot in the correct state.
The command you are looking for is called 'p4 reconcile'. Here's some background information: Working Disconnected from the Perforce Server.

Cleaning out a workspace and setting a new mapping to the client

I was using Perforce to check some code in, into a workspace on the server. As luck would have it, things got into a mess.
How can I easily delete everything on my project, on the server, and set a new mapping to the project on the client (my dev machine)?
Thanks
The obliterate command (only available to users with super access) is used to permanently remove files from Perforce. Be aware that when you obliterate a file, it's like it never existed. All the revision history will be gone. If you really, really want to start over, then you should obliterate the files, otherwise you can just delete them (which will maintain the revision history).
Once the files have been obliterated/deleted, you should just be able to re-add the new files to the depot in the same location. I know that deleting the files will also remove them from your workspace, but it's been a while since I've obliterated anything, so I don't remember what happens there. If obliterating does leave the files on your computer, you can just delete them.

Resources