p4 integrate
p4 integrate can be abbreviated as p4
	  integ.
Syntax
p4 [g-opts] integrate [options] fromFileSpec[revRange] toFile
p4 [g-opts] integrate [options] -b branch [-r] [toFileSpec[RevRange] ...]
p4 [g-opts] integrate [options] -b branch -s fromFileSpec[revRange] [toFile ...]
p4 [g-opts] integrate [options] -S stream [-r] [-P parent] [file[revRange] ...]
For [options], you can use:
-c changelist -Di -f -h -K -O[b][r] -n -m max -R[b][d][s] -q -v
For streams, you can use:
p4 integrate -S stream [-As | -Af]
Description
When you’ve made changes to a file that need to be propagated to another
      file, start the process with p4 integrate. The
      command includes four syntax variants, depending on whether the source
      and target files are specified using files, branches, or streams.
The simplest syntax variant is p4 integrate fromFile toFile, which lets the versioning service know that
      changes in fromFile need to be propagated to
      toFile, and has the following effects:
- If toFiledoes not yet exist,fromFileis copied totoFile, thentoFileis opened forbranchin the client workspace.
- 
                                                    If toFileexists, and shares a common ancestor withfromfileas above, thentoFileis opened forintegrate. You can then usep4 resolveto propagate all of, portions of, or none of the changes infromFiletotoFile.The p4 resolvecommand usesfromFileastheirs,toFileasyours, and the file with the most edits in common as the base.
- If fromFilewas deleted at its last revision (and all previous changes have already been integrated betweenfromFileandtoFile),toFileis opened fordeletein the client workspace.
- Whether you move files using p4 move, or whether you use native OS commands to rename files within your workspace (usingp4 reconcileorp4 statusto update your changelist to reflect the moves you made),p4 integrateautomatically detects these actions, adjusts the source-to-target mappings appropriately, and schedules a filename resolve for each remapped file pair.
Some of the Options modify this behavior.
The process is complete when you p4
	    submit toFile to the depot.
To specify multiple files, use wildcards in fromFile
      and toFile. Any wildcards used in
      fromFile must match identical wildcards in
      toFile.
      P4 Server
      compares the fromFile pattern to the
      toFile pattern, creates a list of
      fromFile and toFile pairs, and
      performs an integration on each pair.
The syntax p4 integrate fromFiles toFiles requires you to specify the mapping between
      fromFiles and toFiles each time
      changes need to be propagated from fromFiles to
      toFiles. Alternatively, use p4 branch to store the
      mappings between fromFiles and
      toFiles in a branch view, and
      then use p4 integrate -b branchview whenever
      you need to propagate changes between fromFiles and
      toFiles.
By default, files that have been opened for branch or
      integrate with p4 integrate are
      read-only in the client workspace. You can edit these files before
      submitting them using p4
	    edit to reopen the file for edit.
Whenever a toFile is integrated from a
      fromFile,
      P4 Server
      creates an integration record in its database that describes the
      effect of the integration. The integration record includes the names of
      the fromFile, and toFile, the
      revisions of fromFile that were integrated into
      toFile, the new revision number for
      toFile, and the action that was taken at the time of
      the integration. See p4
	    integrated for a full description of integration
      actions.
In most cases, p4 integrate performs a lazy copy A method used by P4 Server to make internal copies of files without duplicating file content in the depot. A lazy copy points to the original versioned file (depot file). Lazy copies minimize the consumption of disk space by storing references to the original file instead of making additional copies of the file.. The contents of the file are not duplicated to multiple locations on the server because the
      integration record contains sufficient information to reproduce the file.
Alternatives to p4 integrate
                                            - p4 populate to quickly branch files without opening them in a workspace
- p4 copy to open files to be copied without
	scheduling any resolves. Consider whether the -voption ofp4 copyis appropriate for your use case.
- p4 merge to open files to be merged and schedule resolves for all changes
Options
Basic Integration Options
| 
 | Integrate the files using the
	       If a revision range is supplied with
	       | 
| 
 | fromFiles are called the source
		files;  Any  | 
| 
 | Display the integrations this command would perform without actually performing them. | 
| 
 | Performs a "virtual" integration that does not modify client workspace files unless target files need to be resolved. After submitting a "virtual integration", p4 sync can be used to update the workspace. | 
| 
 | Open the  If this option is not provided, the files are opened in the default changelist. | 
| 
 | Quiet mode, which suppresses normal output messages about the list of files being integrated, copied, or merged. Messages regarding errors or exceptional conditions are displayed. | 
| 
 | See Global options. | 
Advanced Integration Options
| 
 | In its simplest form,  In its more complicated form, when both
	       
 This variation of  | 
| 
 | Reverse the mappings in the branch view, integrating from the target files to the source files. | 
| 
 | The  | 
| 
 | Force the integration on all revisions of
	       | 
| 
 | Don’t automatically sync target files to the head revision before integrating. Use the have revision instead. | 
| -K | Suppress keyword expansion
        when updating +ktype files on the client. See File type modifiers. | 
| 
 | Limit the command to integrating only the first
	       | 
| 
 | The  | 
| 
 | The  | 
| 
 | The  | 
| 
 | The  | 
| 
 | The  | 
| 
 | Integrates a stream to its parent. To reverse the direction of the mapping, use the  To override the configured parent and integrate to a different
	      target stream, specify  To submit integrated stream files, the current client must be switched to the target stream or to a virtual child stream of the target stream. Integrates both the files and the stream spec unless you use  | 
Usage notes
| Can File Arguments Use Revision Specifier? | Can File Arguments Use Revision Range? | Minimal Access Level Required | 
|---|---|---|
| Yes | Yes | 
 | 
Examples
| 
 | Branch or merge all files in  If there is no corresponding file in  | 
| 
 | Branch or merge all  | 
| 
 | Branch or merge those  | 
| 
 | Branch or merge  | 
| p4 integ -r -As -S //str/dev3 | Perform a stream spec integration onto //str/dev3 from its parent stream. This might be useful if //str/dev3 has a ParentView of noinherit and otherwise would not be affected by its parent stream. | 
Related commands
| Create or edit a branch mapping | |
| View a list of existing branch mappings | |
| Branch a set of files as a one-step operation | |
| View a list of integrations that have already been performed and submitted | |
| Propagate changes from one file to another after opening
	      files with  | |
| View a history of all integrations performed on a particular file |