I'd like to have a "LAST_KNOWN_GOOD" label that points to the latest database that passed nightly regressions (done automatically by the regression script). The idea being that folks can just sync to that label when the head of tree is broken.
So, the same label spec would get updated over and over. I'm not seeing anything obvious on how to do this in the perforce doc.
p4 labelsync -l LAST_KNOWN_GOOD
It's really as simple as that. As long as the label isn't locked, and the label already exists.
The p4 label command can create a label.
You can always learn more about any command by typing p4 help command
Yes, if the label is not locked, you can change the contents of the label. Have a look at the 'p4 labelsync' command.
Related
Is there a way to view all changelists that were made in the context of a stream in perforce? I am interested in a command line way.
Similar question: suppose I have a stream and its parent. Is it possible to find the changelist that is their latest common ancestor?
If you want to see not only locally made changes but also those that are included via import, the simplest way is to switch to that stream and run the query in the context of the current client:
p4 switch STREAMNAME
p4 changes //CLIENTNAME/...
Changes made locally will usually be in the depot path that matches the stream name (e.g. //stream/STREAMNAME/...), but if you use import+ this is not necessarily so (although if you use import+ the concept of changes being made within the context of a particular stream goes out the window entirely).
Finding the changelist that is the "latest common ancestor" depends what you want to use this ancestor for and what you consider to be a "common ancestor" and even what "latest" means (the word "latest" implies most recent chronologically, but that's not necessarily the same as "closest" in terms of having the most commonality). Some general approaches that might be useful:
Use the p4 istat command to see when the last merge/copy operations happened and what the latest change was that each included.
Use the p4 changes -i command on each stream to see what changelists it includes (including integrated ancestors), and diff to find the common ancestors.
Use the p4 integrate -o command to see the merge base for each file, and get the associated changelist with p4 changes or p4 files.
Thanks to Sam Stafford for pointing this out.
First use
p4 interchanges -S <child_stream_name>
This will give you a list of the changes that have not been copied up the parent branch.
To view diffs you can either use "p4 describe" on each of the changelists in the list.
I'm wondering what actions results in the left part of the graph, i.e. the red dashed arrow? This was done by Unreal Engine's Perforce plugin, when I renamed this file and submitted this change. The action shows add if I highlight that revision, but according to legend, this is a merge w/ edit action, so it doesn't seem to match.
The right part is my test, using P4V's move/rename action, and the action shows move/rename, which matches the legend Add (branch w/ edit), so this one seems fine.
So, what exactly happened in the left part? Is it really a merge w/ edit? Is it a correct result if someone is doing rename? Is move/add the only correct result when doing rename?
Thanks.
It's a mind-twister but there isn't necessarily a mismatch.
First the actions: the first is an add because the new file is created in addition to the old one. In contrast, the second is a move/add because you're adding a file by moving it from the old location, hence the old one ceases to exist. Indeed, you start the whole exercise with one file, and end it with two (rather than with three, as you would if you performed two adds; or rather than with one, as you would if you perform two move/adds).
Now the arrows. You're right the naming seems completely out of touch with the naming of the actions. I have no idea why there's the inconsistency.
You're asking about the Merge w/ Edit specifically. Perforce has four similar but distinct actions that could have been used here: p4 integrate, p4 merge, p4 copy, and p4 populate. There are subtle differences that don't matter here. At any case, all these actions do "merge" the file so I think the naming is OK. Intuitively, I feel this could/should have been done by p4 copy (since the target didn't exist, so you didn't have to merge anything) but it's also perfectly possible that Unreal Engine decided to use p4 merge or p4 integrate anyway. That, I believe, explains why the arrow is a Merge. As for the w/ Edit, did you perhaps make a (textual) edit in the file while duplicating it?
Let's say I have a file //depot/Project/com/company/project/SomeClass.java that is labeled with name "version-1.0.0". Suddenly I need to revert back to that label to create a bugfix release. I update to it and then make changes to the SomeClass.java.
Now this is the part I don't understand. How do I submit the fixed SomeClass.java to Perforce without overwriting any newer revision of the source tree? With Mercurial or Git I would have a branch that has the fixed source and I would just create the bugfix build from there. But now I have no idea where I should put the fixed file.
You've got essentially the same choices in Perforce as you do in those other systems, although the terminology is a bit different.
The simple solution is to make your change to SomeClass.java, and then make a new label, called "version-1.0.1", which tags the new version of SomeClass.java rather than the old one, but otherwise is identical to the version-1.0.1 label:
p4 sync //...#version-1.0.0
p4 edit SomeClass.java
p4 submit -d Fixed_that_nasty_bug
p4 label version-1.0.1
p4 labelsync -l version-1.0.1
Alternately, you can also make a branch in Perforce, and you can use your label as the basis for making that branch.
So you could do something like:
p4 integrate //depot/Project/...#version-1.0.0 //depot/rel-1.0.1/Project/...
Then you can make your change to //depot/rel-1.0.1/Project/.../SomeClass.java, and submit it back to the rel-1.0.1 branch.
If this is your first time thinking about things like development branches, release branches, etc., can I suggest having a read of http://www.perforce.com/perforce/conferences/us/2005/presentations/Wingerd.pdf or picking up a copy of Laura Wingerd's Practical Perforce and reading the chapter on "the mainline model"?
I need to append some text to the description of already existing changelist in Perforce using Java.
What would be the most efficient way to do it?
I could think of
1. CL_content = p4 change -o <changelist>
2. Then append the required text to the description
3. p4 change -i CL_content
But, it would not be suitable for very large changelists.
Any other way?
Your solution looks good. No other option to update a bulk of changelists at once.
Perforce should be able to take the load when you are doing one after other. I don't see any issues with it.
When I do an update and zillions of files are updated, I often miss the one that aren't merged because of conflicts. The only way I have is to go through all my changelists and look at file icons.
Isn't there a nicer way ? even a console based command would do...
You could immediately do an update again, which this time would just print out the conflicts. If you are using p4v, make sure you have the log showing, as the results should scroll through there.
From the command line,
p4 resolve -n
will list each file with unresolved conflicts.
In p4v, you can right-click on the root of your depot or workspace and select "Resolve" to get a window where you can resolve conflicts interactively.