Author: jkeenan
Date: Tue May  1 20:35:29 2007
New Revision: 18387

Modified:
   branches/reconfigure/config/gen/revision.pm
   branches/reconfigure/lib/Parrot/Revision.pm
   branches/reconfigure/t/configure/18-revision_no_DEVELOPING.t
   branches/reconfigure/t/postconfigure/03-revision_no_DEVELOPING.t

Log:
1.  Following discussion with particle in RT 42360, eliminated $svn_entries
and 1 stanza from lib/Parrot/Revision.pm and from config/gen/revision.pm.
2.  Revised tests t/configure/18-revision_no_DEVELOPING.t and
t/postconfigure/03-revision_no_DEVELOPING.t to use temporary
directories to fake non-existence of file DEVELOPING during testing.


Modified: branches/reconfigure/config/gen/revision.pm
==============================================================================
--- branches/reconfigure/config/gen/revision.pm (original)
+++ branches/reconfigure/config/gen/revision.pm Tue May  1 20:35:29 2007
@@ -28,11 +28,9 @@
     my ( $self, $conf ) = @_;
 
     my $revision = $Parrot::Revision::current;
-    my $entries  = $Parrot::Revision::svn_entries;
 
     $conf->data->set(
         revision    => $revision,
-        SVN_ENTRIES => $entries
     );
 
     if ( $revision >= 1 ) {

Modified: branches/reconfigure/lib/Parrot/Revision.pm
==============================================================================
--- branches/reconfigure/lib/Parrot/Revision.pm (original)
+++ branches/reconfigure/lib/Parrot/Revision.pm Tue May  1 20:35:29 2007
@@ -24,8 +24,6 @@
 use warnings;
 use File::Spec;
 
-our $svn_entries = undef;
-
 sub __get_revision {
     return 0 unless ( -e 'DEVELOPING' );
 
@@ -38,16 +36,6 @@
             ($revision) = $line =~ / (\d+)$/;
         }
     }
-    elsif ( defined $svn_entries and -r $svn_entries ) {
-        open my $FH, '<', $svn_entries
-            or die "Unable to open file ($svn_entries). Aborting. Error 
returned was: $!";
-        while (<$FH>) {
-            /^ *committed-rev=.(\d+)./ or next;
-            $revision = $1;
-            last;
-        }
-        close $FH;
-    }
     elsif ( my @svk_info = qx/svk info 2>$nul/ and $? == 0 ) {
         if ( my ($line) = grep /(?:file|svn|https?)\b/, @svk_info ) {
             ($revision) = $line =~ / (\d+)$/;

Modified: branches/reconfigure/t/configure/18-revision_no_DEVELOPING.t
==============================================================================
--- branches/reconfigure/t/configure/18-revision_no_DEVELOPING.t        
(original)
+++ branches/reconfigure/t/configure/18-revision_no_DEVELOPING.t        Tue May 
 1 20:35:29 2007
@@ -6,7 +6,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 10;
+use Test::More tests => 13;
 use Carp;
 use_ok( 'Cwd' );
 use_ok( 'File::Copy' );
@@ -21,12 +21,18 @@
     'Either file DEVELOPING does not exist or configuration has completed (as 
evidenced by existence of Parrot::Config::Generated';
 
 SKIP: {
-    skip $reason, 6 if (
+    skip $reason,  9 if (
         (not -e 'DEVELOPING')
         or
         ( -e q{lib/Parrot/Config/Generated.pm} )
     );
-    ok(move('DEVELOPING', 'xDEVELOPING'), "temporarily renaming DEVELOPING");
+    my $tdir = tempdir();
+    ok(chdir $tdir, "Changed to temporary directory for testing");
+    ok((mkdir "lib"), "Able to make directory lib");
+    ok((mkdir "lib/Parrot"), "Able to make directory lib/Parrot");
+    ok(copy ("$cwd/lib/Parrot/Revision.pm", "lib/Parrot/"),
+        "Able to copy Parrot::Revision for testing");
+    unshift(@INC, "lib");
     require Parrot::Revision;
     no warnings qw(once);
     $current = $Parrot::Revision::current;
@@ -36,7 +42,7 @@
     like($config, qr/^\d+$/, "current revision is all numeric");
     is($current, $config, "current and config are identical");
     is($current, 0, 'current is zero as expected');
-    ok(move('xDEVELOPING', 'DEVELOPING'), "restoring DEVELOPING");
+    ok(chdir $cwd, "Able to change back to directory after testing");
 }
 
 # Case 3:  DEVELOPING exists; Parrot::Config available.

Modified: branches/reconfigure/t/postconfigure/03-revision_no_DEVELOPING.t
==============================================================================
--- branches/reconfigure/t/postconfigure/03-revision_no_DEVELOPING.t    
(original)
+++ branches/reconfigure/t/postconfigure/03-revision_no_DEVELOPING.t    Tue May 
 1 20:35:29 2007
@@ -6,7 +6,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 10;
+use Test::More tests => 16;
 use Carp;
 use_ok( 'Cwd' );
 use_ok( 'File::Copy' );
@@ -21,12 +21,24 @@
     'Either file DEVELOPING does not exist or configuration has not completed 
(as evidenced by non-existence of Parrot::Config::Generated'; 
 
 SKIP: {
-    skip $reason, 6 if (
+    skip $reason, 12 if (
         (not -e 'DEVELOPING')
         or
         (not -e q{lib/Parrot/Config/Generated.pm} )
     );
-    ok(move('DEVELOPING', 'xDEVELOPING'), "temporarily renaming DEVELOPING");
+    my $tdir = tempdir();
+    ok(chdir $tdir, "Changed to temporary directory for testing");
+    ok((mkdir "lib"), "Able to make directory lib");
+    ok((mkdir "lib/Parrot"), "Able to make directory lib/Parrot");
+    ok((mkdir "lib/Parrot/Config"),
+        "Able to make directory lib/Parrot/Config");
+    ok(copy ("$cwd/lib/Parrot/Revision.pm", "lib/Parrot/"),
+        "Able to copy Parrot::Revision for testing");
+    ok(copy ("$cwd/lib/Parrot/Config.pm", "lib/Parrot/"),
+        "Able to copy Parrot::Config for testing");
+    ok(copy ("$cwd/lib/Parrot/Config/Generated.pm", "lib/Parrot/Config/"),
+        "Able to copy Parrot::Config::Generated for testing");
+    unshift(@INC, "lib");
     require Parrot::Revision;
     no warnings qw(once);
     $current = $Parrot::Revision::current;
@@ -37,7 +49,7 @@
     use warnings;
     like($config, qr/^\d+$/, "current revision is all numeric");
     isnt($current, $config, "current and config differ");
-    ok(move('xDEVELOPING', 'DEVELOPING'), "restoring DEVELOPING");
+    ok(chdir $cwd, "Able to change back to directory after testing");
 }
 
 pass("Completed all tests in $0");

Reply via email to