p4 integrate
Synopsis
Open files for branching or merging.
Syntax
p4 [g-opts
] integrate [options
] fromFile
[revRange
] toFile
p4 [g-opts
] integrate [options
] -b branch
[-r] [toFile
[RevRange
]...]
p4 [g-opts
] integrate [options
] -b branch
-s fromFile
[revRange
] [toFile
...]
p4 [g-opts
] integrate [options
] -S stream
[-r] [-P parent
] fromFile
[revRange
]
options: -c
changelist
-Di -f -h -Ooptions
-n -m max
-Roptions
-q -v
Description
When you've made changes to a file that need to be propagated to another
file, start the process with p4 integrate. The simplest
form of this command is p4 integrate
fromFile
toFile
;
this lets the versioning service know that changes in
fromFile
need to be propagated to
toFile
, and has the following effects:
-
If
toFile
doesn't yet exist,fromFile
is copied totoFile
, thentoFile
is opened forbranch
in the client workspace. -
If
toFile
exists, and shares a common ancestor withfromfile
as above, thentoFile
is opened forintegrate
. You can then use p4 resolve to propagate all of, portions of, or none of the changes infromFile
totoFile
.The p4 resolve command uses
fromFile
astheirs
,toFile
asyours
, and (if the resolve was scheduled with p4 integrate, the closest common ancestor offromFile
asbase
, or (if the resolve was scheduled with p4 merge) the file with the most edits in common. -
If both
toFile
andfromFile
exist, buttoFile
shares no common ancestor withfromFile
, the integration is rejected. -
If
fromFile
was deleted at its last revision (and all previous changes have already been integrated betweenfromFile
andtoFile
),toFile
is opened fordelete
in the client workspace. -
Whether you move files using p4 move, or whether you use native OS commands to rename files within your workspace (using p4 reconcile or p4 status to update your changelist to reflect the moves you made), p4 integrate automatically detects these actions, adjusts the source-to-target mappings appropriately, and schedules a filename resolve for each remapped file pair.
(Some of the available options modify this behavior. See the Options section for details.)
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
. Perforce
compares the fromFile
pattern to the
toFile
pattern, creates a list of
fromFile
/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
.
In most cases, you can use the p4 merge and p4 copy commands to propagate changes between streams (or branches). When p4 integrate schedules files for resolve, it selects the closest common ancestor as the base, and p4 merge selects (as the base) the revision with the most edits in common with the source and target.
Options
Because some of the integration options add complexity to the integration process, we've divided the options into Basic Integration Options and Advanced Integration Options.
Basic Integration Options
|
Integrate the files using the
If a revision range is supplied with
|
|
Display the integrations this command would perform without actually performing them. |
|
Open files for branching without copying
Without this option, p4 integrate copies
newly-branched |
|
Open the If this option is not provided, the files are opened in the default changelist. |
|
Quiet mode; suppresses normal output messages about the list of files being integrated, copied, or merged. Messages regarding errors or exceptional conditions are displayed. |
|
See the “Global Options” section. |
Advanced Integration Options
|
In its simplest form, p4 integrate -b
In its more complicated form, when both
This variation of p4 integrate was written to provide some needed functionality to graphical Perforce applications; it is unlikely that you'll need to use this more complex form. |
|
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. |
|
Limit the command to integrating only the first
|
|
The |
|
The |
|
The |
|
The |
|
The |
|
Integrates a stream to its parent. To override the configured
parent and integrate to a different target stream, specify
|
Usage Notes
Can File Arguments Use Revision Specifier? |
Can File Arguments Use Revision Range? |
Minimal Access Level Required |
---|---|---|
Yes |
Yes |
|
-
p4 integrate can be abbreviated as p4 integ.
-
FromFiles
are often called source files, andtoFiles
are often called target files. -
Any
toFiles
that p4 integrate needs to operate on must be included in the p4 client view. -
By default, files that have been opened for
branch
orintegrate
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 foredit
. -
Whenever a
toFile
is integrated from afromFile
, Perforce creates an integration record in its database that describes the effect of the integration. The integration record includes the names of thefromFile
, andtoFile
, the revisions offromFile
that were integrated intotoFile
, the new revision number fortoFile
, 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; the contents of the file are not duplicated on the server, because the integration record contains sufficient information to reproduce the file. Integrations performed on temporary object files (
+S
and+S
) do not produce a lazy copy; the integratedn
tempobj
file consumes additional diskspace on the server. -
Two integration engines are supported in the 2013.2 release.
The current integration engine (v3) provides improved base selection semantics and expanded resolve capability, and has been improved since its introduction in 2011. As of release 2013.2, the v3 engine is the default integration for Perforce.
The old integration engine (v2) was introduced in 2006.1 and is still supported for backwards compatibility.
New installations of Perforce do not need to make any changes in order to take advantage of the new integration engine. Sites that wish to continue using the old (2006.1) integration logic must, as of release 2013.2, manually set the
dm.integ.engine
configurable to 2, instead of its default value of 3:p4 configure set dm.integ.engine=2
For further information, see the Perforce Knowledge Base:
http://answers.perforce.com/articles/KB_Article/Generation-3-Integration-Engine
Examples
p4 integ //depot/dev/... //depot/rel2/... |
Branch or merge all files in
If there is no corresponding file in
|
p4 integ -b rel2br |
Branch or merge all |
p4 integ -b rel2br //depot/rel2/headers/... |
Branch or merge those |
p4 integ -b rel2br -r //depot/rel2/README |
Branch or merge |