r114731 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r114730‎ | r114731 | r114732 >
Date:00:39, 5 April 2012
Author:demon
Status:new
Tags:
Comment:
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 (modified) (history)
  • /trunk/tools/make-wmf-branch/make-wmf-branch (modified) (history)

Diff [purge]

Index: trunk/tools/make-wmf-branch/make-wmf-branch
@@ -8,7 +8,7 @@
99
1010 if ( count( $argv ) < 3 ) {
1111 echo "Usage: make-wmf-branch <new-version> <old-version>\n";
12 - echo "Example: make-wmf-branch 1.16wmf4 1.16wmf3\n";
 12+ echo "Example: make-wmf-branch 1.20r1 1.20r2\n";
1313 exit( 1 );
1414 }
1515
@@ -20,31 +20,28 @@
2121
2222 class MakeWmfBranch {
2323 var $dryRun;
24 - var $newVersion, $oldVersion, $codeDir, $buildDir;
 24+ var $newVersion, $oldVersion, $buildDir;
2525 var $normalExtensions, $specialExtensions, $patches, $preservedItems;
26 - var $destBaseUrl, $mainSourceUrl;
27 - var $unwantedExternals;
 26+ var $baseRepoPath;
2827
2928 function __construct( $newVersion, $oldVersion ) {
3029 $this->newVersion = $newVersion;
3130 $this->oldVersion = $oldVersion;
32 - $this->codeDir = dirname( __FILE__ );
 31+ $codeDir = dirname( __FILE__ );
3332 $buildDir = sys_get_temp_dir() . '/make-wmf-branch';
3433
35 - require( "{$this->codeDir}/default.conf" );
36 - if ( file_exists( "{$this->codeDir}/local.conf" ) ) {
37 - require( "{$this->codeDir}/local.conf" );
 34+ require( "{$codeDir}/default.conf" );
 35+ if ( file_exists( "{$codeDir}/local.conf" ) ) {
 36+ require( "{$codeDir}/local.conf" );
3837 }
3938
4039 $this->dryRun = $dryRun;
4140 $this->buildDir = $buildDir;
4241 $this->normalExtensions = $normalExtensions;
4342 $this->specialExtensions = $specialExtensions;
44 - $this->unwantedExternals = $unwantedExternals;
4543 $this->patches = $patches;
4644 $this->preservedItems = $preservedItems;
47 - $this->destBaseUrl = $destBaseUrl;
48 - $this->mainSourceUrl = $mainSourceUrl;
 45+ $this->baseRepoPath = $baseRepoPath;
4946 }
5047
5148 function runCmd( /*...*/ ) {
@@ -91,59 +88,50 @@
9289 }
9390 $this->chdir( $this->buildDir );
9491
95 - # Check out the parent directory of the target branch
96 - $this->runCmd( 'svn', 'co', '--depth=empty', '--quiet', $this->destBaseUrl, 'wmf' );
 92+ # Clone the repository
 93+ $this->runCmd( 'git', 'clone', '-q', "{$this->baseRepoPath}/core.git", 'wmf' );
9794
9895 $this->chdir( 'wmf' );
9996
100 - # Copy in phase3
101 - $destRel = $this->newVersion;
102 - $this->runCmd( 'svn', 'cp', '--quiet', "{$this->mainSourceUrl}/phase3", $destRel );
 97+ # Create a new branch from master and switch to it
 98+ $this->runCmd( 'git', 'checkout', '-q', '-b', "wmf/{$this->newVersion}" );
10399
 100+ # Delete extensions/README and extensions/.gitignore
 101+ $this->runWriteCmd( 'git', 'rm', '-q', "extensions/README", "extensions/.gitignore" );
104102
105 - # Delete extensions/README
106 - $this->runCmd( 'svn', 'rm', '--quiet', "$destRel/extensions/README" );
107 -
108 - # Add normal extensions
 103+ # Add normal extension submodules
109104 foreach ( $this->normalExtensions as $name ) {
110 - $this->runCmd( 'svn', 'cp', '--ignore-externals', '--quiet',
111 - "{$this->mainSourceUrl}/extensions/$name",
112 - "$destRel/extensions/$name" );
 105+ $this->runWriteCmd( 'git', 'submodule', 'add', '-q',
 106+ "{$this->baseRepoPath}/extensions/{$name}.git", "extensions/$name" );
113107 }
114108
115 - # Add special extensions
 109+ # Add special extensions - TODO/FIXME
116110 foreach ( $this->specialExtensions as $name => $sourceUrl ) {
117 - $this->runCmd( 'svn', 'cp', '--ignore-externals', '--quiet',
118 - $sourceUrl,
119 - "$destRel/extensions/$name" );
 111+ // $this->runCmd( 'svn', 'cp', '--ignore-externals', '--quiet', $baseRepoPath,
 112+ // "extensions/$name" );
120113 }
121114
122 - # Copy in preserved items
 115+ # Copy in preserved items - TODO/FIXME
123116 foreach ( $this->preservedItems as $item ) {
124 - $this->runCmd( 'svn', 'cp', '--quiet',
125 - "{$this->destBaseUrl}/{$this->oldVersion}/$item",
126 - dirname( "$destRel/$item" ) );
 117+ //$this->runCmd( 'svn', 'cp', '--quiet',
 118+ // "{$this->destBaseUrl}/{$this->oldVersion}/$item",
 119+ // dirname( "$item" ) );
127120 }
128121
129122 # Do intermediate commit
130 - $this->runWriteCmd( 'svn', 'ci', '-q', '-m', "Creating new WMF {$this->newVersion} branch" );
 123+ $this->runWriteCmd( 'git', 'commit', '-a', '-q', '-m', "Creating new WMF {$this->newVersion} branch" );
131124
132125 # Fix $wgVersion
133 - $this->fixVersion( "$destRel/includes/DefaultSettings.php" );
 126+ $this->fixVersion( "includes/DefaultSettings.php" );
134127
135 - # Apply patches
 128+ # Apply patches - TODO/FIXME
136129 foreach ( $this->patches as $patch ) {
137 - $this->runCmd( 'svn', 'merge', '-q', '-c', $patch['rev'], $patch['base'], $destRel );
 130+ // $this->runCmd( 'svn', 'merge', '-q', '-c', $patch['rev'], $patch['base'], $destRel );
138131 }
139132
140 - # Remove unwanted externals
141 - foreach ( $this->unwantedExternals as $external ) {
142 - $this->runCmd( 'svn', 'propdel', '-q', 'svn:externals', "$destRel/$external" );
143 - }
144 -
145133 # Do the final commit
146 - $this->runWriteCmd( 'svn', 'ci', '-q', '-m',
147 - "Applied local patches for new WMF {$this->newVersion} branch" );
 134+ $this->runWriteCmd( 'git', 'commit', '-a', '-m', '-q',
 135+ "Applied patches to new WMF {$this->newVersion} branch" );
148136 }
149137
150138 function fixVersion( $fileName ) {
Index: trunk/tools/make-wmf-branch/default.conf
@@ -3,6 +3,7 @@
44 # You can override variables in this file by creating a file in the same
55 # directory called local.conf
66
 7+# These extensions are all pulling from HEAD on master
78 $normalExtensions = array(
89 'AbuseFilter',
910 'ActiveAbstract', // Used as part of dumpBackup
@@ -10,6 +11,7 @@
1112 'AntiSpoof',
1213 'ApiSandbox',
1314 'ArticleFeedback',
 15+ 'ArticleFeedbackv5',
1416 'AssertEdit',
1517 'Babel',
1618 'CategoryTree',
@@ -120,31 +122,20 @@
121123 'ZeroRatedMobileAccess',
122124 );
123125
124 -# Extensions that we don't want to pull directly from the target branch
 126+# Extensions extensions that we want to copy their status from the previous branch
125127 $specialExtensions = array(
126 - 'ArticleFeedbackv5' => '^/branches/wmf/1.18wmf1/extensions/ArticleFeedbackv5',
 128+ # 'ArticleFeedbackv5',
127129 );
128130
 131+# These items are copied from the old branch to the new one
129132 $preservedItems = array(
130133 'StartProfiler.php',
131 - 'extensions/FlaggedRevs/maintenance/wikimedia-periodic-update.sh',
132134 );
133135
134 -$unwantedExternals = array(
135 - 'extensions/SyntaxHighlight_GeSHi',
136 -);
 136+$baseRepoPath = 'ssh://gerrit.wikimedia.org:29418/mediawiki';
137137
138 -$destBaseUrl = 'svn+ssh://svn.wikimedia.org/svnroot/mediawiki/branches/wmf';
139 -$mainSourceUrl = '^/branches/REL1_19';
140138 $patches = array(
141 - array( 'rev' => 97505, 'base' => '^/branches/wmf/1.18wmf1' ),
142 - array( 'rev' => 97508, 'base' => '^/branches/wmf/1.18wmf1' ), // r96552 part merged to trunk
143 - array( 'rev' => 97509, 'base' => '^/branches/wmf/1.18wmf1' ),
144 - array( 'rev' => 97512, 'base' => '^/branches/wmf/1.18wmf1' ),
145 - array( 'rev' => 99928, 'base' => '^/branches/wmf/1.18wmf1' ),
146 -
147 - //array( 'rev' => 111194, 'base' => '^/branches/wmf/1.19wmf1' ),
148 - array( 'rev' => 112080, 'base' => '^/branches/wmf/1.19wmf1' ),
 139+ # array( 'rev' => 97505, 'base' => '^/branches/wmf/1.18wmf1' ),
149140 );
150141
151142 $dryRun = false;