summaryrefslogtreecommitdiffabout
path: root/cmd.c
authorLars Hjemli <hjemli@gmail.com>2008-12-07 12:17:21 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2008-12-07 12:17:21 (UTC)
commitfb2f3f6c29bad733723152893c5246a756e4cada (patch) (unidiff)
tree5b2953c0c116f276ca48beee676a6662b6329d95 /cmd.c
parentc6a6aa2186daf39814baa0e71378c2e9e1041002 (diff)
downloadcgit-fb2f3f6c29bad733723152893c5246a756e4cada.zip
cgit-fb2f3f6c29bad733723152893c5246a756e4cada.tar.gz
cgit-fb2f3f6c29bad733723152893c5246a756e4cada.tar.bz2
ui-stats: replace 'enable-stats' setting with 'max-stats'
The new 'max-stats' and 'repo.max-stats' settings makes it possible to define the maximum statistics period, both globally and per repo. Hence, it is now feasible to allow statistics on repositories with a high commit frequency, like linux-2.6, by setting repo.max-stats to e.g. 'month'. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (limited to 'cmd.c') (more/less context) (ignore whitespace changes)
-rw-r--r--cmd.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/cmd.c b/cmd.c
index 744bf84..763a558 100644
--- a/cmd.c
+++ b/cmd.c
@@ -67,100 +67,97 @@ static void info_fn(struct cgit_context *ctx)
67static void log_fn(struct cgit_context *ctx) 67static void log_fn(struct cgit_context *ctx)
68{ 68{
69 cgit_print_log(ctx->qry.sha1, ctx->qry.ofs, ctx->cfg.max_commit_count, 69 cgit_print_log(ctx->qry.sha1, ctx->qry.ofs, ctx->cfg.max_commit_count,
70 ctx->qry.grep, ctx->qry.search, ctx->qry.path, 1); 70 ctx->qry.grep, ctx->qry.search, ctx->qry.path, 1);
71} 71}
72 72
73static void ls_cache_fn(struct cgit_context *ctx) 73static void ls_cache_fn(struct cgit_context *ctx)
74{ 74{
75 ctx->page.mimetype = "text/plain"; 75 ctx->page.mimetype = "text/plain";
76 ctx->page.filename = "ls-cache.txt"; 76 ctx->page.filename = "ls-cache.txt";
77 cgit_print_http_headers(ctx); 77 cgit_print_http_headers(ctx);
78 cache_ls(ctx->cfg.cache_root); 78 cache_ls(ctx->cfg.cache_root);
79} 79}
80 80
81static void objects_fn(struct cgit_context *ctx) 81static void objects_fn(struct cgit_context *ctx)
82{ 82{
83 cgit_clone_objects(ctx); 83 cgit_clone_objects(ctx);
84} 84}
85 85
86static void repolist_fn(struct cgit_context *ctx) 86static void repolist_fn(struct cgit_context *ctx)
87{ 87{
88 cgit_print_repolist(); 88 cgit_print_repolist();
89} 89}
90 90
91static void patch_fn(struct cgit_context *ctx) 91static void patch_fn(struct cgit_context *ctx)
92{ 92{
93 cgit_print_patch(ctx->qry.sha1); 93 cgit_print_patch(ctx->qry.sha1);
94} 94}
95 95
96static void plain_fn(struct cgit_context *ctx) 96static void plain_fn(struct cgit_context *ctx)
97{ 97{
98 cgit_print_plain(ctx); 98 cgit_print_plain(ctx);
99} 99}
100 100
101static void refs_fn(struct cgit_context *ctx) 101static void refs_fn(struct cgit_context *ctx)
102{ 102{
103 cgit_print_refs(); 103 cgit_print_refs();
104} 104}
105 105
106static void snapshot_fn(struct cgit_context *ctx) 106static void snapshot_fn(struct cgit_context *ctx)
107{ 107{
108 cgit_print_snapshot(ctx->qry.head, ctx->qry.sha1, 108 cgit_print_snapshot(ctx->qry.head, ctx->qry.sha1,
109 cgit_repobasename(ctx->repo->url), ctx->qry.path, 109 cgit_repobasename(ctx->repo->url), ctx->qry.path,
110 ctx->repo->snapshots, ctx->qry.nohead); 110 ctx->repo->snapshots, ctx->qry.nohead);
111} 111}
112 112
113static void stats_fn(struct cgit_context *ctx) 113static void stats_fn(struct cgit_context *ctx)
114{ 114{
115 if (ctx->repo->enable_stats) 115 cgit_show_stats(ctx);
116 cgit_show_stats(ctx);
117 else
118 cgit_print_error("Stats disabled for this repo");
119} 116}
120 117
121static void summary_fn(struct cgit_context *ctx) 118static void summary_fn(struct cgit_context *ctx)
122{ 119{
123 cgit_print_summary(); 120 cgit_print_summary();
124} 121}
125 122
126static void tag_fn(struct cgit_context *ctx) 123static void tag_fn(struct cgit_context *ctx)
127{ 124{
128 cgit_print_tag(ctx->qry.sha1); 125 cgit_print_tag(ctx->qry.sha1);
129} 126}
130 127
131static void tree_fn(struct cgit_context *ctx) 128static void tree_fn(struct cgit_context *ctx)
132{ 129{
133 cgit_print_tree(ctx->qry.sha1, ctx->qry.path); 130 cgit_print_tree(ctx->qry.sha1, ctx->qry.path);
134} 131}
135 132
136#define def_cmd(name, want_repo, want_layout) \ 133#define def_cmd(name, want_repo, want_layout) \
137 {#name, name##_fn, want_repo, want_layout} 134 {#name, name##_fn, want_repo, want_layout}
138 135
139struct cgit_cmd *cgit_get_cmd(struct cgit_context *ctx) 136struct cgit_cmd *cgit_get_cmd(struct cgit_context *ctx)
140{ 137{
141 static struct cgit_cmd cmds[] = { 138 static struct cgit_cmd cmds[] = {
142 def_cmd(HEAD, 1, 0), 139 def_cmd(HEAD, 1, 0),
143 def_cmd(atom, 1, 0), 140 def_cmd(atom, 1, 0),
144 def_cmd(about, 0, 1), 141 def_cmd(about, 0, 1),
145 def_cmd(blob, 1, 0), 142 def_cmd(blob, 1, 0),
146 def_cmd(commit, 1, 1), 143 def_cmd(commit, 1, 1),
147 def_cmd(diff, 1, 1), 144 def_cmd(diff, 1, 1),
148 def_cmd(info, 1, 0), 145 def_cmd(info, 1, 0),
149 def_cmd(log, 1, 1), 146 def_cmd(log, 1, 1),
150 def_cmd(ls_cache, 0, 0), 147 def_cmd(ls_cache, 0, 0),
151 def_cmd(objects, 1, 0), 148 def_cmd(objects, 1, 0),
152 def_cmd(patch, 1, 0), 149 def_cmd(patch, 1, 0),
153 def_cmd(plain, 1, 0), 150 def_cmd(plain, 1, 0),
154 def_cmd(refs, 1, 1), 151 def_cmd(refs, 1, 1),
155 def_cmd(repolist, 0, 0), 152 def_cmd(repolist, 0, 0),
156 def_cmd(snapshot, 1, 0), 153 def_cmd(snapshot, 1, 0),
157 def_cmd(stats, 1, 1), 154 def_cmd(stats, 1, 1),
158 def_cmd(summary, 1, 1), 155 def_cmd(summary, 1, 1),
159 def_cmd(tag, 1, 1), 156 def_cmd(tag, 1, 1),
160 def_cmd(tree, 1, 1), 157 def_cmd(tree, 1, 1),
161 }; 158 };
162 int i; 159 int i;
163 160
164 if (ctx->qry.page == NULL) { 161 if (ctx->qry.page == NULL) {
165 if (ctx->repo) 162 if (ctx->repo)
166 ctx->qry.page = "summary"; 163 ctx->qry.page = "summary";