[Bps-public-commit] r14289 - in Pushmi/trunk: lib/Pushmi

clkao at bestpractical.com clkao at bestpractical.com
Fri Jul 18 16:59:31 EDT 2008


Author: clkao
Date: Fri Jul 18 16:58:40 2008
New Revision: 14289

Modified:
   Pushmi/trunk/lib/Pushmi/Test.pm
   Pushmi/trunk/t/basic.t
   Pushmi/trunk/t/verify.t

Log:
Make verify.t pass on both svn 1.4 and 1.5


Modified: Pushmi/trunk/lib/Pushmi/Test.pm
==============================================================================
--- Pushmi/trunk/lib/Pushmi/Test.pm	(original)
+++ Pushmi/trunk/lib/Pushmi/Test.pm	Fri Jul 18 16:58:40 2008
@@ -4,7 +4,7 @@
 use Pushmi::Config;
 
 use base 'Exporter';
-our @EXPORT = qw(get_dav_server run_pushmi is_svn_output start_memcached check_apache);
+our @EXPORT = qw(get_dav_server run_pushmi is_svn_output start_memcached check_apache svn_error_txn_outofdate svn_error_commit_hook);
 
 use FindBin;
 BEGIN {
@@ -158,6 +158,25 @@
 			 diag 'stopping memcached'; kill 'TERM', $memcached_pid if $memcached_pid };
 }
 
+sub svn_error_txn_outofdate {
+    my ($file, $txn) = @_;
+
+    my $rel_file = substr($file, 1);
+    return ("Out of date: '$rel_file' in transaction '$txn'")
+        if $SVN::Core::VERSION lt '1.5.0';
+
+    return "File '$file' is out of date";
+}
+
+sub svn_error_commit_hook {
+    my $exit_code = shift;
+
+    return ("svn: 'pre-commit' hook failed with error output:", @_)
+        if $SVN::Core::VERSION lt '1.5.0';
+
+    return ("svn: Commit blocked by pre-commit hook (exit code $exit_code) with output:", @_);
+}
+
 END {
     for (@CLEANUP) {
 	$_->();

Modified: Pushmi/trunk/t/basic.t
==============================================================================
--- Pushmi/trunk/t/basic.t	(original)
+++ Pushmi/trunk/t/basic.t	Fri Jul 18 16:58:40 2008
@@ -77,33 +77,12 @@
 is($repos->fs->youngest_rev, 4, "svn didn't commit through");
 append_file("fromsvn.txt", "to conflict\n");
 
-sub svn_error_txn_outofdate {
-    my ($file, $txn) = @_;
-
-    my $rel_file = substr($file, 1);
-    return ("Out of date: '$rel_file' in transaction '$txn'")
-        if $SVN::Core::VERSION lt '1.5.0';
-
-    return "File '$file' is out of date";
-}
-
-sub svn_error_commit_hook {
-    my ($exit_code, $file, $txn) = @_;
-
-    my $rel_file = substr($file, 1);
-    return ("svn: 'pre-commit' hook failed with error output:",
-            "Out of date: '$rel_file' in transaction '$txn'")
-        if $SVN::Core::VERSION lt '1.5.0';
-
-    return ("svn: Commit blocked by pre-commit hook (exit code $exit_code) with output:",
-            svn_error_txn_outofdate($file, $txn));
-}
-
 is_svn_output(['ci', -m => 'trying to commit outdated change from svn'],
 	      ['Sending        fromsvn.txt',
 	       'Transmitting file data .'],
 	      ['svn: Commit failed (details follow):',
-               svn_error_commit_hook(255, '/fromsvn.txt', '5-1'),
+               svn_error_commit_hook(255,
+                                     svn_error_txn_outofdate('/fromsvn.txt', '5-1')),
                '']);
 
 is($srepos->fs->youngest_rev, 5, "svn didn't commit through");

Modified: Pushmi/trunk/t/verify.t
==============================================================================
--- Pushmi/trunk/t/verify.t	(original)
+++ Pushmi/trunk/t/verify.t	Fri Jul 18 16:58:40 2008
@@ -98,9 +98,9 @@
 	      ['Sending        fromsvn.txt',
 	       'Transmitting file data .'],
 	      ['svn: Commit failed (details follow):',
-	       qr{svn: 'pre-commit' hook failed.*:},
-	       "Pushmi slave in inconsistency.  Please use the master repository at $uri",
-	       'and contact your administrator.  Sorry for the inconveniences.', '']);
+               svn_error_commit_hook(255,
+                                     "Pushmi slave in inconsistency.  Please use the master repository at $uri",
+                                     'and contact your administrator.  Sorry for the inconveniences.'), '']);
 
 
 END { return unless $$ == $pid; wait; unlink $lf; exit 0 }



More information about the Bps-public-commit mailing list