public function drush_pm_version_control_bzr::pre_update

3.x public drush_pm_version_control_bzr::pre_update(&$project, $items_to_test = array())
4.x public drush_pm_version_control_bzr::pre_update(&$project, $items_to_test = array())

Implementation of pre_update().

Check that the project or drupal core directory looks clean

Overrides drush_pm_version_control::pre_update


commands/pm/version_control/, line 14
Drush pm Bazaar extension




public function pre_update(&$project, $items_to_test = array()) {
  // Bazaar needs a list of items to test within the given project.
  // If $items_to_test is empty we need to force it to test the project
  // directory itself --once we've cd'ed to it.
  if (empty($items_to_test)) {
    $items_to_test = array('.' => '.');
  $args = array_keys($items_to_test);
  array_unshift($args, 'bzr status --short' . str_repeat(' %s', count($args)));
  array_unshift($args, $project['full_project_path']);
  if (call_user_func_array('drush_shell_cd_and_exec', $args)) {
    $output = preg_grep('/^[\sRCP][\sNDKM][\s\*]/', drush_shell_exec_output());
    if (!empty($output)) {
      return drush_set_error('DRUSH_PM_BZR_LOCAL_CHANGES', dt("The Bazaar working copy at !path appears to have uncommitted changes (see below). Please commit or revert these changes before continuing:\n!output", array('!path' => $project['full_project_path'], '!output' => implode("\n", $output))));
  else {
    return drush_set_error('DRUSH_PM_BZR_NOT_FOUND', dt("Drush was unable to get the bzr status on !path. Check that you have Bazaar \ninstalled and that this directory is a Bazaar working copy.\nThe specific errors are below:\n!errors", array('!path' => $project['full_project_path'], '!errors' => implode("\n", drush_shell_exec_output()))));
  return TRUE;