function drush_pm_include_version_control

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

A simple factory function that tests for version control systems, in a user specified order, and returns 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/
Command callback. Download Drupal core or any project.
drush_pm_updatecode_rollback in commands/pm/
Rollback the update process.
pm_update_packages in commands/pm/
Update projects according to an array of releases and print the release notes for each project, following interactive confirmation from the user.
_pm_update_core in commands/pm/
Update drupal core, following interactive confirmation from the user.


commands/pm/, line 1628
The drush Project Manager


function drush_pm_include_version_control($directory = '.') {
  $engine_info = drush_get_engines('version_control');
  $version_controls = drush_get_option('version-control', FALSE);
  // If no version control was given, use a list of defaults.
  if (!$version_controls) {
    // Backup engine is the last option.
    $version_controls = array_reverse(array_keys($engine_info['engines']));
  else {
    $version_controls = array($version_controls);

  // 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($engine_info['engines'][$version_control])) {
      if (!empty($engine_info['engines'][$version_control]['signature'])) {
        drush_log(dt('Verifying signature for !vcs version control engine.', array('!vcs' => $version_control)), 'debug');
        if (drush_shell_exec($engine_info['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)));

  $instance = drush_include_engine('version_control', $engine);
  return $instance;