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.)
Related
Is it possible to get the total LOC for files in the depot?
I have already tried solutions which check for LOC's for changelists edited by a specific user using
P4 describe -ds
I wish to check the LOC for all the files under the directory without actually importing the files (Irrespective of the user who modified the file)
Also if this is possible wish to sort out these details with the file types.
There isn't a direct way to do this. You can use p4 print, as someone else already suggested, or p4 sizes, which gives you the the size of a file revision in bytes (and you'd have to calculate the difference between subsequent revisions).
I recommend paying special attention to integrations. If your Perforce server employs branches, you'll probably want to discount integrations from your metrics calculation. Only the original change should get credit for adding/modifying lines, pushing that change to another codeline should not.
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.
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.
I'm new at using Perforce and I am faced with a dilemma. I am working on two different projects and I'm trying to figure out if there is any way to separate the revision numbers between them.
The setup is something like this:
Depot 1 stores Project 1 and I use Workspace 1 to work on it
Depot 2 stores Project 2 and I use Workspace 2 to work on it
However, they don't have separate changelist numbers (when looking under history) and this is a little confusing (working with different people on them as well). The same revision number goes up whenever I submit from either of the projects.
Is there any way to have separate the revision counters for the two projects?
Edit: On closer examination, the revisions are separate for the actual files, is this an issue with how Perforce shows the changelist(?) number when switching between depots?
The files in the different projects each have their own history, and each file has its own revision numbers, while there are also repository-wide ways to refer to instants of time in the overall repository, such as by date and by change number.
Try looking at 'p4 help files', 'p4 help revisions' and 'p4 help filelog' to get an introduction to the various techniques.
Also install P4V and get comfortable with using tools like Time-Lapse View, the Revision Graph, and Folder Diff, as these are very important when comparing different work among different projects in your repository.
Lastly, labels can help you associate logical mnemonic names with particular sets of revisions, so look into 'p4 help label' and 'p4 help tag'.
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.