Same file in multiple changelists in perforce

前端 未结 6 1709
野趣味
野趣味 2021-01-04 03:17

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

相关标签:
6条回答
  • 2021-01-04 03:24

    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 讨论(0)
  • 2021-01-04 03:31

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

    0 讨论(0)
  • 2021-01-04 03:33

    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:

    • http://blog.perforce.com/blog/?p=1872
    • http://www.perforce.com/perforce/doc.current/manuals/cmdref/shelve.html
    0 讨论(0)
  • 2021-01-04 03:34

    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.

    0 讨论(0)
  • 2021-01-04 03:48

    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.

    0 讨论(0)
  • 2021-01-04 03:51

    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 讨论(0)
提交回复
热议问题