Reputation: 1091
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.
Upvotes: 0
Views: 60
Reputation: 16359
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 //[email protected]
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/[email protected] //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"?
Upvotes: 1