? includes/table.inc
Index: commands/core/sitealias.drush.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drush/commands/core/sitealias.drush.inc,v
retrieving revision 1.13
diff -u -p -r1.13 sitealias.drush.inc
--- commands/core/sitealias.drush.inc	24 Feb 2010 04:54:31 -0000	1.13
+++ commands/core/sitealias.drush.inc	27 Feb 2010 05:44:06 -0000
@@ -48,7 +48,7 @@ function sitealias_drush_command() {
  * is the site specification for the given alias.
  */
 function _drush_sitealias_alias_list() {
-  return drush_get_option('site-aliases', array());
+  return drush_get_context('site-aliases');
 }
 
 /**
Index: includes/command.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drush/includes/command.inc,v
retrieving revision 1.66
diff -u -p -r1.66 command.inc
--- includes/command.inc	22 Feb 2010 04:03:17 -0000	1.66
+++ includes/command.inc	27 Feb 2010 05:44:07 -0000
@@ -634,7 +634,7 @@ function drush_command_default_options($
 
 function _drush_command_set_default_options($command) {
   $options_were_set = FALSE;
-  $command_default_options = drush_get_option('command-specific', array());
+  $command_default_options = drush_get_context('command-specific');
   if (array_key_exists($command, $command_default_options)) {
     foreach ($command_default_options[$command] as $key => $value) {
       // We set command-specific options in their own context
Index: includes/context.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drush/includes/context.inc,v
retrieving revision 1.22
diff -u -p -r1.22 context.inc
--- includes/context.inc	23 Feb 2010 19:32:10 -0000	1.22
+++ includes/context.inc	27 Feb 2010 05:44:07 -0000
@@ -148,17 +148,12 @@ function drush_load_config_file($context
     // files.  If we did not do this merge, then the last configuration file
     // that defined any of these properties would overwrite all of the options
     // that came before in previously-loaded configuration files.  We place
-    // all of them into the 'default' context so that this does not happen.
+    // all of them into their own context so that this does not happen.
     if (isset($options)) {
       foreach (array('site-aliases', 'command-specific') as $option_name) {
         if ((isset($options)) && (array_key_exists($option_name, $options))) {
-          $cache =& drush_get_context('default');
-          if (array_key_exists($option_name, $cache)) {
-            $cache[$option_name] = array_merge($cache[$option_name], $options[$option_name]);
-          }
-          else {
-            $cache[$option_name] = $options[$option_name];
-          }
+          $cache =& drush_get_context($option_name);
+          $cache = array_merge($cache, $options[$option_name]);
           unset($options[$option_name]);
         }
       }
Index: includes/sitealias.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drush/includes/sitealias.inc,v
retrieving revision 1.26
diff -u -p -r1.26 sitealias.inc
--- includes/sitealias.inc	24 Feb 2010 14:12:59 -0000	1.26
+++ includes/sitealias.inc	27 Feb 2010 05:44:08 -0000
@@ -92,19 +92,15 @@ function drush_sitealias_get_record($ali
 }
 
 function _drush_sitealias_get_record($alias, $db_settings_needed = false) {
-  // Sometimes getting an alias record involves loading settings.php or calling
-  // backend invoke.  We'll cache all alias records fetched by this routine to
-  // insure that we never have to do anything like that twice.
-  $alias_record = drush_get_option('sitealias-' . $alias, array(), 'sitealias-cache');
-  if (empty($alias_record)) {
-    // Check to see if the provided parameter is in fact a defined alias.
-    $all_site_aliases = drush_get_option('site-aliases', array());
-    if (array_key_exists($alias, $all_site_aliases)) {
-      $alias_record = $all_site_aliases[$alias];
-    }
-    // If the parameter is not an alias, then it is some form of
-    // site specification (or it is nothing at all)
-    elseif (isset($alias)) {
+  // Check to see if the provided parameter is in fact a defined alias.
+  $all_site_aliases =& drush_get_context('site-aliases');
+  if (array_key_exists($alias, $all_site_aliases)) {
+    $alias_record = $all_site_aliases[$alias];
+  }
+  // If the parameter is not an alias, then it is some form of
+  // site specification (or it is nothing at all)
+  else {
+    if (isset($alias)) {
       // Cases 1.) - 4.):
       // We will check for a site specification if the alias has at least
       // two characters from the set '@', '/', '#'.
@@ -155,19 +151,21 @@ function _drush_sitealias_get_record($al
       }
 
     }
+  }
+  // Process site list related fields
+  _drush_sitealias_check_sitelist_fields($alias_record);
 
-    // Process site list related fields
-    _drush_sitealias_check_sitelist_fields($alias_record);
-
-    // Cache the result
-    drush_set_option('sitealias-' . $alias, $alias_record, 'sitealias-cache');
-
-    // Load the drush config file if there is one in the site folder just found
-    if (!isset($alias_record['remote']) && isset($alias_record['uri']) && isset($alias_record['root'])) {
-      drush_load_config_file('site', $alias_record['root'] . '/sites/' . drush_sitealias_uri_to_site_dir($alias_record['uri']) . '/drushrc.php');
+  // Load the drush config file if there is one associated with this alias
+  if (!isset($alias_record['remote']) && !isset($alias_record['loaded-config'])) {
+    if (!isset($alias_record['config-path']) && isset($alias_record['uri']) && isset($alias_record['root'])) {
+      $alias_record['config-path'] = realpath($alias_record['root'] . '/sites/' . drush_sitealias_uri_to_site_dir($alias_record['uri']) . '/drushrc.php');
+    }
+    if (isset($alias_record['config-path']) && file_exists($alias_record['config-path'])) {
+      drush_load_config_file('site', $alias_record['config-path']);
+      $alias_record['loaded-config'] = TRUE;
     }
   }
-
+  
   // If the alias record does not have a defined 'databases' entry,
   // then we'll need to look one up
   if ($db_settings_needed) {
@@ -177,6 +175,9 @@ function _drush_sitealias_get_record($al
   // Add the static defaults
   _drush_sitealias_add_static_defaults($alias_record);
 
+  // Cache the result
+  $all_site_aliases[$alias] = $alias_record;
+
   // Fail fast if database settings are not available and the caller
   // said that they are required (but give site lists a pass)
   if ($db_settings_needed && !isset($alias_record['databases']) && !isset($alias_record['site-list'])) {
@@ -633,7 +634,7 @@ function _drush_sitealias_find_record_fo
   //$drupal_root = drush_bootstrap_value('drupal_root');
   $drupal_root = drush_get_option(array('r', 'root'), drush_locate_root());
 
-  $all_site_aliases = drush_get_option('site-aliases', array());
+  $all_site_aliases = drush_get_context('site-aliases');
   foreach ($all_site_aliases as $one_alias_name => $one_alias_record) {
     if (!isset($one_alias_record['remote-host']) && isset($one_alias_record['root']) && isset($one_alias_record['uri']) && ($one_alias_record['uri'] == $alias) && ($one_alias_record['root'] == $drupal_root)) {
       $alias_record = $one_alias_record;
