Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use Perforce Shelving to have one person create a change and another person submit it?

I want UserA to be able to create a changelist in Perforce and then Shelve it. I would then like UserB to be able to unshelve that changelist and submit it.

This sounds simple, but Perforce unshelving doesn't seem to work the way I would expect. When UserB runs 'p4 unshelve -s 1234', it unshelves all of the changed files from change 1234, but it does not bring the change's metadata (description, job fixes) with it! This means that UserB can copy a shelved CL into a whole new CL and submit it (by manually re-creating the description and fixes), but that leaves the old shelved CL hanging around.

The logical thing here would be for UserB to

  1. Unshelve the CL
  2. View the shelved CL's metadata
  3. Copy that metadata into a new CL
  4. Submit the new CL
  5. Delete the old shelved CL
That's what the Perforce documentation even recommends. There'd one little problem: UserB is not allowed to delete another user's shelved CLs! Only UserA and a p4 admin can delete his shelved CL. I don't understand why the documentation glosses right over this.

Has anyone ever had this problem before? How did you resolve it?

EDIT: I should clarify that my question is very generalized. I'm working on a tool where UserA is the developer, and UserB is the build system itself. A developer would shelve a CL and then have the build system unshelve and validate it with a series of builds and tests (automatically submitting the CL if it passed all of those tests). Expecting every developer to remember to delete their shelved CLs if the build system submitted them seems bound for failure!

like image 439
Jay Spang Avatar asked Mar 19 '12 04:03

Jay Spang


2 Answers

What about having the build system send back a notification of success or failure, and letting the developer submit the changelist themselves?

Trying to automate submission of a changelist could get tricky if any files need to be resolved. You might be able to automate some of that, but not if there are any conflicts.

like image 91
Mike O'Connor Avatar answered Sep 22 '22 21:09

Mike O'Connor


You might find this feature, introduced in Perforce 2013.1, to be useful:

    #539809 (Bug #53058) **
        Shelved changes containing files that do not require resolve
        may be submitted directly without unshelving first via
        'p4 submit -e <shelvedChange#>'. See 'p4 help submit' for
        details and restrictions.
like image 43
Bryan Pendleton Avatar answered Sep 21 '22 21:09

Bryan Pendleton