private function drush_version_control_svn::sync

8.0.x svn.inc private drush_version_control_svn::sync($project)
6.x svn.inc private drush_version_control_svn::sync($project)
7.x svn.inc private drush_version_control_svn::sync($project)
5.x svn.inc private drush_version_control_svn::sync($project)
master svn.inc private drush_version_control_svn::sync($project)

Automatically add any unversioned files to Subversion and remove any files that have been deleted on the file system

2 calls to drush_version_control_svn::sync()
drush_version_control_svn::post_download in commands/pm/version_control/svn.inc
Implementation of post_download().
drush_version_control_svn::post_update in commands/pm/version_control/svn.inc
Implementation of post_update().

File

commands/pm/version_control/svn.inc, line 84
Drush pm SVN extension

Class

drush_version_control_svn

Code

private function sync($project) {
  if (drush_get_option('svnsync')) {
    $errors = '';
    if (drush_shell_exec('svn status ' . drush_get_option('svnstatusparams') . ' ' . $project['full_project_path'])) {
      $output = drush_shell_exec_output();
      foreach ($output as $line) {
        if (preg_match('/^\? *(.*)/', $line, $matches)) {
          if (!drush_shell_exec('svn add ' . drush_get_option('svnaddparams') . ' ' . $matches[1])) {
            $errors .= implode("\n", drush_shell_exec_output());
          }
        }
        if (preg_match('/^\! *(.*)/', $line, $matches)) {
          if (!drush_shell_exec('svn remove ' . drush_get_option('svnremoveparams') . ' ' . $matches[1])) {
            $errors .= implode("\n", drush_shell_exec_output());
          }
        }
      }
      if (!empty($errors)) {
        return drush_set_error('DRUSH_PM_SVN_SYNC_PROBLEMS', dt("Problems were encountered adding or removing files to/from this SVN working copy.\nThe specific errors are below:\n!errors", array('!errors' => $errors)));
      }
    }
    else {
      return drush_set_error('DRUSH_PM_SVN_NOT_FOUND', dt("Drush was unable to get the svn status on !path. Check that you have Subversion \ninstalled and that this directory is a subversion working copy.\nThe specific errors are below:\n!errors", array('!path' => $project['full_project_path'], '!errors' => implode("\n", drush_shell_exec_output()))));
    }
    return TRUE;
  }
}