Suppose I have finished some code for job A, but can't p4 submit until the code has been reviewed. Now I have to move on to job B, which depends on the changes I made in job A.
How would one ensure that the changes for job A are saved so that they can be submitted separately later (maybe after some further changes), and save the job B modifications (diff A..B) only onto a new changelist (which needs to be to shelveable at some point so that it can also be reviewed)?
This is a good use case for branching. The rub with trying to do everything with shelves is that shelved revisions are impermanent, so you can't have history that's based off them. If you create a branch, you can isolate your changes from the files that everyone else is working on, but still have them saved somewhere permanent.
The golden rule is "branch on incompatible submit policy". In this case you need to make a submit of unreviewed work (so you can do more work on top of it) but the branch you're in doesn't permit unreviewed work -- so make a new branch that does!
I'll assume for this example that you're using streams because it makes everything quicker; the same exact workflow happens with unmanaged branches, it's just more commands to type.
So let's assume you're currently in stream "main" and you have unsubmitted changes. Bring your changes into a new branch (I'll call it "dev-bob" on the assumption your name is Bob) like this:
p4 switch -r -c dev-bob
Now submit:
p4 submit
Now go ahead and make your other changes.
To get your changes into "main" and shelve them for review do:
p4 switch main
p4 merge --from dev-bob
p4 resolve -am
p4 shelve
To get everything up to a particular change "A" from dev-bob you'd add "@A" to the merge command.
I believe that is not possible in perforce.
One workaround is to have two copies of your work-space. When you are done with job A, shelve the changelist in first work-space. Keep this copy of code until your code-review is done.
Now, move to second work-space, unshelve the saved changelist for job A, and make whatever changes you want to make on top of it for job B.
Once job A is submitted to the server, do p4 sync on second work-space and p4 diff will show changes done on top of job A.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With