function _drush_cm_copy_remote_configuration_via_git

7.x config.drush.inc _drush_cm_copy_remote_configuration_via_git(&$merge_info)
1 call to _drush_cm_copy_remote_configuration_via_git()

File

commands/core/config.drush.inc, line 911
Provides Configuration Management commands.

Code

function _drush_cm_copy_remote_configuration_via_git(&$merge_info) {
  $configuration_path = _drush_cm_get_configuration_path($merge_info);
  // If the config-export command worked, and exported changes, then this should
  // pull down the appropriate commit, which should change files in $configuration_path
  // (and nowhere else).
  $result = drush_shell_cd_and_exec($configuration_path, 'git pull %s %s', $merge_info['remote'], $merge_info['live-config']);
  if (!$result) {
    return drush_set_error('DRUSH_CONFIG_EXPORT_FAILURE', dt("`git pull` failed.  Output:\n\n!output", array('!output' => implode("\n", drush_shell_exec_output()))));
  }
  $result = drush_shell_cd_and_exec($configuration_path, 'git checkout %s', $merge_info['live-config']);
  if (!$result) {
    return drush_set_error('DRUSH_CONFIG_MERGE_FAILURE', dt("Could not switch to working branch !b", array('!b' => $merge_info['live-config'])));
  }
  // Let's check to see if anything changed in the branch we just pulled over.
  $result = drush_shell_cd_and_exec($configuration_path, 'git diff-tree --no-commit-id --name-only -r HEAD %s .', $merge_info['original_hash']);
  if (!$result) {
    return drush_set_error('DRUSH_CONFIG_EXPORT_FAILURE', dt("`git diff-tree` failed."));
  }
  $merge_info['changed_configuration_files'] = drush_shell_exec_output();
}