r112900 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112899‎ | r112900 | r112901 >
Date:15:49, 2 March 2012
Author:gwicke
Status:deferred
Tags:
Comment:
Namespaces to the rescue.
Modified paths:
  • /trunk/extensions/VisualEditor/tests/parser/dumpGrepper.js (modified) (history)

Diff [purge]

Index: trunk/extensions/VisualEditor/tests/parser/dumpGrepper.js
@@ -60,16 +60,18 @@
6161
6262 var reader = new dumpReader.DumpReader(),
6363 grepper = new DumpGrepper( re ),
64 - revisions = 0,
65 - matches = 0;
 64+ stats = {
 65+ revisions: 0,
 66+ matches: 0
 67+ };
6668
6769 reader.on( 'revision', function ( revision ) {
68 - revisions++;
 70+ stats.revisions++;
6971 grepper.grepRev( revision );
7072 } );
7173
7274 grepper.on( 'match', function ( revision, matches ) {
73 - matches++;
 75+ stats.matches++;
7476 for ( var i = 0, l = matches.length; i < l; i++ ) {
7577 console.log( '== Match: [[' + revision.page.title + ']] ==' );
7678 var m = matches[i];
@@ -91,14 +93,14 @@
9294 process.stdin.on ( 'end' , function() {
9395 // Print some stats
9496 console.log( '################################################' );
95 - console.log( 'Total revisions: ' + revisions );
96 - console.log( 'Total matches: ' + matches );
97 - console.log( 'Ratio: ' + (matches / revisions * 100) + '%' );
 97+ console.log( 'Total revisions: ' + stats.revisions );
 98+ console.log( 'Total matches: ' + stats.matches );
 99+ console.log( 'Ratio: ' + (stats.matches / stats.revisions * 100) + '%' );
98100 console.log( '################################################' );
99101 } );
100102
 103+ process.stdin.on('data', reader.push.bind(reader) );
101104 process.stdin.setEncoding('utf8');
102 - process.stdin.on('data', reader.push.bind(reader) );
103105 process.stdin.resume();
104106
105107

Status & tagging log