Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I integrate checked out files into a different branch on perforce

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.

like image 535
user38703 Avatar asked Nov 18 '08 21:11

user38703


People also ask

What does checkout mean in Perforce?

Check-out ( p4 edit ) is about getting the latest version from the depot for editing. When files are checked out for edit, their permissions are set to read-write. When files are not checked out, Perforce sets them to read-only.

What is branch mapping in Perforce?

The branch mapping is used by the integration process to create and update branches., which specifies the relationship between two codelines. When you branch, you can use the branch mapping instead of a file mapping. Branch mappings are displayed in the right pane on the Branch Mapping tab.

How do you integrate with P4V?

To integrate files, you open them for integration, specifying source and target, then submit the changelist containing the open files. P4V performs three types of integration: Branching, which creates a new codeline or branch. For more information, see Creating Branches.


2 Answers

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.

like image 53
bk1e Avatar answered Oct 08 '22 03:10

bk1e


Since release 2013.1, the way to branch work in progress is to shelve the work and unshelve it on the branch. In detail:

  1. Shelve your outstanding changes:

    $ p4 shelve ...
    Change 182535 created with 10 open file(s).
    Shelving files for change 182535.
    edit //info.ravenbrook.com/project/mps/master/code/arenavm.c#26
    # etc.
    
  2. Unshelve them on the branch (using the -b option, which maps the file name through a branch specification):

    $ p4 unshelve -b mps/branch/2013-06-05/diag -s 182535
    ... //info.ravenbrook.com/project/mps/branch/2013-06-05/diag/code/arenavm.c - must resolve //info.ravenbrook.com/project/mps/master/code/arenavm.c@=182535 before submitting
    # etc.
    
  3. Resolve any merges resulting from the unshelve, using p4 resolve -as to quickly do the "safe" ones, and then doing the rest with p4 resolve as usual.

    $ p4 resolve -as
    //gdr-peewit/info.ravenbrook.com/project/mps/branch/2013-06-05/diag/code/arenavm.c - copy from //info.ravenbrook.com/project/mps/master/code/arenavm.c
    # etc.
    $ p4 resolve
    No file(s) to resolve.
    

(The example output is from a real use case I ran just now.)

like image 39
Gareth Rees Avatar answered Oct 08 '22 01:10

Gareth Rees