r79074 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r79073‎ | r79074 | r79075 >
Date:17:32, 27 December 2010
Author:reedy
Status:ok
Tags:
Comment:
Add dry-run mode to populateFollowupRevisions.php
Modified paths:
  • /trunk/extensions/CodeReview/populateFollowupRevisions.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/populateFollowupRevisions.php
@@ -12,6 +12,7 @@
1313 $this->mDescription = "Populates followup revisions. Useful for setting them on old revisions, without reimporting";
1414 $this->addArg( 'repo', 'The name of the repo. Cannot be all.' );
1515 $this->addArg( 'revisions', "The revisions to set status for. Format: start:end" );
 16+ $this->addOption( 'dry-run', 'Perform a dry run' );
1617 }
1718
1819 public function execute() {
@@ -38,6 +39,8 @@
3940
4041 $revisions = range( $start, $end );
4142
 43+ $dryrun = $this->hasOption( 'dry-run' );
 44+
4245 $dbr = wfGetDB( DB_SLAVE );
4346
4447 $res = $dbr->select( 'code_rev', '*', array( 'cr_id' => $revisions, 'cr_repo_id' => $repo->getId() ),
@@ -52,7 +55,10 @@
5356
5457 if ( count( $affectedRevs ) ) {
5558 $this->output( "associating revs " . implode( ',', $affectedRevs ) . "\n" );
56 - $rev->addReferencesTo( $affectedRevs );
 59+
 60+ if ( !$dryrun ) {
 61+ $rev->addReferencesTo( $affectedRevs );
 62+ }
5763 } else {
5864 $this->output( "no revisions followed up\n" );
5965 }

Status & tagging log