7c6f58351f5c3321627e7c4020b2c5f9d8336c7b galt Wed Mar 3 17:34:20 2010 -0800 fixed colors, fixed counts on new files when there is no context line to finish the block, fixed bug in output of git show in diff part where odd and variable extra context appeared after @@ .* @@, currently just using sed to trim the diff file so html file inherits automatically diff --git git-reports.c git-reports.c index 4cdd62f..07e56ee 100644 --- git-reports.c +++ git-reports.c @@ -196,7 +196,7 @@ xline = htmlEncode(line); if (line[0] == '-') { - fprintf(h, "<span style=\"background-color:yellow\">%s</span>\n", xline); + fprintf(h, "<span style=\"background-color:#FF9999\">%s</span>\n", xline); if (inBody) { inBlock = TRUE; @@ -205,7 +205,7 @@ } else if (line[0] == '+') { - fprintf(h, "<span style=\"background-color:cyan\">%s</span>\n", xline); + fprintf(h, "<span style=\"background-color:#99FF99\">%s</span>\n", xline); if (inBody) { inBlock = TRUE; @@ -214,7 +214,10 @@ } else { - fprintf(h, "<span style=\"background-color:white\">%s</span>\n", xline); + if (line[0] == '@') + fprintf(h, "<span style=\"background-color:#FFFF99\">%s</span>\n", xline); + else + fprintf(h, "%s\n", xline); if (inBody) { if (inBlock) @@ -236,6 +239,20 @@ freeMem(xline); } +// what if there is no last trailing line to end the last block? +if (inBody) + { + if (inBlock) + { + inBlock = FALSE; + if (blockP >= blockN) + linesChanged += blockP; + else + linesChanged += blockN; + blockP = 0; + blockN = 0; + } + } lineFileClose(&lf); fprintf(h, "</pre>\n</body>\n</html>\n"); @@ -309,7 +326,7 @@ cDiff = cloneString(path); uglyf("path=%s\n", path); - safef(gitCmd,sizeof(gitCmd), "" + safef(gitCmd,sizeof(gitCmd), "git show %s %s > %s" , c->commitId, f->path, cDiff); uglyf("gitCmd=%s\n", gitCmd); @@ -317,6 +334,17 @@ // TODO error handling + // we need a lame work-around with this version of git + // because there is odd and varying unwanted context text after @@ --- @@ in diff output + safef(gitCmd,sizeof(gitCmd), "" + "sed -i -e 's/\\(^@@ .* @@\\).*/\\1/' %s", + cDiff); + uglyf("sedCmd=%s\n", gitCmd); + system(gitCmd); + // TODO error handling + + + // make context html page f->linesChanged = makeHtml(cDiff, cHtml, f->path, c->commitId); userLinesChanged += f->linesChanged; @@ -355,6 +383,15 @@ //git show --unified=10000 11a20b6cd113d75d84549eb642b7f2ac7a2594fe src/utils/qa/weeklybld/buildEnv.csh + // we need a lame work-around with this version of git + // because there is odd and varying unwanted context text after @@ --- @@ in diff output + safef(gitCmd,sizeof(gitCmd), "" + "sed -i -e 's/\\(^@@ .* @@\\).*/\\1/' %s", + fDiff); + uglyf("sedCmd=%s\n", gitCmd); + system(gitCmd); + // TODO error handling + // make full html page makeHtml(fDiff, fHtml, f->path, c->commitId); @@ -468,7 +505,7 @@ userChangedFiles = 0; // DEBUG REMOVE - //if (sameString(u->name, "galt")) + if (sameString(u->name, "galt")) /* make user's reports */ doUser(u->name, commits, &userChangedLines, &userChangedFiles);