https://www.mediawiki.org/wiki/Special:Code/MediaWiki/114782

Revision: 114782
Author:   demon
Date:     2012-04-06 22:31:09 +0000 (Fri, 06 Apr 2012)
Log Message:
-----------
More robust error detection for when you misconfigure

Modified Paths:
--------------
    trunk/tools/make-wmf-branch/make-wmf-branch

Modified: trunk/tools/make-wmf-branch/make-wmf-branch
===================================================================
--- trunk/tools/make-wmf-branch/make-wmf-branch 2012-04-06 22:05:35 UTC (rev 
114781)
+++ trunk/tools/make-wmf-branch/make-wmf-branch 2012-04-06 22:31:09 UTC (rev 
114782)
@@ -97,16 +97,22 @@
                
                # Look for the extensions we want to preserve the old branch's 
state
                $preservedRefs = array();
-               if( $this->oldVersion != 'master' ) {
-                       foreach( $this->specialExtensions as $name => $copy ) {
-                               if( !file_exists( "extensions/$name" ) && $copy 
=== true ) {
-                                       $this->croak( "Trying to copy state of 
extension ($name) that doesn't exist in the old branch ({$this->oldVersion})" );
-                               }
-                               if( $copy === true ) {
+               foreach( $this->specialExtensions as $name => $copy ) {
+                       if( $copy === true ) {
+                               if( $this->oldVersion == 'master' ) {
+                                       // There's nothing to copy in this 
instance, if you're trying
+                                       // pin while oldVersion is master then 
use sha1's instead of true
+                                       continue;
+                               } elseif( file_exists( "extension/$name" ) ) {
                                        $preservedRefs[$name] = 
file_get_contents( "extensions/$name" );
-                               } elseif( is_string( $copy ) ) {
-                                       $preservedRefs[$name] = "Subproject 
commit $copy";
+                               } else {
+                                       $this->croak( "Extension ($name) wants 
to copy from the old branch "
+                                               . "but it doesn't exist there. 
Check configuration."
                                }
+                       } elseif( is_string( $copy ) ) {
+                               $preservedRefs[$name] = "Subproject commit 
$copy";
+                       } else {
+                               $this->croak( "Extension ($name) misconfigured. 
Don't know how to proceed." );
                        }
                }
 


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to