Librarian checkout error prevents from sync - perforce

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!

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.

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 files all deleted

I'm new to using perforce. I was just copying files to perforce to the server for version control and sharing files. Although those 36 gigabytes of data were gone. All disappeared from my disk, nowhere to be found and reverting did not work. So is there anything I could do to restore my files?
If you submit files to Perforce, the server has safe copies of them, and you can get them back at any time just by running p4 sync.
End users are not permitted to permanently delete submitted files from a Perforce server, so under most circumstances once you submit something to Perforce it's safe forever.
Normally the administrator of a Perforce server will maintain backups so that even if the server is compromised somehow (e.g. a hardware failure or an admin mistake), the files can be recovered.
Some basic troubleshooting steps:
Does the server think you already have the files because you deleted them from a synced workspace without opening them for delete? Try p4 clean to restore your workspace to the state that you last synced/submitted.
Are the files deleted at the head revision? Try syncing to an older revision.
Did the files ever make it to the server? Try p4 files //... to see a list of all the files on the server.

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.

Perforce not syncing files correctly

I'm using Perforce P4V, the graphical tool, to interface with my Perforce server here at work. I have a project I added to the depot and I accidentally deleted it from my workspace on my local computer, problem is when I use the Get Revision Action (the GUI equivalent of sync), the files don't get updated, i.e. I can see the files on the server that I want, but they won't sync correctly with my local PC. It's frustrating me that the files aren't getting pulled from the server. What I'm assuming should be happening is if files are altered in anyway on my local PC, I should be able to grab the revision from the server, which then pulls the data to my local PC and overwrites the changes locally on my PC, but that isn't happening. Is there something I'm missing?
Perforce keeps track of the files that it thinks that you have on your local workstation. If you delete those files locally (and don't "tell" perforce about it), then Perforce will still think that you have those files. If you want to get them back, you need to "force sync" the files. In p4v, you can use the "Get Revision..." item and in the subsequent dialog, you can check the "force operation" checkbox to tell Perforce to give you all the files again regardless of whether Perforce thinks that you need them.
Just to complete the information, if you ever do want to remove the files locally, you can do so through p4v by choosing the "Remove from Workspace" item. Doing so will remove the files locally as well as tell perforce that you no longer have those files so that next time you sync, those files will be retrieved from the server.
Like other people have mentioned, one solution is to do a "force sync" the entire depot which is basically overwriting everything from server into your local. The downside to this is that it could take a LONG time to finish if you are working on a big depot.
Another alternative is to compare your local workspace with the server, then only force sync the files that are missing from your workspace.
p4 diff -sd //Depot/path/… | p4 -x – sync -f
-sd option: Show only the names of unopened files that are missing from the client workspace, but present in the depot.
There are more options (sa/se/etc.) available if -sd is not what you need. see here.
credits for the command goes to this blog.
They won't update because according to Perforce you still have the files on your local machine.
You need to use the "Get Revison..." option and enable the "Force Operation" option.
This will tell Perforce to refresh all the files even those it thinks you have the latest version of.
"Get Revision" will update only files that are not opened (checked out) even when "Force Operation" is enabled. You should revert all files marked as checked out in that workspace, and then use "Get Revision" with "Force Operation"
I did as you suggested, but I kept getting the message that the files were still open for edit and cannot be deleted, when trying Remove from Workspace.
Also, Get Revision returned with a message that no files were updated.
What I ended up having to do was Revert the files, then do the Get Revision action, that solved the problem.
For people coming into this question, this worked for me on the mac command line ...
cd into your local perforce workspace - the base directory of the checked out files that you are working on.
p4 sync -f
-f is to force the sync.
This can also come in handy when you restore a mac from a time machine backup.
https://www.perforce.com/perforce/r12.1/manuals/cmdref/sync.html
Check out the file, change it a little bit and then revert. Perforce will replace the local file with the latest revision.

Resources