JuniorIncanter
JuniorIncanter

Reputation: 1579

How can I take files in a P4 changelist and shelve them in a new changelist from the command line?

I start with P4 CL X, which contains only unshelved files. I want to create CL Y, which is identical to CL X (same description, same file edits), but has those files shelved. I'm scripting this, so it needs to be via the command line.

Problems I've run into:

  1. Getting the description from one CL to another seems messy. The best I've come up with is using p4 describe, parsing its output with regex to get just the description, and then posting it to the new one via 'p4 --field "Description=VARIABLE" change -o | p4 change -i'. This is ugly.
  2. I can shelve the files easily enough, but I can't find a command that allows me to move the shelved files over. Alternatively, I could copy the original files over, but I don't see a way to keep them on their original CL (and I would guess that this doesn't exist as it would create a conflict in the local repo, but I am not a P4 expert).

Thanks in advance.

Upvotes: 1

Views: 1224

Answers (1)

Samwise
Samwise

Reputation: 71562

These might require tweaking for your script but they worked well enough for me in a trivial test case:

  1. p4 --field Change=new --field Files= change -o OLDCHANGE | p4 change -i
  2. p4 unshelve -s OLDCHANGE -c NEWCHANGE ; p4 shelve -c NEWCHANGE

Upvotes: 2

Related Questions