? .drush-cache.info
? drushrc.php
? includes/table.inc
Index: includes/backend.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drush/includes/backend.inc,v
retrieving revision 1.34
diff -u -p -r1.34 backend.inc
--- includes/backend.inc	9 Dec 2010 01:10:11 -0000	1.34
+++ includes/backend.inc	1 Jan 2011 05:57:37 -0000
@@ -84,7 +84,17 @@ function drush_backend_output() {
   // The error log is a more specific version of the log, and may be used by calling
   // scripts to check for specific errors that have occurred.
   $data['error_log'] = drush_get_error_log();
-
+  // If there is a @self record, then include it in the result
+  $self_record = drush_sitealias_get_record('@self');
+  if (!empty($self_record)) {
+    $site_context = drush_get_context('site', array());
+    unset($site_context['config-file']);
+    unset($site_context['context-path']);
+    unset($self_record['loaded-config']);
+    unset($self_record['name']);
+    $data['self'] = array_merge($site_context, $self_record);
+  }
+  
   // Return the options that were set at the end of the process.
   $data['context']  = drush_get_merged_options();
   if (!drush_get_context('DRUSH_QUIET')) {
Index: includes/command.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drush/includes/command.inc,v
retrieving revision 1.103
diff -u -p -r1.103 command.inc
--- includes/command.inc	31 Dec 2010 01:16:40 -0000	1.103
+++ includes/command.inc	1 Jan 2011 05:57:38 -0000
@@ -266,6 +266,12 @@ function drush_invoke_sitealias($site_al
  *   If the command was completed, this will return an associative array containing the data from drush_backend_output().
  */
 function drush_invoke_sitealias_args($site_alias_record, $command_name, $commandline_args, $commandline_options = array()) {
+  // If the first parameter is not a site alias record,
+  // then presume it is an alias name, and try to look up
+  // the alias record.
+  if (!is_array($site_alias_record)) {
+    $site_alias_record = drush_sitealias_get_record($site_alias_record);
+  }
   return drush_do_site_command($site_alias_record, $command_name, $commandline_args, $commandline_options);
 }
 
@@ -1068,7 +1074,7 @@ function drush_scan_directory($dir, $mas
   $key = (in_array($key, array('filename', 'basename', 'name')) ? $key : 'filename');
   $files = array();
 
-  if (is_dir($dir) && $handle = opendir($dir)) {
+  if (is_string($dir) && is_dir($dir) && $handle = opendir($dir)) {
     while (FALSE !== ($file = readdir($handle))) {
       if (!in_array($file, $nomask) && (($include_dot_files && (!preg_match("/\.\+/",$file))) || ($file[0] != '.'))) {
         if (is_dir("$dir/$file") && (($recurse_max_depth === TRUE) || ($depth < $recurse_max_depth))) {
Index: includes/context.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drush/includes/context.inc,v
retrieving revision 1.37
diff -u -p -r1.37 context.inc
--- includes/context.inc	31 Dec 2010 01:16:40 -0000	1.37
+++ includes/context.inc	1 Jan 2011 05:57:38 -0000
@@ -55,10 +55,10 @@
  *     process  : Generated in the current process.
  *     cli      : Passed as --option=value to the command line.
  *     stdin    : Passed as a JSON encoded string through stdin.
- *     alias    : Defined in an alias record, and set in the
- *                alias context whenever that alias is used.
  *     specific : Defined in a command-specific option record, and
  *                set in the command context whenever that command is used.
+ *     alias    : Defined in an alias record, and set in the
+ *                alias context whenever that alias is used.
  *
  *   Specified by config files :
  *     custom   : Loaded from the config file specified by --config or -c
@@ -74,8 +74,8 @@
  */
 function drush_context_names() {
   static $contexts = array(
-    'process', 'cli', 'stdin', 'specific',
-    'custom', 'site', 'drupal', 'alias', 'user', 'home.drush', 'system',
+    'process', 'cli', 'stdin', 'specific', 'alias',
+    'custom', 'site', 'drupal', 'user', 'home.drush', 'system',
     'drush', 'default');
 
   return $contexts;
Index: includes/sitealias.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drush/includes/sitealias.inc,v
retrieving revision 1.73
diff -u -p -r1.73 sitealias.inc
--- includes/sitealias.inc	31 Dec 2010 04:59:43 -0000	1.73
+++ includes/sitealias.inc	1 Jan 2011 05:57:39 -0000
@@ -640,6 +640,11 @@ function drush_sitealias_add_db_settings
     if (isset($values['object'])) {
       $alias_record['databases'] = $values['object'];
       $altered_record = TRUE;
+      // If there are any special settings in the '@self' record returned by drush_invoke_sitealias_args,
+      // then add those into our altered record as well
+      if (array_key_exists('self', $values)) {
+        $alias_record = array_merge($values['self'], $alias_record);
+      }
       // If the name is set, then re-cache the record after we fetch the databases
       if (array_key_exists('name', $alias_record)) {
         $all_site_aliases =& drush_get_context('site-aliases');
