Index: trunk/extensions/CodeReview/populateFollowupRevisions.php |
— | — | @@ -12,6 +12,7 @@ |
13 | 13 | $this->mDescription = "Populates followup revisions. Useful for setting them on old revisions, without reimporting"; |
14 | 14 | $this->addArg( 'repo', 'The name of the repo. Cannot be all.' ); |
15 | 15 | $this->addArg( 'revisions', "The revisions to set status for. Format: start:end" ); |
| 16 | + $this->addOption( 'dry-run', 'Perform a dry run' ); |
16 | 17 | } |
17 | 18 | |
18 | 19 | public function execute() { |
— | — | @@ -38,6 +39,8 @@ |
39 | 40 | |
40 | 41 | $revisions = range( $start, $end ); |
41 | 42 | |
| 43 | + $dryrun = $this->hasOption( 'dry-run' ); |
| 44 | + |
42 | 45 | $dbr = wfGetDB( DB_SLAVE ); |
43 | 46 | |
44 | 47 | $res = $dbr->select( 'code_rev', '*', array( 'cr_id' => $revisions, 'cr_repo_id' => $repo->getId() ), |
— | — | @@ -52,7 +55,10 @@ |
53 | 56 | |
54 | 57 | if ( count( $affectedRevs ) ) { |
55 | 58 | $this->output( "associating revs " . implode( ',', $affectedRevs ) . "\n" ); |
56 | | - $rev->addReferencesTo( $affectedRevs ); |
| 59 | + |
| 60 | + if ( !$dryrun ) { |
| 61 | + $rev->addReferencesTo( $affectedRevs ); |
| 62 | + } |
57 | 63 | } else { |
58 | 64 | $this->output( "no revisions followed up\n" ); |
59 | 65 | } |