views:

231

answers:

5

Is there any way to have the same file be a part of multiples changelists in perforce? With that I mean that from the set of changed lines in the file one subset will belong to a changelist, while the other subset will belong to a second changelist.

Bonus question: If perforce does not support this, then which Source Control Systems, if any, do?

+3  A: 

The same copy of the file? No, unfortunately this isn't possible.

marcc
Yeah, thought so... Perforce's most granular unit is a file. I wish it was a line...
David Reis
Best option is to branch the file and then integrate the branches later...
marcc
As marcc says, the way to do this is by branching. If you think about it, that is really what you are doing - isolating changes in the same file to apply to different features/changes.
Greg Whitfield
+2  A: 

You could make a copy of the file with all of the changes, revert, edit the file copy one set of changes into the file, submit, edit, copy the next set of changes, submit, edit, etc...

Mark Thalman
+1  A: 

To answer the bonus question: GIT allows for per-line changelists.

For a comparison between the two view this question: GIT vs. Perforce- Two VCS will enter... one will leave.

Dennis Roche
A: 

Another way to do this without branching is create additional workspaces (clients). Unless you really know what you're doing, be sure to set a different root directory in each of your workspaces. To save time (and disk), don't bother syncing the whole depot in the new workspace.

Sometimes, I'll have two copies of a depot (using two workspaces); one which contains work-in-progress and one which I keep unmodified. If I need to make a quickie change on a file that's heavily modified in my WIP workspace, I can use the 'virgin' workspace to make the change and submit it.

Heath
A: 

If you are using p4 server 2009.2, there is a workaround to do it. You can shelve a particular file and the diff is stored on the server. After shelving you may want to revert the file to its original version and then work it on in another change-list. I know this is not a way you wanted it but it is quite easy to create another workspace/client and then sync the code. The later exercise becomes more tedious when you have volumes of code that goes into another application.

For more info read:

Atul