No permission to lock file when attempts to checkin after unshelve - perforce

Others has a change list that is shelved for me to checkin. So in my workspace, I first do unshelve:
p4 unshelve -s 111111
Then try checkin but fails:
p4ci -fixed QUEST -cr reviewer -- changedfile.cpp
And received the error:
changedfile.cpp - no permission to lock file
If I unshelve the changed file elsewhere and copy the file then overwrite the original one, checkin works. But his procedure does not seems to be legitimate. So what am I supposed to do after unshelve?

It sounds like the Perforce protect rules have been defined such that you have open permission for changedfile.cpp, but you do not have write permission.
See: https://www.perforce.com/perforce/doc.current/manuals/cmdref/p4_protect.html
open
This gives the user permission to do everything she can do with read access, and gives her permission to p4 add, p4 edit, p4 delete, and p4 integrate files. However, the user is not allowed to lock files or submit files to the depot.
Versus:
write
The user can do all of the above, and can also write files with p4 submit and lock them with p4 lock.
Your next step should be to contact your Perforce administrator and figure out why you only have open permission, not write permission.
Perhaps your account was not placed in the proper group; protections in the typical Perforce installation are granted to entire groups, not to individual developers, and hence you must be in the proper group to have the desired protections.

Related

How to submit a perforce CL of another user without admin privileges?

I don't have admin privileges. Need to test other's change lists and submit them.
Tried changing the owner of the CL but didn't work without admin.
p4 change -U <creator> <CL>
Error in change specification.
Change <CL> can only be updated by user <creator>
Unshelving the original CL, then testing it, will create a duplicate CL. Duplicate CL is submittable but not the original CL.
Are there any ways to submit a perforce change list of another user without admin privileges?
Based on documentation I'd say no (see below). The way you are doing it is probably the best way using shelving. Another option would be to have an unstable branch that code is okay to be broken and another user can 'release' after testing to a stable branch.
From my understanding, changelists are owned by the user and not really "transferable" like you want.
From Helix 2020.2 documentation on the p4 change command
The owner of an empty pending changelist (that is, a pending changelist without any files in it) can transfer ownership of the changelist to another existing user either by editing this field, or by using the -U user option.
If you start down the "sharing a workspace" path. Don't. "It is actively discourages by Perforce Technical Support" and "it is almost never a good idea to share a Perforce client workspace among multiple users" https://community.perforce.com/s/article/3675

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.

Getting Perforce client workspace handling automated

I am trying to automate access to Perforce via it's command line utility.
Creating a new client workspace with p4 client and syncing works ok.
Now I am allowing users to overwrite user, host, port, stream, revision.
From the docs it is not clear to me when I have to execute which commands to get the client workspace files in sync with an edited client workspace spec.
What I currently do is once p4 client is through search for
Client mymachine not changed
in stdout and do a p4 sync -f should the message not appear.
Is there a better or more sane way to do this?
I tried executing e.g. p4 sync -s in hope that it would fail should local data be deleted but it seems that I misunderstood the option?
It is not clear to me how this relates to your question about workspaces:
Now I am allowing users to overwrite user, host, port, stream,
revision.
since only one of those is a property of a workspace. I'm going to disregard that statement for now but if it was significant I'd encourage you to post a follow-up clarifying what you mean by "overwriting" each of these properties.
To your question:
From the docs it is not clear to me when I have to execute which
commands to get the client workspace files in sync with an edited
client workspace spec.
If the client View is updated, all you need to do is:
p4 sync
If the client Root is updated, or any of the other options that globally affect how files are written to the workspace, such as allwrite or modtime, you will need to re-sync the entire client. Ideally this is done by doing:
p4 sync #none
prior to changing the workspace in one of these ways. The other option would be to do something like the following sequence:
p4 sync #none
p4 sync
p4 clean
to make sure that everything is rewritten, and that any stragglers (e.g. anything that the "sync #none" couldn't locate because the Root had changed but that are still mapped in the client view) are removed from the workspace.
I tried executing e.g. p4 sync -s in hope that it would fail should
local data be deleted but it seems that I misunderstood the option?
Deleting local data is a separate issue from editing the client spec, but for that the command you want is p4 clean rather than p4 sync -- you use sync to tell the server you want it to send you new revisions, you use clean to bring your workspace back in line with what the server already sent you.
The recommended/supported workflow is to always use p4 commands to manipulate the read-only files in your workspace -- so if you want to delete a local file, use either p4 sync FILE#none (to remove it from your workspace but not affect the depot) or p4 delete FILE (to open it for delete so that it will be deleted for everyone when you submit).

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