From: Lars Hjemli Date: Tue, 27 Jan 2009 19:16:37 +0000 (+0100) Subject: Merge branch 'lh/stats' X-Git-Url: https://gitweb.ps.run/ps-cgit/commitdiff_plain/7710178e45dee61e85ea77c4221309ce8c086f95 Merge branch 'lh/stats' Conflicts: cgit.c cgit.css cgit.h ui-tree.c Signed-off-by: Lars Hjemli --- 7710178e45dee61e85ea77c4221309ce8c086f95 diff --cc cgit.c index f35f605,57e11cd..608cab6 --- a/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 f19446d,ef30fbf..e8214de --- a/cgit.css +++ 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 cb2f176,f2cb671..4fe94c6 --- a/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 shared.c index a764c4d,7382609..578a544 --- a/shared.c +++ 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 fba1ba6,1bb30c2..4f28512 --- a/ui-shared.c +++ b/ui-shared.c @@@ -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-tree.c index 9876c99,e27e796..4b8e7a0 --- a/ui-tree.c +++ b/ui-tree.c @@@ -108,7 -106,10 +108,10 @@@ static int ls_item(const unsigned char html(""); 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("\n"); free(name); return 0;