Populate the mainline stream
There are two ways to populate a mainline stream:
- Add files from the local file system. It does not preserve file history and is the most typical way.
- Branch from other depots. If you have existing non-stream classic depots and you need to preserve file history, use this way.
Add files
If you do not need to preserve file history, add the 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 reconcilecommand to detect files not under P4 Server control and open them for add by using the p4 add command.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, run the
p4 opened command.
To populate the stream, submit the changelist in which the files are open.
For details on working with changelists, see Work with changelists.
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,
P4 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, run 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, run the following commands:
- To verify that the files are set up to be added correctly, run the
p4 openedcommand. - To populate the stream,
p4 submitthe 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.
p4 populate -n, and, if the result is what you want, use p4 populate without the -n preview.
To undo an erroneous copy operation, run the p4 revert command. For example:
p4 revert //ProjectX/main/...