? views
? commands/core/docs.drush.inc
? includes/table.inc
Index: commands/core/core.drush.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drush/commands/core/core.drush.inc,v
retrieving revision 1.135
diff -u -p -r1.135 core.drush.inc
--- commands/core/core.drush.inc	1 Dec 2010 20:59:56 -0000	1.135
+++ commands/core/core.drush.inc	4 Dec 2010 07:31:21 -0000
@@ -37,7 +37,7 @@ function core_drush_command() {
       'drush help pm-download' => 'Show help for one command.',
       'drush help dl' => 'Show help for one command using an alias.',
     ),
-    'topics' => array('core-readme'),
+    'topics' => array('docs-readme'),
   );
   $items['core-cron'] = array(
     'description' => 'Run all cron hooks.',
@@ -219,16 +219,6 @@ function core_drush_command() {
     'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_SITE,
   );
 
-  // Topic commands
-  $items['core-readme'] = array(
-    'description' => dt('README.txt'),
-    'hidden' => TRUE,
-    'topic' => TRUE,
-    'bootstrap' => DRUSH_BOOTSTRAP_DRUSH,
-    'callback' => 'drush_print_file',
-    'callback arguments' => array(DRUSH_BASE_PATH . '/README.txt'),
-  );
-
   return $items;
 }
 
Index: commands/core/topic.drush.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drush/commands/core/topic.drush.inc,v
retrieving revision 1.4
diff -u -p -r1.4 topic.drush.inc
--- commands/core/topic.drush.inc	6 Oct 2010 21:00:26 -0000	1.4
+++ commands/core/topic.drush.inc	4 Dec 2010 07:31:21 -0000
@@ -23,8 +23,11 @@ function topic_drush_command() {
       'drush topic core-context' => 'Show documentation for the drush context API',
       'drush core-context' => 'Show documentation for the drush context API',
     ),
+    'bootstrap' => DRUSH_BOOTSTRAP_DRUSH,
     'aliases' => array('topic'),
+    'topics' => array('docs-readme'),
   );
+
   return $items;
 }
 
@@ -39,6 +42,7 @@ function topic_drush_help_alter($command
     $command['topic_section'][$topic_name] = dt($implemented[$topic_name]['description']);
   }
 }
+
 /**
  * A command callback.
  *
@@ -58,7 +62,13 @@ function drush_core_topic($topic_name = 
       return;
     }
   }
-  return drush_do_command_redispatch($topic_name);
+  // If the topic name is not found, check for
+  // "docs-$topic_name".  This allows users to be
+  // just a bit lazy when selecting core topics by name.
+  if (!isset($commands[$topic_name]) && isset($commands["docs-$topic_name"])) {
+    $topic_name = "docs-$topic_name";
+  }
+  return drush_redispatch($commands[$topic_name]);
 }
 
 /**
@@ -72,4 +82,4 @@ function drush_get_topics() {
     }
   }
   return $topics;
-}
\ No newline at end of file
+}
Index: commands/pm/pm.drush.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drush/commands/pm/pm.drush.inc,v
retrieving revision 1.149
diff -u -p -r1.149 pm.drush.inc
--- commands/pm/pm.drush.inc	3 Dec 2010 16:32:56 -0000	1.149
+++ commands/pm/pm.drush.inc	4 Dec 2010 07:31:22 -0000
@@ -215,6 +215,8 @@ function pm_drush_command() {
       '--source' => 'The base URL which provides project release history in XML. Defaults to http://updates.drupal.org/release-history.',
       '--notes' => 'Show release notes after each project is downloaded.',
       '--variant' => "Only useful for install profiles. Possible values: 'core', 'no-core', 'make'.",
+      '--select' => "Select the version to download interactively from a list of available releases. Defaults to downloading the recommended release.",
+      '--all' => "Useful only with --select; shows all available releases instead of a short list of recent releases.",
       '--drupal-project-rename' => 'Alternate name for "drupal-x.y" directory when downloading Drupal project. If empty, will defaults to "drupal".',
       '--pipe' => 'Returns a list of the names of the extensions (modules and themes) contained in the downloaded projects.',
     ),
@@ -966,6 +968,29 @@ function drush_pm_releases() {
 }
 
 /**
+ * Return an array of available releases for given project(s).
+ *
+ * Helper function for pm-download.
+ */
+function _drush_pm_download_releases_choice($project, $all = FALSE) {
+  $info = _drush_pm_get_releases(array($project));
+  $options = array();
+  $limits_list = array();
+  foreach ($info[$project]['releases'] as $release) {
+    $release_statuses = implode(', ', $release['release_status']);
+    $limits_key = $release['version_major'] . $release_statuses;
+    // We keep track of how many releases with the given status exists, and show only the first
+    // two that are exactly the same.  This is mostly to filter out the many releases with
+    // empty release status strings, and gives us a reasonable approximation for the other releases.
+    $limits_list[$limits_key] = (array_key_exists($limits_key, $limits_list) ? $limits_list[$limits_key] : 0) + 1;
+    if ($all || ($limits_list[$limits_key] <= 2)) {
+      $options[$release['version']] = $release['version'] . ' - ' . format_date($release['date'], 'custom', 'Y-M-d') . ' - ' . $release_statuses;
+    }
+  }
+  return $options;
+}
+
+/**
  * Get releases for given projects and fill in status information.
  *
  * @param $projects
@@ -986,8 +1011,8 @@ function _drush_pm_get_releases($project
       continue;
     }
     if ($info[$project]['project_status'] == 'unpublished') {
-      drush_set_error('DRUSH_PM_PROJECT_UNPUBLISHED', dt("Project !project is unpublished ans has no releases available.", array('!project' => $key)), 'warning');
-      unset($info[$key]);
+      drush_set_error('DRUSH_PM_PROJECT_UNPUBLISHED', dt("Project !project is unpublished and has no releases available.", array('!project' => $project)), 'warning');
+      unset($info[$project]);
       continue;
     }
   }
@@ -1760,6 +1785,12 @@ function drush_pm_download() {
       drush_set_error('DRUSH_PM_COULD_NOT_LOAD_UPDATE_FILE', $error[0]);
       continue;
     }
+    // Unpublished project?
+    $project_status = $xml->xpath('/project/project_status');
+    if ($project_status[0][0] == 'unpublished') {
+      drush_set_error('DRUSH_PM_PROJECT_UNPUBLISHED', dt("Project !project is unpublished and has no releases available.", array('!project' => $name)), 'warning');
+      continue;
+    }
 
     // Try to get the specified release.
     if (!empty($request['version'])) {
@@ -1791,6 +1822,18 @@ function drush_pm_download() {
     if (!empty($recommended_releases)) {
       $releases = $recommended_releases;
     }
+    if (drush_get_option('select', FALSE) || empty($releases)) {
+      if (drush_get_context('DRUSH_BOOTSTRAP_PHASE') >= DRUSH_BOOTSTRAP_DRUPAL_FULL) {
+        $options = _drush_pm_download_releases_choice($request['name'], drush_get_option('all', FALSE));
+        $choice = drush_choice($options, dt('There is no recommended release for project !project. Choose one of the available releases:', array('!project' => $request['name'])));
+        if ($choice) {
+          $releases = $xml->xpath("/project/releases/release[status='published'][version='" . $choice . "']");
+        }
+        else {
+          continue;
+        }
+      }
+    }
     if (empty($releases)) {
       drush_log(dt('There is no *recommended* release for project !project on Drupal !drupal_version. Ask the maintainer to review http://drupal.org/node/197584 and create/recommend a release in order to be compatible with drush and the drupal.org security broadcast system. A recommended development snapshot release is sufficient. Alternatively, run pm-releases command and explicity pm-download any non-recommended release that might be available.', array('!drupal_version' => $request['drupal_version'], '!project' => $request['name'])), 'ok');
       continue;
Index: includes/command.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drush/includes/command.inc,v
retrieving revision 1.88
diff -u -p -r1.88 command.inc
--- includes/command.inc	10 Nov 2010 02:55:41 -0000	1.88
+++ includes/command.inc	4 Dec 2010 07:31:23 -0000
@@ -333,24 +333,31 @@ function drush_parse_command() {
 
   // We have found a command that matches. Set the appropriate values.
   if ($command) {
-    // Special case. Force help command if --help option was specified.
-    if (drush_get_option(array('h', 'help'))) {
-      $arguments = array($command['command']);
-      $command = $implemented['help'];
-      $command['arguments'] = $arguments;
-    }
-    else {
-      // Merge specified callback arguments, which precede the arguments passed on the command line.
-      if (isset($command['callback arguments']) && is_array($command['callback arguments'])) {
-        $arguments = array_merge($command['callback arguments'], $arguments);
-      }
-    }
-    $command['arguments'] = $arguments;
+    _drush_prepare_command($command, $arguments);
     drush_set_command($command);
   }
   return $command;
 }
 
+/*
+ * Called by drush_parse_command and drush_redispatch
+ */
+function _drush_prepare_command(&$command, $arguments = array()) {
+  // Special case. Force help command if --help option was specified.
+  if (drush_get_option(array('h', 'help'))) {
+    $arguments = array($command['command']);
+    $command = $implemented['help'];
+    $command['arguments'] = $arguments;
+  }
+  else {
+    // Merge specified callback arguments, which precede the arguments passed on the command line.
+    if (isset($command['callback arguments']) && is_array($command['callback arguments'])) {
+      $arguments = array_merge($command['callback arguments'], $arguments);
+    }
+  }
+  $command['arguments'] = $arguments;
+}
+
 /**
  * Invoke drush api calls.
  *
Index: includes/drush.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drush/includes/drush.inc,v
retrieving revision 1.153
diff -u -p -r1.153 drush.inc
--- includes/drush.inc	3 Dec 2010 08:11:07 -0000	1.153
+++ includes/drush.inc	4 Dec 2010 07:31:24 -0000
@@ -11,6 +11,14 @@
  */
 define('DRUSH_DRUPAL_KILOBYTE', 1024);
 
+/**
+ * Given a command record, dispatch it as if it were
+ * the original command.  @see drush_core_topic.
+ */
+function drush_redispatch($command, $arguments = array()) {
+  _drush_prepare_command($command, $arguments);
+  drush_dispatch($command);
+}
 
 /**
  * Dispatch a given set of commands.
@@ -965,20 +973,27 @@ function _drush_shell_exec($args, $inter
   }
 
   if (!drush_get_context('DRUSH_SIMULATE')) {
-    exec($command . ($interactive ? '' : ' 2>&1'), $output, $result);
-    _drush_shell_exec_output_set($output);
+    if ($interactive) {
+      $result = proc_open($command, array(0 => STDIN, 1 => STDOUT, 2 => STDERR), $pipes);
+      proc_close($result);
+      return ($result !== FALSE);
+    }
+    else {
+      exec($command . ($interactive ? '' : ' 2>&1'), $output, $result);
+      _drush_shell_exec_output_set($output);
 
-    if (drush_get_context('DRUSH_DEBUG')) {
-      foreach ($output as $line) {
-        drush_print($line, 2);
+      if (drush_get_context('DRUSH_DEBUG')) {
+	foreach ($output as $line) {
+          drush_print($line, 2);
+	}
       }
-    }
 
-    // Exit code 0 means success.
-    return ($result == 0);
+      // Exit code 0 means success.
+      return ($result == 0);
+    }
   }
   else {
-    return 0;
+    return TRUE;
   }
 }
 
@@ -1125,7 +1140,15 @@ function drush_print($message = '', $ind
  *   Full path to a file.
  */
 function drush_print_file($file) {
-  drush_print(file_get_contents($file));
+  if (drush_shell_exec_interactive("less %s", $file)) {
+    return;
+  }
+  elseif (drush_shell_exec_interactive("more %s", $file)) {
+    return;
+  }
+  else {
+    drush_print(file_get_contents($file));
+  }
 }
 
 /**
