Perforce changelists - is it mandatory? - perforce

I'm trying to understand if I must use a changelist when I checkout a file?
I'm consider to use Perforce (haven't tried it yet). My question refers to its methodology.

There's a default changelist where things go if you don't specifically choose another changelist for it, but it has limitations like not being able to shelve files. If you're spending a significant amount of time on a change, it's usually very useful to create a numbered changelist with your eventual submit message right away. It's also handy to put temporary changes you don't intend to submit into their own changelist. It's a similar workflow to the way people use multiple local branches in a DVCS.

Related

Can we get the changes from classic deport to stream depot in perforce?

One question i have, After creating a stream from classic depot(consider it as main branch) we will be working on stream (mainline stream). If suppose when some developer is not aware that streams are in and made check-ins in classic depot mian branch and if we want to get those changes from classic deport to respective mainline 'stream' is it possible ?
If suppose when some developer is not aware that streams are in and made check-ins in classic depot mian branch```
Use p4 protect to remove write access to your main branch if you don't want people submitting to it. That's much easier than trying to relocate changes that went to a place they should never have gone to.
Generally speaking, though, if a change is made on the wrong branch/stream, the easiest thing is to merge it to the right one. You can also undo it on the original stream if needed.

How to view all the P4 changes shelved by a specific user?

Describing my requirement below, just as an example. The main question above in general, can be relevant to much diverse audience under diverse scenarios.
While developing a code, I have a practice of shelving the changes made to the code periodically. For example, if my code intends to achieve 4 different objectives, I shelve my changes each time one of the objective is achieved. That way, if I mess up things while coding for a next objective, I just unshelve the changes from my previously shelved changes. This is a very nice way of cleaning up things.
The problem is when there are large number of shelved changes, it becomes difficult to keep track of all your change-list numbers. In such a case, if there is a single command to retrieve a list all the change-lists shelved by me or any user for that matter, I can do a p4 describe -s <#CL> and get the know what changes does a particular shelved change-list contains. That would definitely help keep things more organised!
The command you need is
p4 changes -u USERNAME -s shelved
You can further limit that to a specific workspace etc. (See p4 help changes for your options.)

how to determine changes belonging to same changelist in perforce while diffing?

Is there a way to determine if two differences between two versions of a file belong to same or different changelist ?
If not, then would it be a good practice to mention the changelist numbers in the comments when the changes are made ?
I'm not quite sure what you're asking, but the visual client has a Time-Lapse View for a file that will tell you which revision introduced a particular change, and you can scrub that back through revisions as well to find out earlier changes if needed.

Moving Perforce folder to another server

How do I move a folder to completely different Perforce depot on a completely different server but preserving history and changes?
Splitting and merging portions of Perforce depots from separate servers can be done, but you will need the assistance of Perforce technical support, so contact them!
A substantially simpler solution is to retain the two separate servers, and use a Remote Depot definition so that you can access the files in Server A from client workspaces connected to server B. That way, your users mostly see things as though there was a single server, when in fact there are multiple servers.
You don't really need the help of perforce tech support. If you have administrators, you may need them to set up a target depot and/or provide access, but the basic task is performed using functions available to the general user. Here's what I would do (in a nutshell): If you open a P4V session and select the submitted changelists tab, you can filter this set to show only the changes that relate to the section you want to move. This is the change set you will duplicate on the new depot (or even server) that you want to populate. The idea is that you are unraveling the archive files on one side and winding them up in the identical way at the destination. So the process is simply (1) syncing to the first changelist, (2) integrating that set across to the new location, (3) checking that set in, and (4) repeat for all subsequent changelists in order until done. Obviously this can be scripted. I am currently in the process of working a script up in python, but any decent scripting language with Perforce function libraries will work. A couple of complications: The changelists will be sequentially the same as the originals, but the original times will not be preserved - they will be "current". And of course if there are labels, you'll need to map that out in the new location if you want them preserved.

How do I move folders between Perforce "depots"

After deleting my Svn repo by accident the other day I wanted to try something else and I have chosen Perforce as my current versioning tool testing ground. It is going great and I am liking what am seeing in Perforce.
Here is my problem. I have submitted my files to my Perforce server and then used my client pcs to grab those projects from the master Perforce server. Now all works great except that I realized that it is possible to use more than a single "depot" in Perforce, and it makes sense to me that I should just move some of those projects to another depot fpr the sake of organization and and maybe for security reasons inn case.
I have been looking for some answers, and I have found couple of them however I am unable to produce any intended results thus I am looking for some expert advice here.
One of the pages I have tried is this one
http://kb.perforce.com/article/24/renaming-depot-directories
Seems to offer a solution, however I have not been able to move files from one depot to another depot that is on the same server process. The examples in the page works fine for moving some folder to a folder in the same depot. The example seems to demonstrate moving to another folder under the same depot.
So I am looking for a reasonable and safe way to move my master Perforce depot folders to another depot that is on the same server, and naturally without loosing any work.
Here is what I am wanting
-- Current
//Depot-A
-->folder1
-->folder2
-- I want
//Depot-A
-->folder1
//Depot-B
-->folder2
thanks
Moving files between different depots is no different than moving files between folders within the same depot, with the exception that the target depot must already exist. Using your example, and assuming "Depot-B" doesn't exist yet, to move "folder2" from "Depot-A" to "Depot-B", you would simply do this:
p4 depot Depot-B
p4 edit //Depot-A/folder2/...
p4 move //Depot-A/folder2/... //Depot-B/folder2/...
p4 submit
Here's what I would do (in a nutshell): If you open a P4V session and select the submitted changelists tab, you can filter this set to show only the changes that relate to the section you want to move. This is the change set you will duplicate on the new depot (or even server) that you want to populate. The idea is that you are unraveling the archive files on one side and winding them up in the identical way at the destination. So the process is simply (1) syncing to the first changelist, (2) integrating that set across to the new location, (3) checking that set in, and (4) proceed to the next changelist. Obviously this can be scripted. I am currently in the process of working a script up in python, but any decent scripting language with Perforce function libraries will work. A couple of complications: The changelists will be sequentially the same as the originals, but the original times will not - they will be "current". And of course if there are labels, you'll need to map that out in the new location if you want them preserved.
I don't think additional depots add much in the way of security. Multiple depot scenarios primarily arise in very large installation.
The primary benefit of additional depots is that you can gain more control over the disk space layout of your server, for example if your repository is too large to fit onto a single filesystem and you need to expand it to use multiple filesystems. A secondary reason to create additional depots is if you have to have depots of specialized types; for example if you wish to create a Streams depot to use the Perforce Streams feature.
For a scenario such as the one you describe, having all your files under Depot A is probably fine for the foreseeable future.

Resources