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

Revision: 114731
Author:   demon
Date:     2012-04-05 00:39:54 +0000 (Thu, 05 Apr 2012)
Log Message:
-----------
Initial overhaul to make make-wmf-branch work with git

Todo list:
* Implement $specialExtensions so we can snag the commit hash from the old 
branch
* Implement $patches so we can copy any hacks over (not needed for first deploy)
* Implement $preservedItems to be copied over from the old branch

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-05 00:33:22 UTC (rev 
114730)
+++ trunk/tools/make-wmf-branch/default.conf    2012-04-05 00:39:54 UTC (rev 
114731)
@@ -3,6 +3,7 @@
 # You can override variables in this file by creating a file in the same
 # directory called local.conf
 
+# These extensions are all pulling from HEAD on master
 $normalExtensions = array(
        'AbuseFilter',
        'ActiveAbstract', // Used as part of dumpBackup
@@ -10,6 +11,7 @@
        'AntiSpoof',
        'ApiSandbox',
        'ArticleFeedback',
+       'ArticleFeedbackv5',
        'AssertEdit',
        'Babel',
        'CategoryTree',
@@ -120,31 +122,20 @@
        'ZeroRatedMobileAccess',
 );
 
-# Extensions that we don't want to pull directly from the target branch
+# Extensions extensions that we want to copy their status from the previous 
branch
 $specialExtensions = array(
-       'ArticleFeedbackv5' => 
'^/branches/wmf/1.18wmf1/extensions/ArticleFeedbackv5',
+       # 'ArticleFeedbackv5',
 );
 
+# These items are copied from the old branch to the new one
 $preservedItems = array(
        'StartProfiler.php',
-       'extensions/FlaggedRevs/maintenance/wikimedia-periodic-update.sh',
 );
 
-$unwantedExternals = array(
-       'extensions/SyntaxHighlight_GeSHi',
-);
+$baseRepoPath = 'ssh://gerrit.wikimedia.org:29418/mediawiki';
 
-$destBaseUrl = 'svn+ssh://svn.wikimedia.org/svnroot/mediawiki/branches/wmf';
-$mainSourceUrl = '^/branches/REL1_19';
 $patches = array(
-       array( 'rev' => 97505, 'base' => '^/branches/wmf/1.18wmf1' ),
-       array( 'rev' => 97508, 'base' => '^/branches/wmf/1.18wmf1' ), // r96552 
part merged to trunk
-       array( 'rev' => 97509, 'base' => '^/branches/wmf/1.18wmf1' ),
-       array( 'rev' => 97512, 'base' => '^/branches/wmf/1.18wmf1' ),
-       array( 'rev' => 99928, 'base' => '^/branches/wmf/1.18wmf1' ),
-
-       //array( 'rev' => 111194, 'base' => '^/branches/wmf/1.19wmf1' ),
-       array( 'rev' => 112080, 'base' => '^/branches/wmf/1.19wmf1' ),
+       # array( 'rev' => 97505, 'base' => '^/branches/wmf/1.18wmf1' ),
 );
 
 $dryRun = false;

Modified: trunk/tools/make-wmf-branch/make-wmf-branch
===================================================================
--- trunk/tools/make-wmf-branch/make-wmf-branch 2012-04-05 00:33:22 UTC (rev 
114730)
+++ trunk/tools/make-wmf-branch/make-wmf-branch 2012-04-05 00:39:54 UTC (rev 
114731)
@@ -8,7 +8,7 @@
 
 if ( count( $argv ) < 3 ) {
        echo "Usage: make-wmf-branch <new-version> <old-version>\n";
-       echo "Example: make-wmf-branch 1.16wmf4 1.16wmf3\n";
+       echo "Example: make-wmf-branch 1.20r1 1.20r2\n";
        exit( 1 );
 }
 
@@ -20,31 +20,28 @@
 
 class MakeWmfBranch {
        var $dryRun;
-       var $newVersion, $oldVersion, $codeDir, $buildDir;
+       var $newVersion, $oldVersion, $buildDir;
        var $normalExtensions, $specialExtensions, $patches, $preservedItems;
-       var $destBaseUrl, $mainSourceUrl;
-       var $unwantedExternals;
+       var $baseRepoPath;
 
        function __construct( $newVersion, $oldVersion ) {
                $this->newVersion = $newVersion;
                $this->oldVersion = $oldVersion;
-               $this->codeDir = dirname( __FILE__ );
+               $codeDir = dirname( __FILE__ );
                $buildDir = sys_get_temp_dir() . '/make-wmf-branch';
 
-               require( "{$this->codeDir}/default.conf" );
-               if ( file_exists( "{$this->codeDir}/local.conf" ) ) {
-                       require( "{$this->codeDir}/local.conf" );
+               require( "{$codeDir}/default.conf" );
+               if ( file_exists( "{$codeDir}/local.conf" ) ) {
+                       require( "{$codeDir}/local.conf" );
                }
 
                $this->dryRun = $dryRun;
                $this->buildDir = $buildDir;
                $this->normalExtensions = $normalExtensions;
                $this->specialExtensions = $specialExtensions;
-               $this->unwantedExternals = $unwantedExternals;
                $this->patches = $patches;
                $this->preservedItems = $preservedItems;
-               $this->destBaseUrl = $destBaseUrl;
-               $this->mainSourceUrl = $mainSourceUrl;
+               $this->baseRepoPath = $baseRepoPath;
        }
 
        function runCmd( /*...*/ ) {
@@ -91,59 +88,50 @@
                }
                $this->chdir( $this->buildDir );
 
-               # Check out the parent directory of the target branch
-               $this->runCmd( 'svn', 'co', '--depth=empty', '--quiet', 
$this->destBaseUrl, 'wmf' );
+               # Clone the repository
+               $this->runCmd( 'git', 'clone', '-q', 
"{$this->baseRepoPath}/core.git", 'wmf' );
 
                $this->chdir( 'wmf' );
 
-               # Copy in phase3
-               $destRel = $this->newVersion;
-               $this->runCmd( 'svn', 'cp', '--quiet', 
"{$this->mainSourceUrl}/phase3", $destRel );
+               # Create a new branch from master and switch to it
+               $this->runCmd( 'git', 'checkout', '-q', '-b', 
"wmf/{$this->newVersion}" );
 
+               # Delete extensions/README and extensions/.gitignore
+               $this->runWriteCmd( 'git', 'rm', '-q', "extensions/README", 
"extensions/.gitignore" );
 
-               # Delete extensions/README
-               $this->runCmd( 'svn', 'rm', '--quiet', 
"$destRel/extensions/README" );
-
-               # Add normal extensions
+               # Add normal extension submodules
                foreach ( $this->normalExtensions as $name ) {
-                       $this->runCmd( 'svn', 'cp', '--ignore-externals', 
'--quiet',
-                               "{$this->mainSourceUrl}/extensions/$name",
-                               "$destRel/extensions/$name" );
+                       $this->runWriteCmd( 'git', 'submodule', 'add', '-q',
+                               "{$this->baseRepoPath}/extensions/{$name}.git", 
"extensions/$name" );
                }
 
-               # Add special extensions
+               # Add special extensions - TODO/FIXME
                foreach ( $this->specialExtensions as $name => $sourceUrl ) {
-                       $this->runCmd( 'svn', 'cp', '--ignore-externals', 
'--quiet',
-                               $sourceUrl,
-                               "$destRel/extensions/$name" );
+                       //      $this->runCmd( 'svn', 'cp', 
'--ignore-externals', '--quiet', $baseRepoPath,
+                       //              "extensions/$name" );
                }
 
-               # Copy in preserved items
+               # Copy in preserved items - TODO/FIXME
                foreach ( $this->preservedItems as $item ) {
-                       $this->runCmd( 'svn', 'cp', '--quiet',
-                               
"{$this->destBaseUrl}/{$this->oldVersion}/$item",
-                               dirname( "$destRel/$item" ) );
+                       //$this->runCmd( 'svn', 'cp', '--quiet',
+                       //      
"{$this->destBaseUrl}/{$this->oldVersion}/$item",
+                       //      dirname( "$item" ) );
                }
 
                # Do intermediate commit
-               $this->runWriteCmd( 'svn', 'ci', '-q', '-m', "Creating new WMF 
{$this->newVersion} branch" );
+               $this->runWriteCmd( 'git', 'commit', '-a', '-q', '-m', 
"Creating new WMF {$this->newVersion} branch" );
 
                # Fix $wgVersion
-               $this->fixVersion( "$destRel/includes/DefaultSettings.php" );
+               $this->fixVersion( "includes/DefaultSettings.php" );
 
-               # Apply patches
+               # Apply patches - TODO/FIXME
                foreach ( $this->patches as $patch ) {
-                       $this->runCmd( 'svn', 'merge', '-q', '-c', 
$patch['rev'], $patch['base'], $destRel );
+                       // $this->runCmd( 'svn', 'merge', '-q', '-c', 
$patch['rev'], $patch['base'], $destRel );
                }
 
-               # Remove unwanted externals
-               foreach ( $this->unwantedExternals as $external ) {
-                       $this->runCmd( 'svn', 'propdel', '-q', 'svn:externals', 
"$destRel/$external" );
-               }
-
                # Do the final commit
-               $this->runWriteCmd( 'svn', 'ci', '-q', '-m',
-                       "Applied local patches for new WMF {$this->newVersion} 
branch" );
+               $this->runWriteCmd( 'git', 'commit', '-a', '-m', '-q',
+                       "Applied patches to new WMF {$this->newVersion} branch" 
);
        }
 
        function fixVersion( $fileName ) {


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

Reply via email to