18

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?

6 Answers 6

9

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.

8

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

2
  • 3
    Yeah, thought so... Perforce's most granular unit is a file. I wish it was a line...
    – David Reis
    Commented Jul 2, 2009 at 17:52
  • 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. Commented Jul 6, 2009 at 12:56
8

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.

0
7

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:

1
  • Neither page loads
    – Gandalf458
    Commented Jan 18, 2019 at 19:50
3

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...

0

Bonus answer: I found this feature in Rational Team Concert (http://www-03.ibm.com/software/products/en/rtc/). You can have the same file in many changesets. If you want to add File1 to Changeset1 and Changeset2, you must complete Changeset1 first. This allows you to add File 2 to Changeset2 but then a dependency between changesets is created, so you can not deliver Changeset2 without delivering Changeset1 too. Moreover you can not make changes to a complete changeset.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.