perfocrce (p4) ; error deleting Perforce worksplace - perforce

I am having problem deleting Perforce workspace?
Even i am using P4V gui i am getting Error,
workspace has files opened.( p4 client -d user_workspace)
Client 'user_workspace' has files opened; use -f to force delete.

You can't delete a workspace with any changelists associated with it. Here's how to clear the changes or move them so you can delete the workspace:
Look at the pending changelist view
Find the changes associated with your workspace you want to delete (use the filter if there are too many to sort)
Either revert files in the changelists or shelve the files and associate the changelists with another workspace to clear them from the workspace to be deleted
Verify that the workspace is not locked, or unlock it if needed.
Now you should be able to delete the workspace.

Related

Perforce (2019): Files marked for delete, but associated Workspace/Changelist no longer available

I have a bit of a curious problem I've never run into before.
A student of mine deleted a depot from the workspace, but did not submit the changes. He then subsequently deleted his workspace (and all associated changelists). So this is now our situation:
marked for delete on depot
Workspace files marked for delete
How can I clean up this tag?
1) I replicated the work directory on another drive, deleted the workspace files (and submitted, deleting them off the depot as well).
2) Copied all the files from the backup, marked for add, then resubmitted
RESULT: They came back, still tagged for deletion.
I tried reverting individual files and entire directories (no luck).
I can't revert to a prior changelist, as the changelist in question is still pending.
Any ideas on how I can clean this up?
Thanks in advance!
I don't think the user actually deleted their client. Run p4 opened -a on the file(s) in question to see what client they're open on:
C:\Perforce\test>p4 opened -a //depot/...
//depot/main/bleh#1 - delete default change (text) by Samwise#classic
I can see in this output that the file is opened for delete on the client classic. Does that workspace still exist?
C:\Perforce\test>p4 clients -e classic
Client classic 2020/03/24 root c:\Perforce\test\depot 'Created by Samwise. '
Yes it does. Can I delete it? Yes, as long as I'm an administrator:
C:\Perforce\test>p4 client -d classic
Client 'classic' has files opened. To delete the client, revert any opened files and delete any pending changes first. An administrator may specify -f to force the delete of another user's client.
C:\Perforce\test>p4 client -d -f classic
Client classic deleted.
Is the file still open?
C:\Perforce\test>p4 opened -a //depot/...
//depot/... - file(s) not opened anywhere.
No it is not.

Perforce error while running command p4 copy on new created workspace

I just created a new workspace. I am getting "Can't clobber writable file" error while doing p4 copy from a branch to another. Concerned file has been deleted on source branch. I did not touch concerned file. Even doing p4 sync -f before p4 copy command does not help. What could be issue ?
See How to fix Perforce error "Can't clobber writable file" or Perforce Error Message - Can't Clobber Writable File for more information on the "can't clobber" error in general.
In the specific case you describe where you just made a new workspace, my guess would be that you made the new workspace in a folder where files already existed locally (maybe on top of an existing workspace?). If you did create this workspace folder on top of an existing workspace, stop and pick a new root folder for this workspace; the other workspace won't "know" that its filesystem is being modified by the operations you do in this workspace, and when you switch back to that workspace everything is going to be bad (you might find that you've lost pending changes, sync won't be fetching the right thing unless you force-sync everything, et cetera).
If messing up another workspace isn't a concern, just do:
p4 clean
and once that's done your p4 copy should work.
The file is writable on your local machine. p4 is trying to protect you from getting rid of a file you might have edited.
Since you say you created a new workspace, I'm assuming it contains the same root as your previous workspace. If you know you want to get rid of everything, you can manually delete those files and retry your p4 sync -f or the hand p4 refresh.

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.

P4: How can I delete a local copy of depot files?

I have a Unity project called, lets say, testGame in my Depot. On my C:\ drive, I have the Depot sync'ed so that Depot/Workspace are the same.
However, for some reason, the local copy of testGame in the Workspace has become corrupted- Unity is missing file references, errors are stacking up. I do not have this issue on other machines where the D/W are sync'ed, this is strictly an issue local to this machine.
Revert/Rollback has not fixed this. What I'd like to do is just nuke the local Workspace copy and re-sync from the Depot. Obviously, 'Mark for Delete' is not what I want. I tried "Remove from Workspace", but it just says "c:\Perforce_IntV2\prod\dl\testGame... file(s) not opened on this client"
Just using explorer to delete this files will also cause headaches- How can I just nuke my Workspace copy from orbit?
You can sync to version 0 (the 'version' of the files before it was there, meaning it will get removed) with you client of choice ('get revision...' in p4v, then tell it to sync revision 0; p4 sync //...#0 in the command line). You can do this on the root of your workspace, so everything that perforce knows about will be gone. Then delete in explorer whatever is left (verify that it's not some new file you forgot to add first though!)
If you really want to just nuke it all, deleting from explorer first will speed up the sync to revision 0.
Another way to nuke everything is to delete the files with explorer and delete the p4 workspace in your perforce client. You will have then to set up the workspace again though.
After any of those, just sync again and you're back to a clean workspace.
From P4V you can use "Reconcile" to figure out which files are off and put them into a changelist; once they're opened in a changelist, "revert" will put them back into the state that matches the depot.
From the command line, just run:
p4 clean
to clean up your workspace and make sure it's consistent with the depot (discarding any local changes that aren't already in a pending changelist).

Librarian checkout error prevents from sync

P4 calls "Librarian checkout" issues on folders (and files in it) that are not present in the depot tree BUT present on the perforce server - in from of empty folders.
If I try to obliterate (files or files with changelist) with p4 obliterate it tells me "No records to delete", when I'm using the Administration client it just cannot locate those when using obliterate option.
This in general prevents me from syncing with new workspaces, as it seems like upon syncing p4 fails to sync the files that were copied from other streams and points to revisions that are not there.
Example:
Librarian checkout D:\streamdepot/STREAM_NAME/unity/PROJECT_X/assets/objects/vehicles/materials/e_smallcorridor_01_cords_d.mat failed.
open for read: D:\streamdepot/STREAM_NAME/unity/PROJECT_X/assets/objects/vehicles/materials/e_smallcorridor_01_cords_d.mat,d\1.9789.gz: The system cannot find the file specified.
STREAM_NAME doesn't exists, and revision 9789 doesn't exist in history.
Thanks for any help in that matter!

Resources