gitlab-ci: introduce stages and dependencies
[git/gitster.git] / builtin / rev-list.c
blobf62bcbf2b140d1be87e0d03876e5ff94b17d7944
1 #define USE_THE_REPOSITORY_VARIABLE
2 #include "builtin.h"
3 #include "config.h"
4 #include "commit.h"
5 #include "diff.h"
6 #include "environment.h"
7 #include "gettext.h"
8 #include "hex.h"
9 #include "revision.h"
10 #include "list-objects.h"
11 #include "list-objects-filter-options.h"
12 #include "object.h"
13 #include "object-name.h"
14 #include "object-file.h"
15 #include "object-store-ll.h"
16 #include "pack-bitmap.h"
17 #include "log-tree.h"
18 #include "graph.h"
19 #include "bisect.h"
20 #include "progress.h"
21 #include "reflog-walk.h"
22 #include "oidset.h"
23 #include "packfile.h"
25 static const char rev_list_usage[] =
26 "git rev-list [<options>] <commit>... [--] [<path>...]\n"
27 "\n"
28 " limiting output:\n"
29 " --max-count=<n>\n"
30 " --max-age=<epoch>\n"
31 " --min-age=<epoch>\n"
32 " --sparse\n"
33 " --no-merges\n"
34 " --min-parents=<n>\n"
35 " --no-min-parents\n"
36 " --max-parents=<n>\n"
37 " --no-max-parents\n"
38 " --remove-empty\n"
39 " --all\n"
40 " --branches\n"
41 " --tags\n"
42 " --remotes\n"
43 " --stdin\n"
44 " --exclude-hidden=[fetch|receive|uploadpack]\n"
45 " --quiet\n"
46 " ordering output:\n"
47 " --topo-order\n"
48 " --date-order\n"
49 " --reverse\n"
50 " formatting output:\n"
51 " --parents\n"
52 " --children\n"
53 " --objects | --objects-edge\n"
54 " --disk-usage[=human]\n"
55 " --unpacked\n"
56 " --header | --pretty\n"
57 " --[no-]object-names\n"
58 " --abbrev=<n> | --no-abbrev\n"
59 " --abbrev-commit\n"
60 " --left-right\n"
61 " --count\n"
62 " special purpose:\n"
63 " --bisect\n"
64 " --bisect-vars\n"
65 " --bisect-all"
68 static struct progress *progress;
69 static unsigned progress_counter;
71 static struct oidset omitted_objects;
72 static int arg_print_omitted; /* print objects omitted by filter */
74 static struct oidset missing_objects;
75 enum missing_action {
76 MA_ERROR = 0, /* fail if any missing objects are encountered */
77 MA_ALLOW_ANY, /* silently allow ALL missing objects */
78 MA_PRINT, /* print ALL missing objects in special section */
79 MA_ALLOW_PROMISOR, /* silently allow all missing PROMISOR objects */
81 static enum missing_action arg_missing_action;
83 /* display only the oid of each object encountered */
84 static int arg_show_object_names = 1;
86 #define DEFAULT_OIDSET_SIZE (16*1024)
88 static int show_disk_usage;
89 static off_t total_disk_usage;
90 static int human_readable;
92 static off_t get_object_disk_usage(struct object *obj)
94 off_t size;
95 struct object_info oi = OBJECT_INFO_INIT;
96 oi.disk_sizep = &size;
97 if (oid_object_info_extended(the_repository, &obj->oid, &oi, 0) < 0)
98 die(_("unable to get disk usage of %s"), oid_to_hex(&obj->oid));
99 return size;
102 static inline void finish_object__ma(struct object *obj)
105 * Whether or not we try to dynamically fetch missing objects
106 * from the server, we currently DO NOT have the object. We
107 * can either print, allow (ignore), or conditionally allow
108 * (ignore) them.
110 switch (arg_missing_action) {
111 case MA_ERROR:
112 die("missing %s object '%s'",
113 type_name(obj->type), oid_to_hex(&obj->oid));
114 return;
116 case MA_ALLOW_ANY:
117 return;
119 case MA_PRINT:
120 oidset_insert(&missing_objects, &obj->oid);
121 return;
123 case MA_ALLOW_PROMISOR:
124 if (is_promisor_object(&obj->oid))
125 return;
126 die("unexpected missing %s object '%s'",
127 type_name(obj->type), oid_to_hex(&obj->oid));
128 return;
130 default:
131 BUG("unhandled missing_action");
132 return;
136 static void finish_commit(struct commit *commit)
138 free_commit_list(commit->parents);
139 commit->parents = NULL;
140 free_commit_buffer(the_repository->parsed_objects,
141 commit);
144 static void show_commit(struct commit *commit, void *data)
146 struct rev_list_info *info = data;
147 struct rev_info *revs = info->revs;
149 display_progress(progress, ++progress_counter);
151 if (revs->do_not_die_on_missing_objects &&
152 oidset_contains(&revs->missing_commits, &commit->object.oid)) {
153 finish_object__ma(&commit->object);
154 return;
157 if (show_disk_usage)
158 total_disk_usage += get_object_disk_usage(&commit->object);
160 if (info->flags & REV_LIST_QUIET) {
161 finish_commit(commit);
162 return;
165 graph_show_commit(revs->graph);
167 if (revs->count) {
168 if (commit->object.flags & PATCHSAME)
169 revs->count_same++;
170 else if (commit->object.flags & SYMMETRIC_LEFT)
171 revs->count_left++;
172 else
173 revs->count_right++;
174 finish_commit(commit);
175 return;
178 if (info->show_timestamp)
179 printf("%"PRItime" ", commit->date);
180 if (info->header_prefix)
181 fputs(info->header_prefix, stdout);
183 if (revs->include_header) {
184 if (!revs->graph)
185 fputs(get_revision_mark(revs, commit), stdout);
186 if (revs->abbrev_commit && revs->abbrev)
187 fputs(repo_find_unique_abbrev(the_repository, &commit->object.oid, revs->abbrev),
188 stdout);
189 else
190 fputs(oid_to_hex(&commit->object.oid), stdout);
192 if (revs->print_parents) {
193 struct commit_list *parents = commit->parents;
194 while (parents) {
195 printf(" %s", oid_to_hex(&parents->item->object.oid));
196 parents = parents->next;
199 if (revs->children.name) {
200 struct commit_list *children;
202 children = lookup_decoration(&revs->children, &commit->object);
203 while (children) {
204 printf(" %s", oid_to_hex(&children->item->object.oid));
205 children = children->next;
208 show_decorations(revs, commit);
209 if (revs->commit_format == CMIT_FMT_ONELINE)
210 putchar(' ');
211 else if (revs->include_header)
212 putchar('\n');
214 if (revs->verbose_header) {
215 struct strbuf buf = STRBUF_INIT;
216 struct pretty_print_context ctx = {0};
217 ctx.abbrev = revs->abbrev;
218 ctx.date_mode = revs->date_mode;
219 ctx.date_mode_explicit = revs->date_mode_explicit;
220 ctx.fmt = revs->commit_format;
221 ctx.output_encoding = get_log_output_encoding();
222 ctx.color = revs->diffopt.use_color;
223 ctx.rev = revs;
224 pretty_print_commit(&ctx, commit, &buf);
225 if (buf.len) {
226 if (revs->commit_format != CMIT_FMT_ONELINE)
227 graph_show_oneline(revs->graph);
229 graph_show_commit_msg(revs->graph, stdout, &buf);
232 * Add a newline after the commit message.
234 * Usually, this newline produces a blank
235 * padding line between entries, in which case
236 * we need to add graph padding on this line.
238 * However, the commit message may not end in a
239 * newline. In this case the newline simply
240 * ends the last line of the commit message,
241 * and we don't need any graph output. (This
242 * always happens with CMIT_FMT_ONELINE, and it
243 * happens with CMIT_FMT_USERFORMAT when the
244 * format doesn't explicitly end in a newline.)
246 if (buf.len && buf.buf[buf.len - 1] == '\n')
247 graph_show_padding(revs->graph);
248 putchar(info->hdr_termination);
249 } else {
251 * If the message buffer is empty, just show
252 * the rest of the graph output for this
253 * commit.
255 if (graph_show_remainder(revs->graph))
256 putchar('\n');
257 if (revs->commit_format == CMIT_FMT_ONELINE)
258 putchar('\n');
260 strbuf_release(&buf);
261 } else {
262 if (graph_show_remainder(revs->graph))
263 putchar('\n');
265 maybe_flush_or_die(stdout, "stdout");
266 finish_commit(commit);
269 static int finish_object(struct object *obj, const char *name UNUSED,
270 void *cb_data)
272 struct rev_list_info *info = cb_data;
273 if (oid_object_info_extended(the_repository, &obj->oid, NULL, 0) < 0) {
274 finish_object__ma(obj);
275 return 1;
277 if (info->revs->verify_objects && !obj->parsed && obj->type != OBJ_COMMIT)
278 parse_object(the_repository, &obj->oid);
279 return 0;
282 static void show_object(struct object *obj, const char *name, void *cb_data)
284 struct rev_list_info *info = cb_data;
285 struct rev_info *revs = info->revs;
287 if (finish_object(obj, name, cb_data))
288 return;
289 display_progress(progress, ++progress_counter);
290 if (show_disk_usage)
291 total_disk_usage += get_object_disk_usage(obj);
292 if (info->flags & REV_LIST_QUIET)
293 return;
295 if (revs->count) {
297 * The object count is always accumulated in the .count_right
298 * field for traversal that is not a left-right traversal,
299 * and cmd_rev_list() made sure that a .count request that
300 * wants to count non-commit objects, which is handled by
301 * the show_object() callback, does not ask for .left_right.
303 revs->count_right++;
304 return;
307 if (arg_show_object_names)
308 show_object_with_name(stdout, obj, name);
309 else
310 printf("%s\n", oid_to_hex(&obj->oid));
313 static void show_edge(struct commit *commit)
315 printf("-%s\n", oid_to_hex(&commit->object.oid));
318 static void print_var_str(const char *var, const char *val)
320 printf("%s='%s'\n", var, val);
323 static void print_var_int(const char *var, int val)
325 printf("%s=%d\n", var, val);
328 static int show_bisect_vars(struct rev_list_info *info, int reaches, int all)
330 int cnt, flags = info->flags;
331 char hex[GIT_MAX_HEXSZ + 1] = "";
332 struct commit_list *tried;
333 struct rev_info *revs = info->revs;
335 if (!revs->commits)
336 return 1;
338 revs->commits = filter_skipped(revs->commits, &tried,
339 flags & BISECT_SHOW_ALL,
340 NULL, NULL);
343 * revs->commits can reach "reaches" commits among
344 * "all" commits. If it is good, then there are
345 * (all-reaches) commits left to be bisected.
346 * On the other hand, if it is bad, then the set
347 * to bisect is "reaches".
348 * A bisect set of size N has (N-1) commits further
349 * to test, as we already know one bad one.
351 cnt = all - reaches;
352 if (cnt < reaches)
353 cnt = reaches;
355 if (revs->commits)
356 oid_to_hex_r(hex, &revs->commits->item->object.oid);
358 if (flags & BISECT_SHOW_ALL) {
359 traverse_commit_list(revs, show_commit, show_object, info);
360 printf("------\n");
363 print_var_str("bisect_rev", hex);
364 print_var_int("bisect_nr", cnt - 1);
365 print_var_int("bisect_good", all - reaches - 1);
366 print_var_int("bisect_bad", reaches - 1);
367 print_var_int("bisect_all", all);
368 print_var_int("bisect_steps", estimate_bisect_steps(all));
370 return 0;
373 static int show_object_fast(
374 const struct object_id *oid,
375 enum object_type type UNUSED,
376 int exclude UNUSED,
377 uint32_t name_hash UNUSED,
378 struct packed_git *found_pack UNUSED,
379 off_t found_offset UNUSED)
381 fprintf(stdout, "%s\n", oid_to_hex(oid));
382 return 1;
385 static void print_disk_usage(off_t size)
387 struct strbuf sb = STRBUF_INIT;
388 if (human_readable)
389 strbuf_humanise_bytes(&sb, size);
390 else
391 strbuf_addf(&sb, "%"PRIuMAX, (uintmax_t)size);
392 puts(sb.buf);
393 strbuf_release(&sb);
396 static inline int parse_missing_action_value(const char *value)
398 if (!strcmp(value, "error")) {
399 arg_missing_action = MA_ERROR;
400 return 1;
403 if (!strcmp(value, "allow-any")) {
404 arg_missing_action = MA_ALLOW_ANY;
405 fetch_if_missing = 0;
406 return 1;
409 if (!strcmp(value, "print")) {
410 arg_missing_action = MA_PRINT;
411 fetch_if_missing = 0;
412 return 1;
415 if (!strcmp(value, "allow-promisor")) {
416 arg_missing_action = MA_ALLOW_PROMISOR;
417 fetch_if_missing = 0;
418 return 1;
421 return 0;
424 static int try_bitmap_count(struct rev_info *revs,
425 int filter_provided_objects)
427 uint32_t commit_count = 0,
428 tag_count = 0,
429 tree_count = 0,
430 blob_count = 0;
431 int max_count;
432 struct bitmap_index *bitmap_git;
434 /* This function only handles counting, not general traversal. */
435 if (!revs->count)
436 return -1;
439 * A bitmap result can't know left/right, etc, because we don't
440 * actually traverse.
442 if (revs->left_right || revs->cherry_mark)
443 return -1;
446 * If we're counting reachable objects, we can't handle a max count of
447 * commits to traverse, since we don't know which objects go with which
448 * commit.
450 if (revs->max_count >= 0 &&
451 (revs->tag_objects || revs->tree_objects || revs->blob_objects))
452 return -1;
455 * This must be saved before doing any walking, since the revision
456 * machinery will count it down to zero while traversing.
458 max_count = revs->max_count;
460 bitmap_git = prepare_bitmap_walk(revs, filter_provided_objects);
461 if (!bitmap_git)
462 return -1;
464 count_bitmap_commit_list(bitmap_git, &commit_count,
465 revs->tree_objects ? &tree_count : NULL,
466 revs->blob_objects ? &blob_count : NULL,
467 revs->tag_objects ? &tag_count : NULL);
468 if (max_count >= 0 && max_count < commit_count)
469 commit_count = max_count;
471 printf("%d\n", commit_count + tree_count + blob_count + tag_count);
472 free_bitmap_index(bitmap_git);
473 return 0;
476 static int try_bitmap_traversal(struct rev_info *revs,
477 int filter_provided_objects)
479 struct bitmap_index *bitmap_git;
482 * We can't use a bitmap result with a traversal limit, since the set
483 * of commits we'd get would be essentially random.
485 if (revs->max_count >= 0)
486 return -1;
488 bitmap_git = prepare_bitmap_walk(revs, filter_provided_objects);
489 if (!bitmap_git)
490 return -1;
492 traverse_bitmap_commit_list(bitmap_git, revs, &show_object_fast);
493 free_bitmap_index(bitmap_git);
494 return 0;
497 static int try_bitmap_disk_usage(struct rev_info *revs,
498 int filter_provided_objects)
500 struct bitmap_index *bitmap_git;
501 off_t size_from_bitmap;
503 if (!show_disk_usage)
504 return -1;
506 bitmap_git = prepare_bitmap_walk(revs, filter_provided_objects);
507 if (!bitmap_git)
508 return -1;
510 size_from_bitmap = get_disk_usage_from_bitmap(bitmap_git, revs);
511 print_disk_usage(size_from_bitmap);
513 free_bitmap_index(bitmap_git);
514 return 0;
517 int cmd_rev_list(int argc,
518 const char **argv,
519 const char *prefix,
520 struct repository *repo UNUSED)
522 struct rev_info revs;
523 struct rev_list_info info;
524 struct setup_revision_opt s_r_opt = {
525 .allow_exclude_promisor_objects = 1,
527 int i;
528 int bisect_list = 0;
529 int bisect_show_vars = 0;
530 int bisect_find_all = 0;
531 int use_bitmap_index = 0;
532 int filter_provided_objects = 0;
533 const char *show_progress = NULL;
534 int ret = 0;
536 if (argc == 2 && !strcmp(argv[1], "-h"))
537 usage(rev_list_usage);
539 git_config(git_default_config, NULL);
540 repo_init_revisions(the_repository, &revs, prefix);
541 revs.abbrev = DEFAULT_ABBREV;
542 revs.commit_format = CMIT_FMT_UNSPECIFIED;
543 revs.include_header = 1;
546 * Scan the argument list before invoking setup_revisions(), so that we
547 * know if fetch_if_missing needs to be set to 0.
549 * "--exclude-promisor-objects" acts as a pre-filter on missing objects
550 * by not crossing the boundary from realized objects to promisor
551 * objects.
553 * Let "--missing" to conditionally set fetch_if_missing.
556 * NEEDSWORK: These loops that attempt to find presence of
557 * options without understanding that the options they are
558 * skipping are broken (e.g., it would not know "--grep
559 * --exclude-promisor-objects" is not triggering
560 * "--exclude-promisor-objects" option). We really need
561 * setup_revisions() to have a mechanism to allow and disallow
562 * some sets of options for different commands (like rev-list,
563 * replay, etc). Such a mechanism should do an early parsing
564 * of options and be able to manage the `--missing=...` and
565 * `--exclude-promisor-objects` options below.
567 for (i = 1; i < argc; i++) {
568 const char *arg = argv[i];
569 if (!strcmp(arg, "--exclude-promisor-objects")) {
570 fetch_if_missing = 0;
571 revs.exclude_promisor_objects = 1;
572 break;
575 for (i = 1; i < argc; i++) {
576 const char *arg = argv[i];
577 if (skip_prefix(arg, "--missing=", &arg)) {
578 if (revs.exclude_promisor_objects)
579 die(_("options '%s' and '%s' cannot be used together"), "--exclude-promisor-objects", "--missing");
580 if (parse_missing_action_value(arg))
581 break;
585 if (arg_missing_action)
586 revs.do_not_die_on_missing_objects = 1;
588 argc = setup_revisions(argc, argv, &revs, &s_r_opt);
590 memset(&info, 0, sizeof(info));
591 info.revs = &revs;
592 if (revs.bisect)
593 bisect_list = 1;
595 if (revs.diffopt.flags.quick)
596 info.flags |= REV_LIST_QUIET;
597 for (i = 1 ; i < argc; i++) {
598 const char *arg = argv[i];
600 if (!strcmp(arg, "--header")) {
601 revs.verbose_header = 1;
602 continue;
604 if (!strcmp(arg, "--timestamp")) {
605 info.show_timestamp = 1;
606 continue;
608 if (!strcmp(arg, "--bisect")) {
609 bisect_list = 1;
610 continue;
612 if (!strcmp(arg, "--bisect-all")) {
613 bisect_list = 1;
614 bisect_find_all = 1;
615 info.flags |= BISECT_SHOW_ALL;
616 revs.show_decorations = 1;
617 continue;
619 if (!strcmp(arg, "--bisect-vars")) {
620 bisect_list = 1;
621 bisect_show_vars = 1;
622 continue;
624 if (!strcmp(arg, "--use-bitmap-index")) {
625 use_bitmap_index = 1;
626 continue;
628 if (!strcmp(arg, "--test-bitmap")) {
629 test_bitmap_walk(&revs);
630 goto cleanup;
632 if (skip_prefix(arg, "--progress=", &arg)) {
633 show_progress = arg;
634 continue;
636 if (!strcmp(arg, "--filter-provided-objects")) {
637 filter_provided_objects = 1;
638 continue;
640 if (!strcmp(arg, "--filter-print-omitted")) {
641 arg_print_omitted = 1;
642 continue;
645 if (!strcmp(arg, "--exclude-promisor-objects"))
646 continue; /* already handled above */
647 if (skip_prefix(arg, "--missing=", &arg))
648 continue; /* already handled above */
650 if (!strcmp(arg, ("--no-object-names"))) {
651 arg_show_object_names = 0;
652 continue;
655 if (!strcmp(arg, ("--object-names"))) {
656 arg_show_object_names = 1;
657 continue;
660 if (!strcmp(arg, ("--commit-header"))) {
661 revs.include_header = 1;
662 continue;
665 if (!strcmp(arg, ("--no-commit-header"))) {
666 revs.include_header = 0;
667 continue;
670 if (skip_prefix(arg, "--disk-usage", &arg)) {
671 if (*arg == '=') {
672 if (!strcmp(++arg, "human")) {
673 human_readable = 1;
674 } else
675 die(_("invalid value for '%s': '%s', the only allowed format is '%s'"),
676 "--disk-usage=<format>", arg, "human");
677 } else if (*arg) {
679 * Arguably should goto a label to continue chain of ifs?
680 * Doesn't matter unless we try to add --disk-usage-foo
681 * afterwards.
683 usage(rev_list_usage);
685 show_disk_usage = 1;
686 info.flags |= REV_LIST_QUIET;
687 continue;
690 usage(rev_list_usage);
693 if (revs.commit_format != CMIT_FMT_USERFORMAT)
694 revs.include_header = 1;
695 if (revs.commit_format != CMIT_FMT_UNSPECIFIED) {
696 /* The command line has a --pretty */
697 info.hdr_termination = '\n';
698 if (revs.commit_format == CMIT_FMT_ONELINE || !revs.include_header)
699 info.header_prefix = "";
700 else
701 info.header_prefix = "commit ";
703 else if (revs.verbose_header)
704 /* Only --header was specified */
705 revs.commit_format = CMIT_FMT_RAW;
707 if ((!revs.commits && reflog_walk_empty(revs.reflog_info) &&
708 (!(revs.tag_objects || revs.tree_objects || revs.blob_objects) &&
709 !revs.pending.nr) &&
710 !revs.rev_input_given && !revs.read_from_stdin) ||
711 revs.diff)
712 usage(rev_list_usage);
714 if (revs.show_notes)
715 die(_("rev-list does not support display of notes"));
717 if (revs.count &&
718 (revs.tag_objects || revs.tree_objects || revs.blob_objects) &&
719 (revs.left_right || revs.cherry_mark))
720 die(_("marked counting and '%s' cannot be used together"), "--objects");
722 save_commit_buffer = (revs.verbose_header ||
723 revs.grep_filter.pattern_list ||
724 revs.grep_filter.header_list);
725 if (bisect_list)
726 revs.limited = 1;
728 if (show_progress)
729 progress = start_delayed_progress(show_progress, 0);
731 if (use_bitmap_index) {
732 if (!try_bitmap_count(&revs, filter_provided_objects))
733 goto cleanup;
734 if (!try_bitmap_disk_usage(&revs, filter_provided_objects))
735 goto cleanup;
736 if (!try_bitmap_traversal(&revs, filter_provided_objects))
737 goto cleanup;
740 if (prepare_revision_walk(&revs))
741 die("revision walk setup failed");
742 if (revs.tree_objects)
743 mark_edges_uninteresting(&revs, show_edge, 0);
745 if (bisect_list) {
746 int reaches, all;
747 unsigned bisect_flags = 0;
749 if (bisect_find_all)
750 bisect_flags |= FIND_BISECTION_ALL;
752 if (revs.first_parent_only)
753 bisect_flags |= FIND_BISECTION_FIRST_PARENT_ONLY;
755 find_bisection(&revs.commits, &reaches, &all, bisect_flags);
757 if (bisect_show_vars) {
758 ret = show_bisect_vars(&info, reaches, all);
759 goto cleanup;
763 if (filter_provided_objects) {
764 struct commit_list *c;
765 for (i = 0; i < revs.pending.nr; i++) {
766 struct object_array_entry *pending = revs.pending.objects + i;
767 pending->item->flags |= NOT_USER_GIVEN;
769 for (c = revs.commits; c; c = c->next)
770 c->item->object.flags |= NOT_USER_GIVEN;
773 if (arg_print_omitted)
774 oidset_init(&omitted_objects, DEFAULT_OIDSET_SIZE);
775 if (arg_missing_action == MA_PRINT) {
776 oidset_init(&missing_objects, DEFAULT_OIDSET_SIZE);
777 /* Add missing tips */
778 oidset_insert_from_set(&missing_objects, &revs.missing_commits);
779 oidset_clear(&revs.missing_commits);
782 traverse_commit_list_filtered(
783 &revs, show_commit, show_object, &info,
784 (arg_print_omitted ? &omitted_objects : NULL));
786 if (arg_print_omitted) {
787 struct oidset_iter iter;
788 struct object_id *oid;
789 oidset_iter_init(&omitted_objects, &iter);
790 while ((oid = oidset_iter_next(&iter)))
791 printf("~%s\n", oid_to_hex(oid));
792 oidset_clear(&omitted_objects);
794 if (arg_missing_action == MA_PRINT) {
795 struct oidset_iter iter;
796 struct object_id *oid;
797 oidset_iter_init(&missing_objects, &iter);
798 while ((oid = oidset_iter_next(&iter)))
799 printf("?%s\n", oid_to_hex(oid));
800 oidset_clear(&missing_objects);
803 stop_progress(&progress);
805 if (revs.count) {
806 if (revs.left_right && revs.cherry_mark)
807 printf("%d\t%d\t%d\n", revs.count_left, revs.count_right, revs.count_same);
808 else if (revs.left_right)
809 printf("%d\t%d\n", revs.count_left, revs.count_right);
810 else if (revs.cherry_mark)
811 printf("%d\t%d\n", revs.count_left + revs.count_right, revs.count_same);
812 else
813 printf("%d\n", revs.count_left + revs.count_right);
816 if (show_disk_usage)
817 print_disk_usage(total_disk_usage);
819 cleanup:
820 release_revisions(&revs);
821 return ret;