68 "the mail address. In case your repository contains commits from an author who\n" |
68 "the mail address. In case your repository contains commits from an author who\n" |
69 "used different names or mail addresses, you can use the \033[1m--authormap\033[22m option\n" |
69 "used different names or mail addresses, you can use the \033[1m--authormap\033[22m option\n" |
70 "to specify a file that contains pairs of author strings, like in the following\n" |
70 "to specify a file that contains pairs of author strings, like in the following\n" |
71 "example:\n\n" |
71 "example:\n\n" |
72 " Full Name <full.name@example.org> = New Name <new.name@example.org>\n" |
72 " Full Name <full.name@example.org> = New Name <new.name@example.org>\n" |
73 " just.mail@example.org = new.name@example.org\n" |
73 " just.mail@example.org = Jus Mail <just.mail@example.org>\n" |
74 " username = new.name\n\n" |
74 " jane = Jane Doe <jane.doe@example.org>\n\n" |
75 "The different variants of full string, only mail address, and only local-part\n" |
75 "The different variants of full string, only mail address, and only local-part\n" |
76 "can be combined as you like. When you use the \033[1m--author\033[22m option at the same\n" |
76 "should \033[4monly\033[24m be used on the left-hand side. When you use the \033[1m--author\033[22m option at\n" |
77 "time, you only need to specify the new author names.\n\n" |
77 "the same time, you only need to specify the new author names.\n\n" |
78 "Finally, this tool prints an HTML page to stdout. A separate heap map is\n" |
78 "Finally, this tool prints an HTML page to stdout. A separate heap map is\n" |
79 "generated for each author showing commits across all repositories, unless the\n" |
79 "generated for each author showing commits across all repositories, unless the\n" |
80 "\033[1m--separate\033[22m option is specified in which case each repository is displayed with\n" |
80 "\033[1m--separate\033[22m option is specified in which case each repository is displayed with\n" |
81 "its own heat map.\n" |
81 "its own heat map.\n" |
82 , stderr); |
82 , stderr); |
124 } |
124 } |
125 } else if (chk_arg(argv[i], "-n", "--no-pull")) { |
125 } else if (chk_arg(argv[i], "-n", "--no-pull")) { |
126 settings.update_repos = false; |
126 settings.update_repos = false; |
127 } else if (chk_arg(argv[i], "-s", "--separate")) { |
127 } else if (chk_arg(argv[i], "-s", "--separate")) { |
128 settings.separate = true; |
128 settings.separate = true; |
|
129 } else if (chk_arg(argv[i], "-A", "--authormap")) { |
|
130 if (i + 1 < argc) { |
|
131 if (settings.parse_authormap(argv[++i])) { |
|
132 fputs("parsing authormap failed\n", stderr); |
|
133 return -1; |
|
134 } |
|
135 } else { |
|
136 fputs("missing filename for authormap\n", stderr); |
|
137 return -1; |
|
138 } |
129 } else if (chk_arg(argv[i], "--hg", nullptr)) { |
139 } else if (chk_arg(argv[i], "--hg", nullptr)) { |
130 if (i + 1 < argc) { |
140 if (i + 1 < argc) { |
131 settings.hg.assign(argv[++i]); |
141 settings.hg.assign(argv[++i]); |
132 } else { |
142 } else { |
133 fputs("--hg is expecting a path\n", stderr); |
143 fputs("--hg is expecting a path\n", stderr); |
223 "--date", std::format("{0}-01-01 to {0}-12-31", report_year), |
233 "--date", std::format("{0}-01-01 to {0}-12-31", report_year), |
224 "--template", "{author}#{date|shortdate}\n"})) { |
234 "--template", "{author}#{date|shortdate}\n"})) { |
225 fprintf(stderr, "Reading commit log for repo '%s' failed!\n", repo.path.c_str()); |
235 fprintf(stderr, "Reading commit log for repo '%s' failed!\n", repo.path.c_str()); |
226 return EXIT_FAILURE; |
236 return EXIT_FAILURE; |
227 } |
237 } |
228 heatmap.add(proc.output()); |
238 heatmap.add(settings, proc.output()); |
229 } else { |
239 } else { |
230 proc.setbin(settings.git); |
240 proc.setbin(settings.git); |
231 if (proc.exec_log({"log", |
241 if (proc.exec_log({"log", |
232 "--since", std::format("{0}-01-01", report_year), |
242 "--since", std::format("{0}-01-01", report_year), |
233 "--until", std::format("{0}-12-31", report_year), |
243 "--until", std::format("{0}-12-31", report_year), |
234 "--format=tformat:%an <%ae>#%cs"})) { |
244 "--format=tformat:%an <%ae>#%cs"})) { |
235 fprintf(stderr, "Reading commit log for repo '%s' failed!\n", repo.path.c_str()); |
245 fprintf(stderr, "Reading commit log for repo '%s' failed!\n", repo.path.c_str()); |
236 return EXIT_FAILURE; |
246 return EXIT_FAILURE; |
237 } |
247 } |
238 heatmap.add(proc.output()); |
248 heatmap.add(settings, proc.output()); |
239 } |
249 } |
240 } |
250 } |
241 |
251 |
242 html::open(); |
252 html::open(); |
243 for (const auto &[repo, authors] : heatmap.data()) { |
253 for (const auto &[repo, authors] : heatmap.data()) { |