Commit 19ee3e12 authored by Marco Villegas's avatar Marco Villegas
Browse files

Return an error when drush vc-sync fails.

parent 2f5fbae3
Loading
Loading
Loading
Loading
+7 −2
Changes for versioncontrol.drush.inc: 7 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -211,11 +211,16 @@ function _drush_versioncontrol_vcapi_sync_repositories($repo_id, $flush) {
  $repository = versioncontrol_repository_load($repo_id);
  try {
    drush_log(dt('Beginning synchronization of repository !name', array('!name' => $repository->name)), 'ok');
    $flush ? $repository->reSyncFromScratch() : $repository->sync();
    // FIXME this often echoes success even if it didn't work
    $sync_status = $flush ? $repository->reSyncFromScratch() : $repository->sync();
    if ($sync_status) {
      drush_log(dt('Successfully synchronized repository !name', array('!name' => $repository->name)), 'success');
    }
    else {
      drush_log(dt('There was an error during the synchronization, review the sync log table for details.'), 'error');
    }
  }
  catch (Exception $e) {
    // @todo is there a way to end up here? reSyncFromScratch() and sync() should handle the exceptions IIRC.
    drush_set_error('Exception while synchronizing', dt('An error occurred while performing history synchronziation on repository !name. Error info: ' . $e->__toString()), array('!name' => $repository->name));
    // There'll be a stale lock on the repository now, so clear it.
    $repository->updateLock(0);