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

Revision: 114753
Author:   demon
Date:     2012-04-05 23:00:07 +0000 (Thu, 05 Apr 2012)
Log Message:
-----------
Take care of "use whatever state was in the old branch"
for extensions

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-05 22:46:51 UTC (rev 
114752)
+++ trunk/tools/make-wmf-branch/make-wmf-branch 2012-04-05 23:00:07 UTC (rev 
114753)
@@ -89,9 +89,20 @@
                $this->chdir( $this->buildDir );
 
                # Clone the repository
-               $this->runCmd( 'git', 'clone', '-q', 
"{$this->baseRepoPath}/core.git", 'wmf' );
+               $this->runCmd( 'git', 'clone', '-q', 
"{$this->baseRepoPath}/core.git", '-b', $this->oldVersion, 'wmf' );
 
                $this->chdir( 'wmf' );
+               
+               # Look for the extensions we want to preserve the old branch's 
state
+               $preservedRefs = array();
+               if( $this->oldVersion != 'master' ) {
+                       foreach( $this->specialExtensions as $name ) {
+                               if( !file_exists( "extensions/$name" ) ) {
+                                       $this->croak( "Trying to copy state of 
extension ($name) that doesn't exist in the old branch ({$this->oldVersion})" );
+                               }
+                               $preservedRefs[$name] = file_get_contents( 
"extensions/$name" );
+                       }
+               }
 
                # Create a new branch from master and switch to it
                $this->runCmd( 'git', 'checkout', '-q', '-b', 
"{$this->newVersion}" );
@@ -99,18 +110,15 @@
                # Delete extensions/README and extensions/.gitignore
                $this->runWriteCmd( 'git', 'rm', '-q', "extensions/README", 
"extensions/.gitignore" );
 
-               # Add normal extension submodules
-               foreach ( $this->normalExtensions as $name ) {
+               # Add extension submodules
+               foreach ( array_merge( $this->normalExtensions, 
$this->specialExtensions ) as $name ) {
                        $this->runWriteCmd( 'git', 'submodule', 'add', '-q',
                                "{$this->baseRepoPath}/extensions/{$name}.git", 
"extensions/$name" );
+                       if( isset( $preservedRefs[$name] ) ) {
+                               file_put_contents( "extensions/$name", 
$preservedRefs[$name] ); 
+                       }
                }
 
-               # Add special extensions - TODO/FIXME
-               foreach ( $this->specialExtensions as $name => $sourceUrl ) {
-                       //      $this->runCmd( 'svn', 'cp', 
'--ignore-externals', '--quiet', $baseRepoPath,
-                       //              "extensions/$name" );
-               }
-
                # Copy in preserved items - TODO/FIXME
                foreach ( $this->preservedItems as $item ) {
                        //$this->runCmd( 'svn', 'cp', '--quiet',


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

Reply via email to