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:
- Integrate (and resolve) the related files from ProjectB to ProjectA while the edited but non-submitted files are there.
- Check-out the related files in ProjectB.
- Manually copy the related files from ProjectA to ProjectB.
- Revert files in ProjectA.
Hack-ish solution:
- Check out the files in project B
- Manually copy files from project A to project B (they're not write-protected due to step 1)
- Shelve changelist in project A
- Submit to B
- Integrate files from B to A and resolve
- Unshelve files from step 3. Resolve as needed accepting yours.
- 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:
Shelve your changelist on branchA (note the changelist #, we'll call it NUM for reference here)
Create a branch mapping between branchA and branchB (we'll call it A_to_B)
Run the following command:
p4 unshelve -s NUM -b A_to_B