r23041 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r23040‎ | r23041 | r23042 >
Date:02:09, 17 June 2007
Author:greg
Status:old
Tags:
Comment:
Add checks for common comma errors.
Modified paths:
  • /trunk/phase3/maintenance/postgres/compare_schemas.pl (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/postgres/compare_schemas.pl
@@ -155,7 +155,7 @@
156156 );
157157 $dtype = qr{($dtype)};
158158 my %new;
159 -my ($infunction,$inview,$inrule) = (0,0,0);
 159+my ($infunction,$inview,$inrule,$lastcomma) = (0,0,0,0);
160160 seek $newfh, 0, 0;
161161 while (<$newfh>) {
162162 next if /^\s*\-\-/ or /^\s*$/;
@@ -190,11 +190,19 @@
191191 if (/^CREATE TABLE "?(\w+)"? \($/) {
192192 $table = $1;
193193 $new{$table}{name}=$table;
 194+ $lastcomma = 1;
194195 }
195196 elsif (/^\);$/) {
 197+ if ($lastcomma) {
 198+ warn "Stray comma before line $.\n";
 199+ }
196200 }
197 - elsif (/^ (\w+) +$dtype/) {
 201+ elsif (/^ (\w+) +$dtype.*?(,?)(?: --.*)?$/) {
198202 $new{$table}{column}{$1} = $2;
 203+ if (!$lastcomma) {
 204+ print "Missing comma before line $. of $new\n";
 205+ }
 206+ $lastcomma = $3 ? 1 : 0;
199207 }
200208 else {
201209 die "Cannot parse line $. of $new:\n$_\n";

Follow-up revisions

RevisionCommit summaryAuthorDate
r23050Merged revisions 23038-23049 via svnmerge from...david00:01, 18 June 2007

Status & tagging log