PUSH

Description

Pushes a branch to another repo.

Usage

cm push <src_br_spec> <dst_rep_spec> [--preview] [TranslateOptions] [--user=<usr_name> [--password=<pwd>] | AuthOptions]

(Direct server-to-server replication. Pushes a branch from a repository.)

cm push <src_br_spec> --package=<pack_file> [AuthOptions]

(Package based replication. Creates a replication package in the source server with the selected branch.)

Options

Option / ArgumentDescription
--previewGives information about what changes will be pushed, but no changes are actually performed. This option is useful to check the data that will be transferred before replicating changes.
--packageSpecifies path for exporting replication package for package based replication. Useful to move data between servers when there is no direct network connection.
--user, --passwordCredentials to use if the authentication mode is different in source and destination and there is not a profile to authenticate to destination.
src_br_specThe branch to push to a remote repository. (Use 'cm help objectspec' to learn more about branch specs.)
dst_rep_specThe destination repository. (Use 'cm help objectspec' to learn more about repository specs.)
TranslateOptionsSee the Translate options section for more information.
AuthOptionsSee the Authentication options section for more information.

Translate options

Mode

--trmode=(copy|name|table --trtable=<translation_table_file>)

The source and destination repositories may use different authentication modes. The '--trmode' option specifies how to translate the user names from the source to the destination. The '--trmode' must be one of the following values:

Option / ArgumentDescription
copy(Default). Means that the user identifiers will be just copied.
nameThe user identifiers will be matched by name.
tableUses a translation table specified in the option '--trtable' (see below).

Specifics if mode is set to "table"

--trtable=<translation_table_file>

If the translation mode is 'table', a translation table is a file containing lines in the form <oldname;newname> (one per line). When the branch is written to the destination repository, the objects created by a user identified by "oldname" in the source repository will be set to the user with "newname" on the destination.

Authentication options

Authentication data can be specified using one of the two following modes

  • Using authentication parameters.
  • Using an authentication file.

Using authentication parameters

--authmode=<mode> --authdata=<data>

Where --authmode can take one of the following values

  • NameWorkingMode
  • LDAPWorkingMode
  • ADWorkingMode
  • UPWorkingMode
Examples
Option / ArgumentDescription
(LDAPWorkingMode)--authdata=::0:dave:fPBea2rPsQaagEW3pKNveA
(UPWorkingMode)--authdata=dave:fPBea2rPsQaagEW3pKNveA==

The '--authdata' line is the content of the <SecurityConfig> entry in the client.conf file and the profiles.conf file. The profiles.conf file can be easily generated from the Unity VCS GUI in the replication profiles tab under Preferences.

If you are using UPWorkingMode, you can simply specify

--authmode=UPWorkingMode --user=<user> --password=<psw>

Using an authentication file

It's possible to have a different file for each server you connect to, with the credentials for that server and --authfile=<authentication_file> where the authentication_file must be formed by the following 2 lines:

  1. mode, as described in '--authmode'
  2. authentication data, as described in '--authdata'

Help

Remarks

The 'push' command is able to replicate branches (along with their changesets) between a source repository and a destination repository. The repositories can be located at different servers.

There are two replication operations: 'push' and 'pull'.

A 'push' operation means that the replication operation will send data from the source repository to the destination repository. In this case, the client will connect to the source repository, getting the data to replicate, and then it will send it to the destination repository. While the former (source) must have connectivity to the destination, the latter (destination) will not connect itself to the source.

In a typical distributed scenario, a developer pushes data from his local server to the main server. Also, the developer might want to pull the latest repository updates from the main server, too.

Replication can resolve situations where concurrent changes have been made on the same branch on two replicated repositories.

  • Push: If you try to push your data to a repository having newer changes than those you are sending, the system will ask you to pull the latest changes, resolve the merge operation and, finally, try to push again.
  • Pull: Whenever you pull changesets from a remote branch, they will be correctly linked to their parent changesets. If the changeset you pulled is not a child of the last changeset in the branch, then a multi-headed scenario will appear. The branch will have more than one 'head', or last changeset on the branch. You will need to merge the two 'heads' before being able to push again.

Push can work in two modes

  1. Direct communication between servers: The origin server will send the data to the destination server, automatically synchronizing data for the specified branch.
  2. Export package mode: The client will only connect to the source and generate a replication package obtaining both data and metadata for the specified branch. The '--package' modifier will be used.

Both modes require the user running the command to be authenticated by the server, either using the default authentication in the client.conf file, or specifiying the '--authmode' and '--authdata' modifiers.

The push replication works in a direct way. When executed, the command will replicate the selected branch from source to destination, instead of asking the destination repository to connect to the source and obtain the selected branch (as the pull does).

Examples

cm push br:/main@project1@myserver:8084 projectx@remoteserver:8084

(Replicates the 'main' branch from 'myserver' to 'remoteserver'. In this case, both servers are configured with the same authentication mode.)

cm push br:/main@project1@myserver:8084 projectx@remoteserver:8084 --authmode=LDAPWorkingMode --authdata=::0:dave:fPBea2rPsQaagEW3pKNveA

(Replicates same branch as before, but now the remote server is configured to authenticate users with Active Directory. For instance, I am connecting from a Linux machine to a Windows server configured to use Active Directory integrated mode. I will specify my Active Directory user and cyphered password and pass it as LDAP to the server.)

cm push br:/main@project1@myserver:8084 projectx@remoteserver:8084 --authmode=UPWorkingMode --user=dave --password=mysecret

(Replicates the same branch, but now users are authenticated on the remote server, taking advantage of the user/password database included in Unity VCS.)