function _drush_cm_copy_remote_configuration_via_rsync

7.x _drush_cm_copy_remote_configuration_via_rsync(&$merge_info)
1 call to _drush_cm_copy_remote_configuration_via_rsync()


commands/core/, line 932
Provides Configuration Management commands.


function _drush_cm_copy_remote_configuration_via_rsync(&$merge_info) {
  $configuration_path = _drush_cm_get_configuration_path($merge_info);
  $remote_configuration_path = _drush_cm_get_remote_configuration_path($merge_info);
  // Create a new temporary branch to hold the configuration changes
  // from the site 'live-config'.  The last parameter is the 'start point',
  // which is like checking out the specified sha-hash before creating the
  // branch.
  if ($merge_info['autodelete-live-config']) {
    $result = drush_shell_cd_and_exec($configuration_path, 'git checkout -B %s %s', $merge_info['live-config'], $merge_info['base']);
    if (!$result) {
      return drush_set_error('DRUSH_CONFIG_MERGE_FAILURE', dt("Could not create temporary branch !b", array('!b' => $merge_info['live-config'])));
  else {
    $result = drush_shell_cd_and_exec($configuration_path, 'git checkout -b %s', $merge_info['live-config']);
  // We set the upstream branch as a service for the user, to help with
  // cleanup should this process end before completion.  We skip this if
  // the branch already existed (i.e. with --branch option).
  if ($result) {
    drush_shell_cd_and_exec($configuration_path, 'git branch --set-upstream-to=%s', $merge_info['original-branch']);
  // Copy the exported configuration files from 'live-site' via rsync and commit them
  $values = drush_invoke_process($merge_info['dev-site'], 'core-rsync', array($merge_info['live-site'] . ":$remote_configuration_path/", $merge_info['dev-site'] . ":$configuration_path/"), $merge_info['rsync_options']);
  if ($values['error_status']) {
    return drush_set_error('DRUSH_CONFIG_MERGE_RSYNC_FAILED', dt("Could not rsync from !live to !dev.", array('!live' => $merge_info['live-config'], '!dev' => $merge_info['dev-config'])));

  // Commit the new changes to the branch prepared for @live. Exit with
  // "nothing to do" if there are no changes to be committed.
  $result = drush_shell_cd_and_exec($configuration_path, 'git status --porcelain .');
  if (!$result) {
    return drush_set_error('DRUSH_CONFIG_MERGE_FAILURE', dt("`git status` failed."));
  $merge_info['changed_configuration_files'] = drush_shell_exec_output();
  $merge_info['commit_needed'] = TRUE;