views:

653

answers:

5

We were working on a design, and for that we created the skeleton of the classes in our main branch. Now, we are starting to code, and for that we got a new branch. So, it would be nice if I can move all the new files in the main branch into the new branch. However, I cannot check them in yet. So, is it possible to integrate the checked out changelist? Thanks.

A: 

I never found a way to do that within perforce, but you can at least partially automate it.

Usually when I had to do something like that I'd check out the files in the branch I want to move things to, then use WinMerge to diff the branches and copy the changes over. Once that's done you can revert the changes in the original branch and check them in in the new branch.

It's not the best solution (no automatic checkout/add/delete of files on the new branch), but was the fastest method I came up with.

Herms
A: 

The easy answer is - no you can't. A quick perusal of the Perforce docs didn't come up with a ready cite for this, unfortunately, but in my experience any attempt to pull the rug out from under the Perforce server will result in your changes being lost which will leave you an unhappy camper.

Make a back up, create a new work area on the new branch, and re-apply your changes, perhaps using the diff/merge strategy outlined in Herms answer.

feoh
See link above on branching work in progress.
Greg Whitfield
A: 

Not really.

You can of course simply open the files for edit in the new branch, and manually copy the changed files from the workspace of your main branch to the new branch's workspace. This is probably the easiest way if it just a few files.

Here are a few scripts that can be handy if a larger number of files are involved. E.g., with the P4Shelf script you can create an archive of all your changed files, and later automatically open them in any branch with the changes restored.

Also, check out some other nifty scripts for Perforce by Jim Tilander.

clayless
+7  A: 

The Perforce support web site explains how to do this: Perforce Knowledge Base: Branching work in progress. It would be nicer if it was a single step that didn't require running eight different commands.

bk1e
This is the right answer - done it loads myself and is very easy.
Greg Whitfield
A: 

From p4win, you can do things like drag all the files in an open changelist into an open winzip window. Then you can extract the winzip archive wherever you want.

Epu