]> granicus.if.org Git - cgit/commitdiff
Merge branch 'lh/stats'
authorLars Hjemli <hjemli@gmail.com>
Tue, 27 Jan 2009 19:16:37 +0000 (20:16 +0100)
committerLars Hjemli <hjemli@gmail.com>
Tue, 27 Jan 2009 19:16:37 +0000 (20:16 +0100)
Conflicts:
cgit.c
cgit.css
cgit.h
ui-tree.c

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
1  2 
Makefile
cgit.c
cgit.css
cgit.h
cgitrc.5.txt
cmd.c
shared.c
ui-shared.c
ui-shared.h
ui-tree.c

diff --cc Makefile
Simple merge
diff --cc cgit.c
index f35f6059e1531ad6408b3ec3d638be81643bed58,57e11cdfb0b1095c2bd9b742a12f79793e4841a0..608cab658425e5c11270ac3d1690a842eec71891
--- 1/cgit.c
--- 2/cgit.c
+++ b/cgit.c
@@@ -154,10 -159,8 +159,12 @@@ static void querystring_cb(const char *
                ctx.qry.name = xstrdup(value);
        } else if (!strcmp(name, "mimetype")) {
                ctx.qry.mimetype = xstrdup(value);
 +      } else if (!strcmp(name, "s")){
 +              ctx.qry.sort = xstrdup(value);
 +      } else if (!strcmp(name, "showmsg")) {
 +              ctx.qry.showmsg = atoi(value);
+       } else if (!strcmp(name, "period")) {
+               ctx.qry.period = xstrdup(value);
        }
  }
  
diff --cc cgit.css
index f19446dfbccfffd727b97793fc84dda1115805f9,ef30fbf899803c2a102875c1dfb3d25dd4f55760..e8214de13550e0e18bd2ef1b41f9d375bddb416c
+++ b/cgit.css
@@@ -471,27 -456,80 +471,103 @@@ div.footer 
        font-size: 80%;
        color: #ccc;
  }
 -
 +a.branch-deco {
 +      margin: 0px 0.5em;
 +      padding: 0px 0.25em;
 +      background-color: #88ff88;
 +      border: solid 1px #007700;
 +}
 +a.tag-deco {
 +      margin: 0px 0.5em;
 +      padding: 0px 0.25em;
 +      background-color: #ffff88;
 +      border: solid 1px #777700;
 +}
 +a.remote-deco {
 +      margin: 0px 0.5em;
 +      padding: 0px 0.25em;
 +      background-color: #ccccff;
 +      border: solid 1px #000077;
 +}
 +a.deco {
 +      margin: 0px 0.5em;
 +      padding: 0px 0.25em;
 +      background-color: #ff8888;
 +      border: solid 1px #770000;
 +}
+ table.stats {
+       border: solid 1px black;
+       border-collapse: collapse;
+ }
+ table.stats th {
+       text-align: left;
+       padding: 1px 0.5em;
+       background-color: #eee;
+       border: solid 1px black;
+ }
+ table.stats td {
+       text-align: right;
+       padding: 1px 0.5em;
+       border: solid 1px black;
+ }
+ table.stats td.total {
+       font-weight: bold;
+       text-align: left;
+ }
+ table.stats td.sum {
+       color: #c00;
+       font-weight: bold;
+ /*    background-color: #eee; */
+ }
+ table.stats td.left {
+       text-align: left;
+ }
+ table.vgraph {
+       border-collapse: separate;
+       border: solid 1px black;
+       height: 200px;
+ }
+ table.vgraph th {
+       background-color: #eee;
+       font-weight: bold;
+       border: solid 1px white;
+       padding: 1px 0.5em;
+ }
+ table.vgraph td {
+       vertical-align: bottom;
+       padding: 0px 10px;
+ }
+ table.vgraph div.bar {
+       background-color: #eee;
+ }
+ table.hgraph {
+       border: solid 1px black;
+       width: 800px;
+ }
+ table.hgraph th {
+       background-color: #eee;
+       font-weight: bold;
+       border: solid 1px black;
+       padding: 1px 0.5em;
+ }
+ table.hgraph td {
+       vertical-align: center;
+       padding: 2px 2px;
+ }
+ table.hgraph div.bar {
+       background-color: #eee;
+       height: 1em;
+ }
diff --cc cgit.h
index cb2f176f621f52d60489dd817d2776411360b3bf,f2cb671b12962d9b13ced83aa2685b4bc343796a..4fe94c69e6939d969572a6c1b4601d5267f390c2
--- 1/cgit.h
--- 2/cgit.h
+++ b/cgit.h
@@@ -61,7 -61,7 +61,8 @@@ struct cgit_repo 
        int snapshots;
        int enable_log_filecount;
        int enable_log_linecount;
+       int max_stats;
 +      time_t mtime;
  };
  
  struct cgit_repolist {
@@@ -120,10 -120,9 +121,11 @@@ struct cgit_query 
        char *name;
        char *mimetype;
        char *url;
+       char *period;
        int   ofs;
        int nohead;
 +      char *sort;
 +      int showmsg;
  };
  
  struct cgit_config {
diff --cc cgitrc.5.txt
Simple merge
diff --cc cmd.c
Simple merge
diff --cc shared.c
index a764c4d6b25bbde782cafe159c0bef05ccc98f21,73826090669d2bfc8e6d59842e5212c7040230c4..578a54430a38d89036c2ae747e41a48d0f9666f1
+++ b/shared.c
@@@ -58,9 -58,9 +58,10 @@@ struct cgit_repo *cgit_add_repo(const c
        ret->snapshots = ctx.cfg.snapshots;
        ret->enable_log_filecount = ctx.cfg.enable_log_filecount;
        ret->enable_log_linecount = ctx.cfg.enable_log_linecount;
+       ret->max_stats = ctx.cfg.max_stats;
        ret->module_link = ctx.cfg.module_link;
        ret->readme = NULL;
 +      ret->mtime = -1;
        return ret;
  }
  
diff --cc ui-shared.c
index fba1ba6dba56a4eab7381c1cbf0065a2c641fefa,1bb30c291646c3e0d07fc5ca736024c1de6dd39d..4f2851273418dc9a81c4af942660e4923a149f5e
@@@ -369,16 -363,19 +369,22 @@@ void cgit_patch_link(char *name, char *
        reporevlink("patch", name, title, class, head, rev, NULL);
  }
  
+ void cgit_stats_link(char *name, char *title, char *class, char *head,
+                    char *path)
+ {
+       reporevlink("stats", name, title, class, head, NULL, path);
+ }
  void cgit_object_link(struct object *obj)
  {
 -      char *page, *rev, *name;
 +      char *page, *shortrev, *fullrev, *name;
  
 +      fullrev = sha1_to_hex(obj->sha1);
 +      shortrev = xstrdup(fullrev);
 +      shortrev[10] = '\0';
        if (obj->type == OBJ_COMMIT) {
 -                cgit_commit_link(fmt("commit %s", sha1_to_hex(obj->sha1)), NULL, NULL,
 -                               ctx.qry.head, sha1_to_hex(obj->sha1));
 +                cgit_commit_link(fmt("commit %s...", shortrev), NULL, NULL,
 +                               ctx.qry.head, fullrev);
                return;
        } else if (obj->type == OBJ_TREE)
                page = "tree";
diff --cc ui-shared.h
Simple merge
diff --cc ui-tree.c
index 9876c9972e9558f82632d03280997cc8db234fac,e27e79680a58d8625308657de7a5e66280aaf4df..4b8e7a034cd7482075a9015c13584bd077d200f1
+++ b/ui-tree.c
@@@ -108,7 -106,10 +108,10 @@@ static int ls_item(const unsigned char 
  
        html("<td>");
        cgit_log_link("log", NULL, "button", ctx.qry.head, curr_rev,
 -                    fullpath, 0, NULL, NULL);
 +                    fullpath, 0, NULL, NULL, ctx.qry.showmsg);
+       if (ctx.repo->max_stats)
+               cgit_stats_link("stats", NULL, "button", ctx.qry.head,
+                               fullpath);
        html("</td></tr>\n");
        free(name);
        return 0;