summaryrefslogtreecommitdiffabout
path: root/ui-log.c
authorLars Hjemli <hjemli@gmail.com>2008-04-14 20:13:38 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2008-04-14 20:13:38 (UTC)
commit5764fe95469f65fdee285467f0f87d188fc1a780 (patch) (unidiff)
tree0dc9e9545bd8b43fbf1a571f3ef239ff3aea771c /ui-log.c
parent35d19bbb641aa56a21fb2c238994716c272e154f (diff)
downloadcgit-5764fe95469f65fdee285467f0f87d188fc1a780.zip
cgit-5764fe95469f65fdee285467f0f87d188fc1a780.tar.gz
cgit-5764fe95469f65fdee285467f0f87d188fc1a780.tar.bz2
Make branches, tags and log play better together in the summary view
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (limited to 'ui-log.c') (more/less context) (ignore whitespace changes)
-rw-r--r--ui-log.c42
1 files changed, 26 insertions, 16 deletions
diff --git a/ui-log.c b/ui-log.c
index 60c9269..9b2ffb6 100644
--- a/ui-log.c
+++ b/ui-log.c
@@ -41,32 +41,33 @@ void print_commit(struct commit *commit)
41 html("</td><td>"); 41 html("</td><td>");
42 cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head, 42 cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head,
43 sha1_to_hex(commit->object.sha1)); 43 sha1_to_hex(commit->object.sha1));
44 html("</td><td>");
45 html_txt(info->author);
44 if (ctx.repo->enable_log_filecount) { 46 if (ctx.repo->enable_log_filecount) {
45 files = 0; 47 files = 0;
46 add_lines = 0; 48 add_lines = 0;
47 rem_lines = 0; 49 rem_lines = 0;
48 cgit_diff_commit(commit, inspect_files); 50 cgit_diff_commit(commit, inspect_files);
49 html("</td><td class='right'>"); 51 html("</td><td>");
50 htmlf("%d", files); 52 htmlf("%d", files);
51 if (ctx.repo->enable_log_linecount) { 53 if (ctx.repo->enable_log_linecount) {
52 html("</td><td class='right'>"); 54 html("</td><td>");
53 htmlf("-%d/+%d", rem_lines, add_lines); 55 htmlf("-%d/+%d", rem_lines, add_lines);
54 } 56 }
55 } 57 }
56 html("</td><td>");
57 html_txt(info->author);
58 html("</td></tr>\n"); 58 html("</td></tr>\n");
59 cgit_free_commitinfo(info); 59 cgit_free_commitinfo(info);
60} 60}
61 61
62 62
63void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern, char *path, int pager) 63void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern,
64 char *path, int pager)
64{ 65{
65 struct rev_info rev; 66 struct rev_info rev;
66 struct commit *commit; 67 struct commit *commit;
67 const char *argv[] = {NULL, tip, NULL, NULL, NULL}; 68 const char *argv[] = {NULL, tip, NULL, NULL, NULL};
68 int argc = 2; 69 int argc = 2;
69 int i; 70 int i, columns = 3;
70 71
71 if (!tip) 72 if (!tip)
72 argv[1] = ctx.qry.head; 73 argv[1] = ctx.qry.head;
@@ -92,16 +93,21 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern
92 } 93 }
93 prepare_revision_walk(&rev); 94 prepare_revision_walk(&rev);
94 95
95 html("<table summary='log' class='list nowrap'>"); 96 if (pager)
96 html("<tr class='nohover'><th class='left'>Age</th>" 97 html("<table class='list nowrap'>");
97 "<th class='left'>Message</th>");
98 98
99 html("<tr class='nohover'><th class='left'>Age</th>"
100 "<th class='left'>Commit message</th>"
101 "<th class='left'>Author</th>");
99 if (ctx.repo->enable_log_filecount) { 102 if (ctx.repo->enable_log_filecount) {
100 html("<th class='right'>Files</th>"); 103 html("<th class='left'>Files</th>");
101 if (ctx.repo->enable_log_linecount) 104 columns++;
102 html("<th class='right'>Lines</th>"); 105 if (ctx.repo->enable_log_linecount) {
106 html("<th class='left'>Lines</th>");
107 columns++;
108 }
103 } 109 }
104 html("<th class='left'>Author</th></tr>\n"); 110 html("</tr>\n");
105 111
106 if (ofs<0) 112 if (ofs<0)
107 ofs = 0; 113 ofs = 0;
@@ -120,10 +126,9 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern
120 free_commit_list(commit->parents); 126 free_commit_list(commit->parents);
121 commit->parents = NULL; 127 commit->parents = NULL;
122 } 128 }
123 html("</table>\n");
124
125 if (pager) { 129 if (pager) {
126 html("<div class='pager'>"); 130 htmlf("</table><div class='pager'>",
131 columns);
127 if (ofs > 0) { 132 if (ofs > 0) {
128 cgit_log_link("[prev]", NULL, NULL, ctx.qry.head, 133 cgit_log_link("[prev]", NULL, NULL, ctx.qry.head,
129 ctx.qry.sha1, ctx.qry.path, 134 ctx.qry.sha1, ctx.qry.path,
@@ -138,5 +143,10 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern
138 ctx.qry.search); 143 ctx.qry.search);
139 } 144 }
140 html("</div>"); 145 html("</div>");
146 } else if ((commit = get_revision(&rev)) != NULL) {
147 html("<tr class='nohover'><td colspan='3'>");
148 cgit_log_link("[...]", NULL, NULL, ctx.qry.head, NULL, NULL, 0,
149 NULL, NULL);
150 html("</td></tr>\n");
141 } 151 }
142} 152}