Won Jun Bae
Won Jun Bae

Reputation: 5389

How can I grab my local changelist and send it to someone else in Perforce?

How can I grab my local changelist and send it to someone else in Perforce? More specifically, I would like to send unsubmitted changes from a local pending changelist to another user's pending changelist.

Upvotes: 16

Views: 11832

Answers (5)

Samwise
Samwise

Reputation: 71574

To shelve your pending changelist YOURCHANGE:

p4 shelve [-c YOURCHANGE]

The other user then does:

p4 unshelve -s YOURCHANGE [-c THEIRCHANGE]

In either case the "-c" arg can be omitted to use the default changelist instead. In the p4 shelve case it means a new changelist will be created and the files in your default changelist will be shelved into it; in the p4 unshelve case it means the shelved files from your changelist will be unshelved into the other user's default changelist.

Upvotes: 3

Andrii Tishchenko
Andrii Tishchenko

Reputation: 1910

Perforce 2016, osx. Diff for pending changelist:

mac:src user$ cl=123456 && p4 diff -du $( p4 files @=$cl | sed s/#.*// ) > $cl.diff

output: 123456.diff

Applying patch:

mac:src user$ patch -p0 < 123456.diff

Upvotes: -1

Tim Danner
Tim Danner

Reputation: 640

P4 now has native support for the shelve operation in 2009.2. Both the client and server need to be at least 2009.2 to use this.

http://blog.perforce.com/blog/?p=1872

Upvotes: 11

Greg Whitfield
Greg Whitfield

Reputation: 5739

Not sure exactly what you are trying to do, but you may also want to consider P4_Shelve. It allows you to put a load of pending changes away on a virtual shelf, and then grab them back again later. Depending on what exactly you want to achieve by sending a changelist to someone else, this could provide a part of the answer.

Linked from the P4Shelve site is P4Tar which may also be useful - this does all the packing on the client side so you just get left with a file you can send to someone else.

Upvotes: 2

Ana Betts
Ana Betts

Reputation: 74702

set P4DIFF=C:\cygwin\bin\diff.exe
p4 diff -du -c 12345 > patch-to-head.diff

# On Other machine
patch -p1 < patch-to-head.diff

I may be wrong on the env var there, and you might have to do some fixups on the diff file, but the general idea is that you generate a GNU Unified Diff, that you can send to people that can use GNU patch to apply it.

Upvotes: 12

Related Questions