I am just assuming that simple lock on the branch will lock the branch ? . will that suffice
Or is there any other special procedure to lock the branch . Please let me know if I need
Anything to do apart from just click on lock .
The owner, admins, and superusers can lock Streams in Perforce with a button click yes. When modifying a stream there is a box under the advanced tab: "Locked (only the stream owner can edit stream settings)" and another: "Submitting files to the stream restricted to stream owner"
Ok so its two clicks...these two combined effectively lock a stream for all other users.
I believe the only way to "lock" a branch in Perforce would be via the Permissions Table. This can be viewed via the admin gui (separate install) or via p4 protect on the command line. p4 protect is an admin/super user only item I believe
Related
I figured I'd post here, after posting on SuperUser, since I want to get input from software developers who might have encountered this scenario before!
I would like to initiate a series of validation steps on the client side on files opened within a changelist before allowing the changelist to be submitted.
For example, I wish to ensure that if a file is opened for add, edit, or remove as part of a changelist, that a particular related file will be treated appropriately based on a matrix of conditions for that corresponding file:
Corresponding file being opened for add/edit/remove
Corresponding file existing on disk vs. not existing on disk
Corresponding file existing in depot vs. not existing in depot
Corresponding file having been changed vs. not having been changed relative to depot file
These validation steps must be initiated before the submit is accepted by the Perforce server. Furthermore, the validation must be performed on the client side since I must be able to reconcile offline work with the copies on clients' disks.
Environment:
Perforce 2017.2 server
MacOS and Windows computers submitting to different branches
Investigative Avenues Already Covered
Initial design was a strictly client-side custom tool, but this is not ideal since this would be a change of the flow that users are familiar with, and I would also have to implement a custom GUI.
Among other approaches, I considered creating triggers in 2017.2; however, even if I were to use a change-content trigger with all the changelist files available on the server, I would not be able to properly perform the validation and remediation steps.
Another possibility would be using a change-submit trigger and to use the trigger script variables in 2017.2 to get the client's IP, hostname, client's current working directory, etc. so that you could run a script on the server to try to connect remotely to the client's computer. However, running any script on the client's computer and in particular operating on their local workspace would require credentials that most likely will not be made available.
I would love to use a change-submit trigger on the Perforce server to initiate a script/bundled executable on the client's computer to perform p4 operations on their workspace to complete the validation steps. However, references that I've found (albeit from years ago) indicate that this is not possible:
https://stackoverflow.com/a/16061840
https://perforce-user.perforce.narkive.com/rkYjcQ69/p4-client-side-submit-triggers
Updating files with a Perforce trigger before submit
Thank you for reading and in advance for your help!
running any script on the client's computer and in particular operating on their local workspace would require credentials that most likely will not be made available.
This is the crux of it -- the Perforce server is not allowed to send the client arbitrary code to execute. If you want that type of functionality, you'd have to punch your own security hole in the client (and then come up with your own way of making sure it's not misused), and it sounds like you've already been down that road and decided it's not worth it.
Initial design was a strictly client-side custom tool, but this is not ideal since this would be a change of the flow that users are familiar with, and I would also have to implement a custom GUI.
My recommendation would be to start with that approach and then look for ways to decrease friction. For example, you could use a change-submit trigger to detect whether the user skipped the custom workflow (perhaps by having the custom tool put a token in the change description for the trigger to validate), and then give them an error message that puts them back on track, like "Please run Tools > Change Validator, or contact wanda#yourdomain.com for help"
In my sandbox S, I have created a changelist X and it gets submitted to perforce as Y. From Y , I want to get the exact creation time of X. That is the first time this changelist was created.
The unit of versioning in Perforce is the submitted changelist; there is not generally a detailed record of everything that happened in the workspace prior to the submit, including edits made to the changelist while it was in a pending state. (If you want more fine-grained versioning, submit more fine-grained changelists.)
That said, if you're willing to do the work, you can parse this information out of the server journal files (which are primarily used for server recovery rather than end-user consumption, but since they represent a plaintext record of every database transaction you can mine a LOT of data out of them if you've got access and a good understanding of the server database schema). Look for modifications to the db.change table; each one is timestamped. If you need to know when files were opened prior to the creation of the changelist, those updates are in db.working.
In perforce I have a repository in depot. I want to make a copy of this repo under tasks or streams. Speaking with git terminology - to make a fork. How can I make it? I have a write-access to a repo in depot.
Since I might confuse perforce terms, I will show with screenshot examples:
Under depot I have several folders like this:
I want to copy one of the folders under depot and paste it under streams as shown on here:
I'll give two different answers, neither of which uses the word "repo" or "fork" since those aren't terms in Perforce and they could mean two different things ("repo" could be a "depot" or a "server" -- the confusion is compounded by the fact that people sometimes say "depot" to mean "server" if their server only has one depot):
To branch a path //depot/thing from your classic depot depot into a new stream on the same server:
Create a new stream depot: p4 depot -t stream streams
Create a new stream: p4 stream //streams/thing
Populate the stream from //depot: p4 populate //depot/thing/... //streams/thing/...
To clone that path from your shared server into a mainline stream on a new personal server:
p4 clone -f //depot/thing/...
(The p4 clone command automatically creates a stream depot, a mainline stream, and a client workspace on your personal server that will be created in the current working directory -- you should run this someplace outside of the client workspace that you use on the shared server.)
I just create a new depot in the GUI and then add a new stream (again from GUI) make it a top level stream and then it asks if you want to branch an existing stream across. Select the depot/stream you need to fork and then it will copy that into your new stream.
I was wondering if anyone had any advice on how to do the following task in p4v (I am not too familiar with P4V commands, so apologise if this is some basic command that I am missing).
Currently I have a workspace setup and data synced to my root
e.g. C:\Data\
I access this workspace from two different windows machine. (data is on both machines at c:\Data
Now, I need to move the location of where the data is stored on ONE of the machines and not the other (Machine A : c:\Data, Machine B: D:\Data\
Is this possible to do, without having to sync all the data again from the server (there is a lot and bandwidth limitations).
My initial thoughts were to create another workspace pointing to another root, but I do not know how to get this new workspace pick up the data files at this location.
Any help would be greatly appreciated
Thanks in advance
I don't know of a way to do this through P4V, but it can be done with the command line client. Here's the procedure.
After you have moved your files on machine B, and created a new workspace (without performing an "update all"), you can pass the -k switch to the sync command to let the server know what files you have.
From the web page to which I linked:
Keep existing workspace files; update the have list without updating
the client workspace. Use p4 sync -k only when you need to update the
have list to match the actual state of the client workspace.
And the command line help has this to say:
The -k flag updates server metadata without syncing files. It is
intended to enable you to ensure that the server correctly reflects
the state of files in the workspace while avoiding a large data
transfer. Caution: an erroneous update can cause the server to
incorrectly reflect the state of the workspace.
FYI: p4 flush is an alias for p4 sync -k
You can also look at the AltRoots field in the workspace. You could have one root at c:\data and the other at d:\data. As raven mentioned since the data is living on two separate disks you'll need to make sure that the data is kept in sync on both machines, although I assume you've already figured this part out since you've been running on two machines.
Any reason you can't just have one workspace per machine?
I've deleted a particular user from perforce which has removed the locks from the files where that user has placed a lock.
I'd expect the lock to remain, so why is it not happening ? What should be done to do so ?
I've removed his workspaces as part of the procedure to remove the perforce user.
I assume you mean someone ran the p4 lock command? Or perhaps the files are set for exclusive checkout?
In either case, once the user is gone those locks have no meaning, as they are tied to a user and workspace. If you want to restrict edits on those files, you can lock them again or change the protections on the files.