Perforce: How do I p4 integrate a local uncommitted changelist?

p4 diff -u your/branch/... | patch -p x -d your/otherbranch

Where x is an int, you should try from 0 until it's working, use --dry-run in patch to test. (-p is the number of directory to strip so that file path in your/branch and your/otherbranch matches, 2 in this example)


I just bumped into the same situation, here is my solution for it (very similar to Jeff's but there is no Submit in the process), maybe it will help someone someday:

  1. Integrate (and resolve) the related files from ProjectB to ProjectA while the edited but non-submitted files are there.
  2. Check-out the related files in ProjectB.
  3. Manually copy the related files from ProjectA to ProjectB.
  4. Revert files in ProjectA.

Hack-ish solution:

  1. Check out the files in project B
  2. Manually copy files from project A to project B (they're not write-protected due to step 1)
  3. Shelve changelist in project A
  4. Submit to B
  5. Integrate files from B to A and resolve
  6. Unshelve files from step 3. Resolve as needed accepting yours.
  7. Submit to A when ready

Another approach is to create a separate branch where you do your work and then integ to A or B as needed.

The general idea is that Perforce works in terms of submitted or shelved changelists. The idea of integrating an non-committed changelist seems to go against Perforce's natural grain which makes these workarounds cumbersome.


Perforce has a much easier way of accomplishing this:

  1. Shelve your changelist on branchA (note the changelist #, we'll call it NUM for reference here)

  2. Create a branch mapping between branchA and branchB (we'll call it A_to_B)

  3. Run the following command:

    p4 unshelve -s NUM -b A_to_B
    

Tags:

Perforce