function drush_pm_include_version_control

8.0.x pm.drush.inc drush_pm_include_version_control($directory = '.')
6.x pm.drush.inc drush_pm_include_version_control($directory = '.')
7.x pm.drush.inc drush_pm_include_version_control($directory = '.')
3.x pm.drush.inc drush_pm_include_version_control($directory = '.')
4.x pm.drush.inc drush_pm_include_version_control($directory = '.')
5.x pm.drush.inc drush_pm_include_version_control($directory = '.')
master pm.drush.inc drush_pm_include_version_control($directory = '.')

A simple factory function that tests for version control systems, in a user specified order, and return the one that appears to be appropriate for a specific directory.

4 calls to drush_pm_include_version_control()
drush_pm_download in commands/pm/pm.drush.inc
Command callback. Download Drupal core or any project.
drush_pm_updatecode_rollback in commands/pm/updatecode.pm.inc
pm_update_packages in commands/pm/updatecode.pm.inc
Update packages according to an array of releases, following interactive confirmation from the user.
_pm_update_core in commands/pm/updatecode.pm.inc
Update drupal core, following interactive confirmation from the user.

File

commands/pm/pm.drush.inc, line 1260
The drush Package Manager

Code

function drush_pm_include_version_control($directory = '.') {
  $version_controls = explode(',', drush_get_option('version-control', 'svn,backup'));
  $version_control_engines = drush_get_engines('version_control');

  // Find the first valid engine in the list, checking signatures if needed.
  $engine = FALSE;
  while (!$engine && count($version_controls)) {
    $version_control = array_shift($version_controls);
    if (isset($version_control_engines[$version_control])) {
      if (!empty($version_control_engines[$version_control]['signature'])) {
        if (drush_shell_exec($version_control_engines[$version_control]['signature'], $directory)) {
          $engine = $version_control;
        }
      }
      else {
        $engine = $version_control;
      }
    }
  }
  if (!$engine) {
    return drush_set_error('DRUSH_PM_NO_VERSION_CONTROL', dt('No valid version control or backup engine found (the --version-control option was set to "!version-control").', array('!version-control' => $version_control)));
  }
  if (!drush_include_engine('version_control', $engine)) {
    return FALSE;
  }
  $engine = 'drush_pm_version_control_' . $engine;
  return new $engine();
}