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

Revision: 114826
Author:   demon
Date:     2012-04-10 18:58:34 +0000 (Tue, 10 Apr 2012)
Log Message:
-----------
Make it possible to branch certain extensions so we can maintain live hacks for 
them. 

I'm going on the record as saying this feels dirty :\

Modified Paths:
--------------
    trunk/tools/make-wmf-branch/default.conf
    trunk/tools/make-wmf-branch/make-wmf-branch

Modified: trunk/tools/make-wmf-branch/default.conf
===================================================================
--- trunk/tools/make-wmf-branch/default.conf    2012-04-10 18:28:53 UTC (rev 
114825)
+++ trunk/tools/make-wmf-branch/default.conf    2012-04-10 18:58:34 UTC (rev 
114826)
@@ -46,7 +46,6 @@
        'ExpandTemplates',
        'ExtensionDistributor',
        'FeaturedFeeds',
-       'FlaggedRevs',
        'FormPreloadPostCache', // Foundation wiki
        'FundraiserLandingPage',
        'Gadgets',
@@ -129,6 +128,12 @@
        # 'ArticleFeedbackv5' => true,
 );
 
+# Branched extensions - these extensions are branched along with core since 
we've got
+# to maintain live hacks for them. 
+$branchedExtensions = array(
+       'FlaggedRevs',
+);
+
 # These items are copied from the old branch to the new one
 $preservedItems = array(
        'StartProfiler.php',

Modified: trunk/tools/make-wmf-branch/make-wmf-branch
===================================================================
--- trunk/tools/make-wmf-branch/make-wmf-branch 2012-04-10 18:28:53 UTC (rev 
114825)
+++ trunk/tools/make-wmf-branch/make-wmf-branch 2012-04-10 18:58:34 UTC (rev 
114826)
@@ -21,7 +21,7 @@
 class MakeWmfBranch {
        var $dryRun;
        var $newVersion, $oldVersion, $buildDir;
-       var $normalExtensions, $specialExtensions, $patches, $preservedItems;
+       var $normalExtensions, $specialExtensions, $branchedExtensions, 
$patches, $preservedItems;
        var $baseRepoPath;
 
        function __construct( $newVersion, $oldVersion ) {
@@ -39,6 +39,7 @@
                $this->buildDir = $buildDir;
                $this->normalExtensions = $normalExtensions;
                $this->specialExtensions = $specialExtensions;
+               $this->branchedExtensions = $branchedExtensions;
                $this->patches = $patches;
                $this->preservedItems = $preservedItems;
                $this->baseRepoPath = $baseRepoPath;
@@ -80,6 +81,12 @@
        }
 
        function execute() {
+               $this->setupBuildDirectory();
+               $this->branchExtensions();
+               $this->branchWmf();
+       }
+
+       function setupBuildDirectory() {
                # Create a temporary build directory
                if ( file_exists( $this->buildDir ) ) {
                        $this->runCmd( 'rm', '-rf', '--', $this->buildDir );
@@ -88,13 +95,26 @@
                        $this->croak( "Unable to create build directory 
{$this->buildDir}" );
                }
                $this->chdir( $this->buildDir );
+       }
+       
+       function branchExtensions() {
+               foreach( $this->branchedExtensions as $ext ) {
+                       $this->runCmd( 'git', 'clone', '-q', 
"{$this->baseRepoPath}/extensions/{$ext}.git", $ext );
+                       $this->chdir( "$ext" );
+                       $newVersion = $this->branchPrefix . $this->newVersion;
+                       $this->runCmd( 'git', 'branch', $newVersion );
+                       $this->runWriteCmd( 'git', 'push', 'origin', 
$newVersion );
+                       $this->chdir( $this->buildDir );
+               }
+       }
 
+       function branchWmf() {
                # Clone the repository
                $oldVersion = $this->oldVersion == 'master' ? 'master' : 
$this->branchPrefix . $this->oldVersion;
                $this->runCmd( 'git', 'clone', '-q', 
"{$this->baseRepoPath}/core.git", '-b', $oldVersion, 'wmf' );
 
                $this->chdir( 'wmf' );
-               
+
                # Look for the extensions we want to preserve the old branch's 
state
                $preservedRefs = array();
                foreach( $this->specialExtensions as $name => $copy ) {
@@ -124,7 +144,7 @@
                $this->runWriteCmd( 'git', 'rm', '-q', "extensions/README", 
"extensions/.gitignore" );
 
                # Add extension submodules
-               foreach ( array_merge( $this->normalExtensions, 
$this->specialExtensions ) as $name ) {
+               foreach ( array_merge( $this->normalExtensions, 
$this->specialExtensions, $this->branchedExtensions ) as $name ) {
                        $this->runWriteCmd( 'git', 'submodule', 'add', '-q',
                                "{$this->baseRepoPath}/extensions/{$name}.git", 
"extensions/$name" );
                        if( isset( $preservedRefs[$name] ) ) {


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

Reply via email to