Index: commands/core/core.drush.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drush/commands/core/core.drush.inc,v
retrieving revision 1.145
diff -u -p -r1.145 core.drush.inc
--- commands/core/core.drush.inc	22 Dec 2010 21:28:35 -0000	1.145
+++ commands/core/core.drush.inc	23 Dec 2010 21:08:28 -0000
@@ -238,7 +238,7 @@ function core_drush_engine_drupal() {
  */
 function drush_core_updatedb() {
   if (drush_get_context('DRUSH_SIMULATE')) {
-    return drush_set_error(dt('updatedb command does not support --simulate option.'));
+    return drush_set_error('DRUSH_SIMULATE_UNSUPPORTED', dt('updatedb command does not support --simulate option.'));
   }
 
   drush_include_engine('drupal', 'update', drush_drupal_major_version());
@@ -348,7 +348,7 @@ function drush_core_help() {
     return $result;
   }
 
-  drush_set_error('DRUSH_COMMAND_NOT_FOUND', dt('Invalid command !command.', array('!command' => implode(" ", $commands))));
+  return drush_set_error('DRUSH_COMMAND_NOT_FOUND', dt('Invalid command !command.', array('!command' => implode(" ", $commands))));
 }
 
 
@@ -601,7 +601,7 @@ function drush_core_cron() {
     drush_log(dt('Cron run successfully.'), 'success');
   }
   else {
-    drush_set_error('DRUSH_CRON_FAILED', dt('Cron run failed.'));
+    return drush_set_error('DRUSH_CRON_FAILED', dt('Cron run failed.'));
   }
 }
 
@@ -708,7 +708,7 @@ function drush_core_php_script() {
         $all[] = $script_filename;
       }
       if (!$found) {
-        return drush_set_error('Script not found.', dt('Unable to find any of the following: @files', array('@files' => implode(', ', $all))));
+        return drush_set_error('DRUSH_TARGET_NOT_FOUND.', dt('Unable to find any of the following: @files', array('@files' => implode(', ', $all))));
       }
     }
   }
@@ -833,7 +833,7 @@ function drush_core_drupal_directory($ta
     drush_print($path);
   }
   else {
-    return drush_set_error(dt("Target '!target' not found.", array('!target' => $target)));
+    return drush_set_error('DRUSH_TARGET_NOT_FOUND', dt("Target '!target' not found.", array('!target' => $target)));
   }
 
   return TRUE;
@@ -866,10 +866,10 @@ function drush_core_find_project_path($t
 function drush_core_cli() {
   // Do not allow cli to start recursively, or from backend invoke.
   if (drush_get_option('in-cli', FALSE)) {
-    return drush_set_error(dt('Already in drush core-cli; press control-d to exit.'));
+    return drush_set_error('DRUSH_CLI_NOT_REENTRANT', dt('Already in drush core-cli; press control-d to exit.'));
   }
   if (drush_get_context('DRUSH_BACKEND')) {
-    return drush_set_error(dt('Cannot run drush core-cli from non-interactive mode; aborting.'));
+    return drush_set_error('DRUSH_CLI_INTERACTIVE_ERROR', dt('Cannot run drush core-cli from non-interactive mode; aborting.'));
   }
 
   // Make sure that we call drush the same way that we were called.
Index: commands/pm/pm.drush.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drush/commands/pm/pm.drush.inc,v
retrieving revision 1.179
diff -u -p -r1.179 pm.drush.inc
--- commands/pm/pm.drush.inc	22 Dec 2010 23:13:10 -0000	1.179
+++ commands/pm/pm.drush.inc	23 Dec 2010 21:08:29 -0000
@@ -544,7 +544,7 @@ function drush_pm_enable() {
 
   // Discard and set an error for each unknown extension.
   foreach ($unknown as $name) {
-    drush_set_error('DRUSH_PM_ENABLE_EXTENSION_NOT_FOUND', dt('!extension was not found and will not be enabled.', array('!extension' => $name)));
+    drush_log(dt('!extension was not found and will not be enabled.', array('!extension' => $name)), 'warning');
   }
 
   // Discard already enabled extensions.
@@ -564,10 +564,11 @@ function drush_pm_enable() {
     // Check module dependencies.
     $dependencies = drush_check_module_dependencies($modules, $extension_info);
     $all_dependencies = array();
+    $dependencies_ok = TRUE;
     foreach ($dependencies as $key => $info) {
       if (isset($info['error'])) {
         unset($modules[$key]);
-        drush_set_error($info['error']['code'], $info['error']['message']);
+        $dependencies_ok = drush_set_error($info['error']['code'], $info['error']['message']);
       }
       elseif (!empty($info['dependencies'])) {
         // Make sure we have an assoc array.
@@ -575,6 +576,9 @@ function drush_pm_enable() {
         $all_dependencies = array_merge($all_dependencies, $assoc);
       }
     }
+    if (!$dependencies_ok) {
+      return FALSE;
+    }
     $enabled = array_keys(array_filter(drush_get_modules(), 'pm_is_enabled'));
     $needed = array_diff($all_dependencies, $enabled);
     $modules = $needed + $modules;
@@ -588,6 +592,7 @@ function drush_pm_enable() {
         unset($modules[$key]);
         drush_set_error('DRUSH_PM_ENABLE_MODULE_UNMEET_REQUIREMENTS', dt('Module !module doesn\'t meet the requirements to be enabled.', array('!module' => $module)));
         _drush_log_drupal_messages();
+	return FALSE;
       }
     }
   }
@@ -620,14 +625,18 @@ function drush_pm_enable() {
 
   // Inform the user of final status.
   $rsc = drush_db_select('system', array('name', 'status'), 'name IN (:extensions)', array(':extensions' => $extensions));
+  $problem_extensions = array();
   while ($extension = drush_db_fetch_object($rsc)) {
     if ($extension->status) {
       drush_log(dt('!extension was enabled successfully.', array('!extension' => $extension->name)), 'ok');
     }
     else {
-      drush_set_error('DRUSH_PM_ENABLE_EXTENSION_ISSUE', dt('There was a problem enabling !extension.', array('!extension' => $extension->name)));
+      $problem_extensions[] = $extension->name;
     }
   }
+  if (!empty($problem_extensions)) {
+    return drush_set_error('DRUSH_PM_ENABLE_EXTENSION_ISSUE', dt('There was a problem enabling !extension.', array('!extension' => implode(',', $problem_extensions))));
+  }
 }
 
 /**
@@ -647,7 +656,7 @@ function drush_pm_disable() {
 
   // Discard and set an error for each unknown extension.
   foreach ($unknown as $name) {
-    drush_set_error('DRUSH_PM_ENABLE_EXTENSION_NOT_FOUND', dt('!extension was not found and will not be disabled.', array('!extension' => $name)));
+    drush_log('DRUSH_PM_ENABLE_EXTENSION_NOT_FOUND', dt('!extension was not found and will not be disabled.', array('!extension' => $name)), 'warning');
   }
 
   // Discard already disabled extensions.
@@ -720,14 +729,18 @@ function drush_pm_disable() {
 
   // Inform the user of final status.
   $rsc = drush_db_select('system', array('name', 'status'), 'name IN (:extensions)', array(':extensions' => $extensions));
+  $problem_extensions = array();
   while ($extension = drush_db_fetch_object($rsc)) {
     if (!$extension->status) {
       drush_log(dt('!extension was disabled successfully.', array('!extension' => $extension->name)), 'ok');
     }
     else {
-      drush_set_error('DRUSH_PM_DISABLE_EXTENSION_ISSUE', dt('There was a problem disabling !extension.', array('!extension' => $extension->name)));
+      $problem_extensions[] = $extension->name;
     }
   }
+  if (!empty($problem_extensions)) {
+    return drush_set_error('DRUSH_PM_DISABLE_EXTENSION_ISSUE', dt('There was a problem disabling !extension.', array('!extension' => implode(',', $problem_extensions))));
+  }
 }
 
 /**
@@ -753,7 +766,7 @@ function drush_pm_info() {
       $info = $extension_info[$project];
     }
     else {
-      drush_set_error('DRUSH_PM_INFO_PROJECT_NOT_FOUND', dt('!project was not found.', array('!project' => $project)));
+      drush_log(dt('!project was not found.', array('!project' => $project)), 'warning');
       continue;
     }
     if ($info->type == 'module') {
@@ -915,12 +928,12 @@ function drush_pm_uninstall() {
     if (!isset($module_info[$module])) {
       // The module does not exist in the system.
       unset($modules[$key]);
-      drush_set_error('DRUSH_PM_ENABLE_MODULE_NOT_FOUND', dt('Module !module was not found and will not be uninstalled.', array('!module' => $module)));
+      drush_log(dt('Module !module was not found and will not be uninstalled.', array('!module' => $module)), 'warning');
     }
     else if ($module_info[$module]->status) {
       // The module is enabled.
       unset($modules[$key]);
-      drush_set_error('DRUSH_PM_UNINSTALL_ACTIVE_MODULE', dt('!module is not disabled. Use `pm-disable` command before `pm-uninstall`.', array('!module' => $module)));
+      drush_log(dt('!module is not disabled. Use `pm-disable` command before `pm-uninstall`.', array('!module' => $module)), 'warning');
     }
     else if ($module_info[$module]->schema_version == -1) { // SCHEMA_UNINSTALLED
       // The module is uninstalled.
@@ -1630,7 +1643,7 @@ function pm_parse_project_version($reque
       $project = trim(substr($request, 0, strlen($request) - strlen($matches[0])), ' -');
 
       if ($matches[1] == 'HEAD' || $matches[2] == 'HEAD') {
-        drush_set_error('DRUSH_PM_HEAD', 'Can\'t download HEAD releases because Drupal.org project information only provides for numbered release nodes.');
+        drush_log('DRUSH_PM_HEAD', 'Can\'t download HEAD releases because Drupal.org project information only provides for numbered release nodes.', 'warning');
         continue;
       }
       if (!empty($matches[2])) {
