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

advertisements

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!


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.