? drush-977048.patch
? includes/table.inc
Index: commands/pm/pm.drush.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drush/commands/pm/pm.drush.inc,v
retrieving revision 1.144
diff -u -r1.144 pm.drush.inc
--- commands/pm/pm.drush.inc	1 Dec 2010 15:53:15 -0000	1.144
+++ commands/pm/pm.drush.inc	1 Dec 2010 16:07:56 -0000
@@ -575,16 +575,30 @@
 
 /**
  * Wrapper of drupal_get_extensions() with additional information used by
- * pm- commands.
+ * some pm- commands.
  *
  * @return
- *   An array containing info for all available extensions w/additional info.
+ *   if $like_projects = FALSE
+ *     An array containing info for all available extensions, i.e. d.o modules
+ *     and themes.
+ *   else
+ *     An array containing info for all available drupal.org projects, i.e.
+ *     drupal.org/project/* (e.g. cck, token and zen).
  */
-function drush_pm_get_extensions() {
+function drush_pm_get_extensions($like_projects = FALSE) {
   $extensions = drush_get_extensions();
-  foreach ($extensions as $key => $extension) {
-    if (empty($extension->info['package'])) {
-      $extensions[$key]->info['package'] = dt('Other');
+  foreach ($extensions as $name => $extension) {
+    if ($like_projects && !empty($extension->info['project'])) {
+      $project_name = $extension->info['project'];
+      if (!isset($extensions[$project_name])) {
+        $extensions[$project_name] = $extension;
+      }
+      if ($extensions[$name]->status) {
+        $extensions[$project_name]->status = $extensions[$name]->status;
+      }
+    }
+    elseif (empty($extension->info['package'])) {
+      $extensions[$name]->info['package'] = dt('Other');
     }
   }
   return $extensions;
@@ -951,7 +965,7 @@
 
   // Info on extensions present in the bootstrapped site will be used to
   // identify if any project release is installed.
-  $extension_info = drush_get_extensions();
+  $extension_info = drush_pm_get_extensions(TRUE);
 
   // Iterate the projects to collect relevant information.
   foreach ($info as $key => $project) {
@@ -996,11 +1010,6 @@
       if ($release['version_extra'] == 'dev') {
         $status[] = dt('Development');
       }
-      // #TODO# Note here we suffer the project<->package-name problem:
-      // Following only works for modules/themes with name with
-      // drupal.org's project name (zen->zen but not for cck->content).
-      // See _drush_pm_releasenotes() for an option to get that info
-      // from update's project data.
       if (isset($extension_info[$key])) {
         if ($extension_info[$key]->info['version'] == $version) {
           $status[] = dt('Installed');
@@ -1053,16 +1062,6 @@
 
   foreach ($info as $key => $project) {
     $selected_versions = array();
-    // #TODO# project<->package-name problem. See _drush_pm_get_releases().
-    if (!isset($project['installed'])) {
-      // Installed package's version (e.g. cck) is detected by
-      // _drush_pm_get_releases(). Attempted to obtain information
-      // about it from update_cache.
-      $cache_project_info = _update_cache_get('update_project_projects');
-      if (isset($cache_project_info->data[$key])) {
-        $project['installed'] = $cache_project_info->data[$key]['info']['version'];
-      }
-    }
     // If the request included version, only show its release notes.
     if (isset($requests[$key]['version'])) {
       $selected_versions[] = $requests[$key]['version'];
Index: commands/pm/updatecode.pm.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drush/commands/pm/updatecode.pm.inc,v
retrieving revision 1.24
diff -u -r1.24 updatecode.pm.inc
--- commands/pm/updatecode.pm.inc	1 Dec 2010 15:53:15 -0000	1.24
+++ commands/pm/updatecode.pm.inc	1 Dec 2010 16:07:56 -0000
@@ -31,9 +31,16 @@
 
   // Preprocess releases.
   if (!empty($requests)) {
+    $project_info = drush_pm_get_extensions(TRUE);
     // Check requests are installed and enabled projects and force
     // update projects where a specific version is requested.
     foreach ($requests as $name => $request) {
+      if (!isset($project_info[$name])) {
+        return drush_set_error('DRUSH_PM_UNKNOWN_PROJECT', dt('!project was not found and will not be updated.', array('!project' => $name)));
+      }
+      elseif (!$project_info[$name]->status) {
+        return drush_set_error('DRUSH_PM_DISABLED_PROJECT', dt('!project is not enabled and will not be updated.', array('!project' => $name)));
+      }
       if (!isset($projects[$name])) {
         // Catch projects with no version data (common for CVS checkouts
         // if you don't have CVS deploy installed).
