Populate the mainline stream
Classic users populate a branch. See Codeline management.
There are two ways to populate a mainline stream:
- Add files from the local filesystem. This is the most typical way.
- Branch files from another depot. This way only applies if you have existing "classic" Helix server depots.
If you need to preserve file history, branch the source files to the mainline stream. If you have no requirement for preserving file history, simply add them. The sections that follow describe each approach.
Add files
If you do not need to preserve file history, simply add the files. To add files to the mainline stream:
-
Create the workspace root directory if it does not exist.
For example:
C:\bruno_ws> cd C:\Users\bruno\p4clients C:\Users\bruno\p4clients> mkdir bruno_projectX_main
- Copy the files and folders to the workspace root directory.
-
Change into the client workspace root directory, and use the
p4 reconcile
command to detect files not under Helix server control and open them for add.C:\Users\bruno\p4clients> cd bruno_projectX_main C:\Users\bruno\p4clients\bruno_projectX_main> p4 add ...
To verify that the files are set up to be added correctly, issue the
p4 opened
command. To populate the stream, submit the
changelist in which the files are open.
For details on working with changelists, see Changelist-related tasks.
Branch from other depots
You can branch files from other stream depots, classic depots, or remote
depots into a stream. If you populate the mainline by branching,
Helix server
preserves the connection between the revision history of the source and
target files. Your workspace must be set to one associated with the
target stream (example: p4 set
P4CLIENT=bruno_projectX_main
).
To populate the mainline by branching, issue the p4
copy
command, specifying source and target. Example:
$ p4 copy -v //mysourcedepot/mainline/... //ProjectX/main/...
In this example the -v
option performs the copy on the
server without syncing the newly-created files to the workspace. This can
be a significant time-saver if there are many files being copied; you can
then sync only the files you intend to work with from the new
location.
p4d displays a series of “import from” messages
listing the source and target files, and opens the file(s) in a pending
changelist. To preview the results of the operation without opening
files, specify the -n
option.
To populate the stream with the files from the mainline, issue the following commands:
- To verify that the files are set up to be added correctly, issue the
p4 opened
command. - To populate the stream,
p4 submit
the changelist in which the files are open.
If you are populating an empty stream, you can simplify this process by
using p4 populate
. For example:
$ p4 populate //mysourcedepot/mainline/... //ProjectX/main/...
does the same thing as p4 copy -v
followed by a
p4 submit
. If you are unsure of the results of
p4 populate
, use p4 populate -n
,
which previews the result of the command.
To undo an erroneous copy operation, issue the p4
revert
command; for example:
$ p4 revert //ProjectX/main/...