From 3f973b9684ade2580117e3ad4671314c868c392c Mon Sep 17 00:00:00 2001
From: rfay <randy@randyfay.com>
Date: Sat, 12 Feb 2011 12:21:51 -0700
Subject: [PATCH 1/2] Change the time to use Drupal function so that it's reported in local time

---
 review/client.inc |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/review/client.inc b/review/client.inc
index 8bf03a3..441dd81 100644
--- a/review/client.inc
+++ b/review/client.inc
@@ -154,7 +154,7 @@ abstract class pifr_client_review {
    */
   protected function log($string) {
     static $started = FALSE;
-    $string = '[' . date('H:i:s') . '] ' . $string . "\n";
+    $string = '[' . format_date(time(),'custom', 'H:i:s') . '] ' . $string . "\n";
     if (!$started) {
       $started = TRUE;
       file_put_contents($this->log_file, $string);
-- 
1.7.0.4


From 884daf1b1643acf518b1c08cb0a76af1bcada35e Mon Sep 17 00:00:00 2001
From: rfay <randy@randyfay.com>
Date: Sat, 12 Feb 2011 15:42:59 -0700
Subject: [PATCH 2/2] #1057526 by rfay: Remove hard-wired repository URLs into variables

---
 client/pifr_client.admin.inc                 |   34 ++++++++++++++++++++++++-
 client/pifr_client.module                    |    6 ++++
 client/pifr_client.review.inc                |   17 +++++++------
 client/pifr_client.test                      |    2 +-
 client/review/vcs/git.inc                    |    1 -
 review/client.inc                            |    2 +-
 review/drupal/pifr_drupal.client.inc         |   23 ++++++++++++-----
 review/drupal/pifr_drupal.server.inc         |    2 +-
 review/drupal/pifr_drupal.test               |    6 ++--
 review/simpletest/pifr_simpletest.client.inc |    1 +
 server/pifr_server.admin.inc                 |    2 +-
 server/pifr_server.install                   |    4 +-
 12 files changed, 73 insertions(+), 27 deletions(-)

diff --git a/client/pifr_client.admin.inc b/client/pifr_client.admin.inc
index a17eac0..cb0d411 100644
--- a/client/pifr_client.admin.inc
+++ b/client/pifr_client.admin.inc
@@ -122,6 +122,36 @@ function pifr_client_admin_configuration_form(&$form, $form_state) {
     '#default_value' => PIFR_CLIENT_TIMEOUT,
     '#required' => TRUE,
   );
+  $form['client']['pifr_drupal_repository'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Drupal core repository URL'),
+    '#default_value' => PIFR_DRUPAL_REPOSITORY,
+    '#required' => TRUE,
+  );
+  $form['client']['pifr_simpletest_repository'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Simpletest module repository URL'),
+    '#default_value' => PIFR_SIMPLETEST_REPOSITORY,
+    '#required' => TRUE,
+  );
+  $form['client']['pifr_chart_repository'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Chart module repository URL'),
+    '#default_value' => PIFR_CHART_REPOSITORY,
+    '#required' => TRUE,
+  );
+  $form['client']['pifr_multivariate_repository'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Multivariate module repository URL'),
+    '#default_value' => PIFR_MULTIVARIATE_REPOSITORY,
+    '#required' => TRUE,
+  );
+  $form['client']['pifr_menu_rewrite_repository'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Menu Rewrite module repository URL'),
+    '#default_value' => PIFR_MENU_REWRITE_REPOSITORY,
+    '#required' => TRUE,
+  );
 }
 
 /**
@@ -272,8 +302,8 @@ function pifr_client_admin_check_configuration_cli() {
       'cmd' => 'patch -v',
     ),
     array(
-      'title' => 'cvs',
-      'cmd' => 'cvs -v',
+      'title' => 'git',
+      'cmd' => 'git --version',
     ),
     array(
       'title' => 'curl',
diff --git a/client/pifr_client.module b/client/pifr_client.module
index 359eb7a..8539d2c 100644
--- a/client/pifr_client.module
+++ b/client/pifr_client.module
@@ -15,6 +15,12 @@ define('PIFR_CLIENT_SERVER', variable_get('pifr_client_server', ''));
 define('PIFR_CLIENT_CONCURRENCY', variable_get('pifr_client_concurrency', 1));
 define('PIFR_CLIENT_TIMEOUT', variable_get('pifr_client_timeout', 45));
 define('PIFR_CLIENT_TEST_START', variable_get('pifr_client_test_start', 0));
+define('PIFR_DRUPAL_REPOSITORY', variable_get('pifr_drupal_repository', 'git://git.drupal.org/project/drupal.git'));
+define('PIFR_CHART_REPOSITORY', variable_get('pifr_chart_repository', 'git://git.drupal.org/project/chart.git'));
+define('PIFR_MULTIVARIATE_REPOSITORY', variable_get('pifr_multivariate_repository', 'git://git.drupal.org/project/multivariate.git'));
+define('PIFR_SIMPLETEST_REPOSITORY', variable_get('pifr_simpletest_repository', 'git://git.drupal.org/project/chart.git'));
+define('PIFR_MENU_REWRITE_REPOSITORY', variable_get('pifr_menu_rewrite_repository', 'git://git.drupal.org/project/menu_rewrite.git'));
+
 
 /**
  * The location of the PHP executable to be used when running tests.
diff --git a/client/pifr_client.review.inc b/client/pifr_client.review.inc
index 0d664dc..0d7019b 100644
--- a/client/pifr_client.review.inc
+++ b/client/pifr_client.review.inc
@@ -71,7 +71,7 @@ function pifr_client_review_load(array $test, $return_class = FALSE) {
     return new $class($test);
   }
   else {
-    watchdog('pifr_client', 'Invalid review plugin [@plugin].', array('@plugin' => $test['review']['plugin']), WATCHDOG_ERROR);
+    watchdog('pifr_client', 'Review plugin module not found [@plugin].', array('@plugin' => $test['review']['plugin']), WATCHDOG_ERROR);
   }
   return FALSE;
 }
@@ -171,7 +171,8 @@ function pifr_client_review_pre_built_test($type) {
         'main' => array(
           'repository' => array(
             'type' => 'git',
-            'url' => 'git://git-dev.drupal.org/project/drupal',
+            // GITMIGRATION Fragile
+            'url' => variable_get('pifr_drupal_repository', 'git://git.drupal.org/project/drupal.git'),
           ),
           'vcs_identifier' => 'master',
         ),
@@ -207,24 +208,24 @@ function pifr_client_review_pre_built_test($type) {
         'main' => array(
           'repository' => array(
             'type' => 'git',
-            'url' => 'git://git-dev.drupal.org/project/drupal',
+            'url' => variable_get('pifr_drupal_repository', 'git://git.drupal.org/project/drupal.git'),
           ),
-          'vcs_identifier' => '6.x',
+          'vcs_identifier' => '6.x',  // GITMIGRATION Fragile
         ),
         'dependencies' => array(
           array(
             'repository' => array(
               'type' => 'git',
-              'url' => 'git://git-dev.drupal.org/project/multivariate',
+              'url' => variable_get('pifr_multivariate_repository', 'git://git.drupal.org/project/multivariate.git'),
             ),
-            'vcs_identifier' => 'master',
+            'vcs_identifier' => 'master',  // GITMIGRATION Fragile
           ),
           array(
             'repository' => array(
               'type' => 'git',
-              'url' => 'git://git-dev.drupal.org/project/chart',
+              'url' => variable_get('pifr_chart_repository', 'git://git.drupal.org/project/chart.git'),
             ),
-            'vcs_identifier' => 'master',
+            'vcs_identifier' => 'master',  // GITMIGRATION Fragile
           ),
         ),
       ),
diff --git a/client/pifr_client.test b/client/pifr_client.test
index 1347432..96359b6 100644
--- a/client/pifr_client.test
+++ b/client/pifr_client.test
@@ -72,7 +72,7 @@ class PIFRClientPluginTestCase extends DrupalWebTestCase {
     variable_set('file_directory_path', $file_directory_path);
 
     // Assert that basic log items have been added.
-    $this->assertLogText('Log initialzed.');
+    $this->assertLogText('Log initialized.');
     $this->assertLogText('Environment variables and review information initialized.');
     $this->assertLogText('Review started.');
 
diff --git a/client/review/vcs/git.inc b/client/review/vcs/git.inc
index 7449253..bcab5ec 100644
--- a/client/review/vcs/git.inc
+++ b/client/review/vcs/git.inc
@@ -20,7 +20,6 @@ class PIFRClientReviewVCS_git implements PIFRClientReviewVCS {
       $directory = escapeshellarg($directory);
     }
     $cmd = "git clone --depth 1 -b $branch $url $directory";
-    // watchdog('debug', 'Checking out code: ' . $cmd); // DEBUG
     return pifr_client_review::exec($cmd);
   }
 
diff --git a/review/client.inc b/review/client.inc
index 441dd81..eb9d185 100644
--- a/review/client.inc
+++ b/review/client.inc
@@ -114,7 +114,7 @@ abstract class pifr_client_review {
     // Initialize the log file.
     touch(file_directory_path() . '/review.log');
     $this->log_file = realpath(file_directory_path() . '/review.log');
-    $this->log('Log initialzed.');
+    $this->log('Log initialized.');
 
     // Get list of operations from server implementation and remove the last
     // two operations since they should be 'fail', and 'pass'.
diff --git a/review/drupal/pifr_drupal.client.inc b/review/drupal/pifr_drupal.client.inc
index f735af7..66e5027 100644
--- a/review/drupal/pifr_drupal.client.inc
+++ b/review/drupal/pifr_drupal.client.inc
@@ -15,8 +15,10 @@ class pifr_client_review_pifr_drupal extends pifr_client_review {
 
   /**
    * Default Drupal core repository URL.
+   * @todo: We will be testing more than one branch of core shortly!
+   *
    */
-  protected $core_url = 'git://git-dev.drupal.org/project/drupal.git';
+  protected $core_url = 'git://git.drupal.org/project/drupal.git';
 
   /**
    * Location of default sites module directory.
@@ -46,11 +48,15 @@ class pifr_client_review_pifr_drupal extends pifr_client_review {
   public function __construct(array $test) {
     parent::__construct($test);
 
+    $this->core_url = variable_get('pifr_drupal_repository', 'git://git.drupal.org/project/drupal.git');
+
     // Allow the Drupal core URL to be overridden via an argument.
     if (!empty($this->test['review']['argument']['core-url'])) {
       $this->core_url = $this->test['review']['argument']['core-url'];
     }
 
+    watchdog('pifr_client', 'Test: ' . print_r($test, TRUE));
+    $this->log('core_url = [' . $this->core_url . ']; Test repository = [' . $this->test['vcs']['main']['repository']['url'] . ']');
     if ($this->test['vcs']['main']['repository']['url'] != $this->core_url) {
       // Main repository is not core, so this must be a module test. Move the
       // module repository (main) to the dependencies and find the core
@@ -60,6 +66,8 @@ class pifr_client_review_pifr_drupal extends pifr_client_review {
       // Store the project name 'simpletest' for use when applying patches.
       $this->project_directory = basename($this->test['vcs']['main']['repository']['url']);
       $this->project_directory = preg_replace('/\.git$/', '', $this->project_directory);
+      $this->log('Project directory is [' . $this->project_directory . ']');
+
 
       foreach ($this->test['vcs']['dependencies'] as $key => $dependency) {
         if ($dependency['repository']['url'] == $this->core_url) {
@@ -72,7 +80,7 @@ class pifr_client_review_pifr_drupal extends pifr_client_review {
 
     // Add SimpleTest as dependencies, unless it has already been added.
     if ($this->test['review']['argument']['core'] == 6) {
-      $simpletest_url = 'git://git-dev.drupal.org/project/simpletest.git';
+      $simpletest_url = variable_get('pifr_simpletest_repository', 'git://git.drupal.org/project/simpletest.git');
       $found = FALSE;
       foreach ($this->test['vcs']['dependencies'] as $key => $dependency) {
         if ($dependency['repository']['url'] == $simpletest_url) {
@@ -129,11 +137,11 @@ class pifr_client_review_pifr_drupal extends pifr_client_review {
 
       $display = $this->checkout_display($dependency);
       if ($this->has_error()) {
-        $this->log('Dependency [' . $display . '] checkout failed.');
+        $this->log('Dependency [' . $display . '] checkout into [' . $directory . '] failed.');
         break;
       }
 
-      $this->log('Dependency [' . $display . '] checkout complete.');
+      $this->log('Dependency [' . $display . '] checkout into [' . $directory . '] complete.');
     }
   }
 
@@ -237,8 +245,9 @@ class pifr_client_review_pifr_drupal extends pifr_client_review {
     // Step: Select an installation profile.
     // Step: Choose language.
     $pofile = $this->test['review']['argument']['core'] == 6 ? 'default' : 'standard';
-    if (!$b->drupalGet('install.php', array('query' => 'profile=' . $pofile . '&locale=en'))) {
-      $this->set_error(array('@reason' => 'failed to start process'));
+    $html = $b->drupalGet('install.php', array('query' => 'profile=' . $pofile . '&locale=en'));
+    if (empty($html)) {
+      $this->set_error(array('@reason' => 'failed to run install.php with profile ' . $pofile));
       return;
     }
 
@@ -279,7 +288,7 @@ class pifr_client_review_pifr_drupal extends pifr_client_review {
     $edit['site_mail'] = 'admin@example.com';
     $edit['account[name]'] = $this->admin_username;
     $edit['account[mail]'] = 'admin@example.com';
-    $edit['account[pass][pass1]'] = $this->admin_password = $b->randomName(12);
+    $edit['account[pass][pass1]'] = $this->admin_password = 'drupal';
     $edit['account[pass][pass2]'] = $this->admin_password;
     $edit['update_status_module[1]'] = FALSE;
     $b->drupalPost(NULL, $edit, t('Save and continue'));
diff --git a/review/drupal/pifr_drupal.server.inc b/review/drupal/pifr_drupal.server.inc
index 668cb4d..2b35eef 100644
--- a/review/drupal/pifr_drupal.server.inc
+++ b/review/drupal/pifr_drupal.server.inc
@@ -45,7 +45,7 @@ abstract class pifr_server_review_pifr_drupal extends pifr_server_review_pifr_as
     $this->confirmation_default['vcs']['main'] = array(
       'repository' => array(
         'type' => 'git',
-        'url' => 'git://git-dev.drupal.org/project/drupal.git',
+        'url' => variable_get('pifr_drupal_repository', 'git://git.drupal.org/project/drupal.git'),
       ),
       'vcs_identifier' => 'master',  // GITMIGRATION will have to be changed at migration
     );
diff --git a/review/drupal/pifr_drupal.test b/review/drupal/pifr_drupal.test
index 20f14ff..0d626f0 100644
--- a/review/drupal/pifr_drupal.test
+++ b/review/drupal/pifr_drupal.test
@@ -26,7 +26,7 @@ class PIFRClientDrupalTestCase extends PIFRClientPluginTestCase {
         'main' => array(
           'repository' => array(
             'type' => 'git',
-            'url' => 'git://git-dev.drupal.org/project/drupal',
+            'url' => variable_get('pifr_drupal_repository', 'git://git.drupal.org/project/drupal.git'),
           ),
           'vcs_identifier' => 'master',
         ),
@@ -50,14 +50,14 @@ class PIFRClientDrupalTestCase extends PIFRClientPluginTestCase {
           array(
             'repository' => array(
               'type' => 'git',
-              'url' => 'git://git-dev.drupal.org/project/simpletest',
+              'url' => variable_get('pifr_simpletest_repository', 'git://git.drupal.org/project/simpletest.git'),
             ),
             'vcs_identifier' => '7.x-2.x',
           ),
           array(
             'repository' => array(
               'type' => 'git',
-              'url' => 'git://git-dev.drupal.org/project/menu_rewrite',
+              'url' => variable_get('pifr_menu_rewrite_repository', 'git://git.drupal.org/project/menu_rewrite.git'),
             ),
             'vcs_identifier' => 'master',
           ),
diff --git a/review/simpletest/pifr_simpletest.client.inc b/review/simpletest/pifr_simpletest.client.inc
index 69065ca..48ad092 100644
--- a/review/simpletest/pifr_simpletest.client.inc
+++ b/review/simpletest/pifr_simpletest.client.inc
@@ -93,6 +93,7 @@ class pifr_client_review_pifr_simpletest extends pifr_client_review_pifr_drupal
 
     $b = new PIFRBrowser();
 
+    watchdog('pifr_client', 'Test in execution: ' . print_r($test, TRUE));
     // Login as admin.
     $user = new stdClass();
     $user->name = $this->admin_username;
diff --git a/server/pifr_server.admin.inc b/server/pifr_server.admin.inc
index d71d436..db0b531 100644
--- a/server/pifr_server.admin.inc
+++ b/server/pifr_server.admin.inc
@@ -102,7 +102,7 @@ function pifr_serveradmin_dashboard_form_queue_submit($form, &$form_state) {
     'client_identifier' => 3060, # this could be a random number
     'name' => 'Drupal',
     'repository_type' => 'git',   // GITMIGRATION fragile
-    'repository_url' => 'git://git-dev.drupal.org/project/drupal',
+    'repository_url' => variable_get('pifr_drupal_repository', 'git://git.drupal.org/project/drupal.git'),
   );
 
   module_load_include('xmlrpc.inc', 'pifr_server');
diff --git a/server/pifr_server.install b/server/pifr_server.install
index de36e1e..c8a65e1 100644
--- a/server/pifr_server.install
+++ b/server/pifr_server.install
@@ -414,14 +414,14 @@ function pifr_server_schema() {
         'default' => '',
       ),
       'repository_type' => array(
-        'description' => t('Repository type (currently only CVS).'),
+        'description' => t('Repository type.'),
         'type' => 'varchar',
         'not null' => TRUE,
         'length' => 32,
         'default' => '',
       ),
       'repository_url' => array(
-        'description' => t('Repository URL, pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal.'),
+        'description' => t('Repository URL, git://git.drupal.org/project/drupal.git'),
         'type' => 'varchar',
         'not null' => TRUE,
         'length' => 255,
-- 
1.7.0.4

