3e56f626ffaea1abffd715356ebacea45c7a1f70 galt Wed Mar 3 23:16:47 2010 -0800 adding all-files view diff --git git-reports.c git-reports.c index b344e5d..593ed4e 100644 --- git-reports.c +++ git-reports.c @@ -457,23 +457,32 @@ /* process one user's files-view (or all if u is NULL) */ { -// TODO handle u is NULL // http://hgwdev.cse.ucsc.edu/cvs-reports/branch/user/galt/index-by-file.html +// if u is NULL +// http://hgwdev.cse.ucsc.edu/cvs-reports/branch/file/index.html char userPath[1024]; +if (u) safef(userPath, sizeof(userPath), "%s/%s/%s/%s/index-by-file.html", outDir, outPrefix, "user", u); +else + safef(userPath, sizeof(userPath), "%s/%s/%s/index.html", outDir, outPrefix, "file"); FILE *h = mustOpen(userPath, "w"); +if (u) + { fprintf(h, "\n\n%s Files View\n\n\n", u); fprintf(h, "

Files for %s

\n", u); - fprintf(h, "switch to commits view, user index"); + } +else + fprintf(h, "\n\n%s Files View\n\n\n", u); + fprintf(h, "

%s to %s (%s to %s) %s

\n", startTag, endTag, startDate, endDate, title); fprintf(h, "
\n");
 
 
-int userLinesChanged = 0;
-int userFileCount = 0;
+int totalLinesChanged = 0;
+int totalFileCount = 0;   // TODO should this count duplicates or not
 
 char *cDiff = NULL, *cHtml = NULL, *fDiff = NULL, *fHtml = NULL;
 char *relativePath = NULL;
@@ -481,15 +490,6 @@
 struct commit *c = NULL;
 struct files *f = NULL;
 
-/*
-struct comFile
-    {
-    struct comFile *next;
-    struct files *f;
-    struct commit *commit;
-    }
-*/
-
 struct comFile *comFiles = NULL, *cf = NULL;
 
 // pre-filter for u if u is not NULL  
@@ -526,7 +526,10 @@
     char path[1024];
 
     // context unified
+    if (u)
     safef(path, sizeof(path), "%s/%s%s", "context", f->path, c->commitId);
+    else
+	safef(path, sizeof(path), "../user/%s/%s/%s%s", c->author, "context", f->path, c->commitId);
     relativePath = cloneString(path);
     safef(path, sizeof(path), "%s.html", relativePath);
     cHtml = cloneString(path);
@@ -537,7 +540,10 @@
 
     // full text (up to 10,000 lines)
     freeMem(relativePath);
+    if (u)
     safef(path, sizeof(path), "%s/%s%s", "full", f->path, c->commitId);
+    else
+	safef(path, sizeof(path), "../user/%s/%s/%s%s", c->author, "context", f->path, c->commitId);
     relativePath = cloneString(path);
     safef(path, sizeof(path), "%s.html", relativePath);
     fHtml = cloneString(path);
@@ -561,16 +567,17 @@
     freeMem(fDiff);
     freeMem(fHtml);
 
-    userLinesChanged += f->linesChanged;
-    ++userFileCount;
+    totalLinesChanged += f->linesChanged;
+    ++totalFileCount;
 
     fprintf(h, "\n");
     }
+if (u)
 fprintf(h, "switch to commits view, user index");
+else
+    fprintf(h, "\n  lines changed: %d\n  files changed: %d\n", totalLinesChanged, totalFileCount);
 fprintf(h, "
\n\n\n"); fclose(h); -//*saveUlc = userLinesChanged; -//*saveUfc = userFileCount; } @@ -653,7 +660,7 @@ userChangedFiles = 0; // DEBUG REMOVE - if (sameString(u->name, "galt")) + //if (sameString(u->name, "galt")) /* make user's reports */ doUserCommits(u->name, commits, &userChangedLines, &userChangedFiles); @@ -673,6 +680,10 @@ fprintf(h, "\n\n\n"); fclose(h); + +// make index of all files view +doUserFiles(NULL, commits); + } int main(int argc, char *argv[])