rev-list: allow missing tips with --missing=[print|allow*]
[git.git] / builtin / rev-list.c
blobec455aa97277dd58d106c10623ad36aa923bcd10
1 #include "builtin.h"
2 #include "config.h"
3 #include "commit.h"
4 #include "diff.h"
5 #include "environment.h"
6 #include "gettext.h"
7 #include "hex.h"
8 #include "revision.h"
9 #include "list-objects.h"
10 #include "list-objects-filter-options.h"
11 #include "object.h"
12 #include "object-name.h"
13 #include "object-file.h"
14 #include "object-store-ll.h"
15 #include "pack-bitmap.h"
16 #include "log-tree.h"
17 #include "graph.h"
18 #include "bisect.h"
19 #include "progress.h"
20 #include "reflog-walk.h"
21 #include "oidset.h"
22 #include "packfile.h"
24 static const char rev_list_usage[] =
25 "git rev-list [<options>] <commit>... [--] [<path>...]\n"
26 "\n"
27 " limiting output:\n"
28 " --max-count=<n>\n"
29 " --max-age=<epoch>\n"
30 " --min-age=<epoch>\n"
31 " --sparse\n"
32 " --no-merges\n"
33 " --min-parents=<n>\n"
34 " --no-min-parents\n"
35 " --max-parents=<n>\n"
36 " --no-max-parents\n"
37 " --remove-empty\n"
38 " --all\n"
39 " --branches\n"
40 " --tags\n"
41 " --remotes\n"
42 " --stdin\n"
43 " --exclude-hidden=[fetch|receive|uploadpack]\n"
44 " --quiet\n"
45 " ordering output:\n"
46 " --topo-order\n"
47 " --date-order\n"
48 " --reverse\n"
49 " formatting output:\n"
50 " --parents\n"
51 " --children\n"
52 " --objects | --objects-edge\n"
53 " --disk-usage[=human]\n"
54 " --unpacked\n"
55 " --header | --pretty\n"
56 " --[no-]object-names\n"
57 " --abbrev=<n> | --no-abbrev\n"
58 " --abbrev-commit\n"
59 " --left-right\n"
60 " --count\n"
61 " special purpose:\n"
62 " --bisect\n"
63 " --bisect-vars\n"
64 " --bisect-all"
67 static struct progress *progress;
68 static unsigned progress_counter;
70 static struct oidset omitted_objects;
71 static int arg_print_omitted; /* print objects omitted by filter */
73 static struct oidset missing_objects;
74 enum missing_action {
75 MA_ERROR = 0, /* fail if any missing objects are encountered */
76 MA_ALLOW_ANY, /* silently allow ALL missing objects */
77 MA_PRINT, /* print ALL missing objects in special section */
78 MA_ALLOW_PROMISOR, /* silently allow all missing PROMISOR objects */
80 static enum missing_action arg_missing_action;
82 /* display only the oid of each object encountered */
83 static int arg_show_object_names = 1;
85 #define DEFAULT_OIDSET_SIZE (16*1024)
87 static int show_disk_usage;
88 static off_t total_disk_usage;
89 static int human_readable;
91 static off_t get_object_disk_usage(struct object *obj)
93 off_t size;
94 struct object_info oi = OBJECT_INFO_INIT;
95 oi.disk_sizep = &size;
96 if (oid_object_info_extended(the_repository, &obj->oid, &oi, 0) < 0)
97 die(_("unable to get disk usage of %s"), oid_to_hex(&obj->oid));
98 return size;
101 static inline void finish_object__ma(struct object *obj)
104 * Whether or not we try to dynamically fetch missing objects
105 * from the server, we currently DO NOT have the object. We
106 * can either print, allow (ignore), or conditionally allow
107 * (ignore) them.
109 switch (arg_missing_action) {
110 case MA_ERROR:
111 die("missing %s object '%s'",
112 type_name(obj->type), oid_to_hex(&obj->oid));
113 return;
115 case MA_ALLOW_ANY:
116 return;
118 case MA_PRINT:
119 oidset_insert(&missing_objects, &obj->oid);
120 return;
122 case MA_ALLOW_PROMISOR:
123 if (is_promisor_object(&obj->oid))
124 return;
125 die("unexpected missing %s object '%s'",
126 type_name(obj->type), oid_to_hex(&obj->oid));
127 return;
129 default:
130 BUG("unhandled missing_action");
131 return;
135 static void finish_commit(struct commit *commit)
137 free_commit_list(commit->parents);
138 commit->parents = NULL;
139 free_commit_buffer(the_repository->parsed_objects,
140 commit);
143 static void show_commit(struct commit *commit, void *data)
145 struct rev_list_info *info = data;
146 struct rev_info *revs = info->revs;
148 display_progress(progress, ++progress_counter);
150 if (revs->do_not_die_on_missing_objects &&
151 oidset_contains(&revs->missing_commits, &commit->object.oid)) {
152 finish_object__ma(&commit->object);
153 return;
156 if (show_disk_usage)
157 total_disk_usage += get_object_disk_usage(&commit->object);
159 if (info->flags & REV_LIST_QUIET) {
160 finish_commit(commit);
161 return;
164 graph_show_commit(revs->graph);
166 if (revs->count) {
167 if (commit->object.flags & PATCHSAME)
168 revs->count_same++;
169 else if (commit->object.flags & SYMMETRIC_LEFT)
170 revs->count_left++;
171 else
172 revs->count_right++;
173 finish_commit(commit);
174 return;
177 if (info->show_timestamp)
178 printf("%"PRItime" ", commit->date);
179 if (info->header_prefix)
180 fputs(info->header_prefix, stdout);
182 if (revs->include_header) {
183 if (!revs->graph)
184 fputs(get_revision_mark(revs, commit), stdout);
185 if (revs->abbrev_commit && revs->abbrev)
186 fputs(repo_find_unique_abbrev(the_repository, &commit->object.oid, revs->abbrev),
187 stdout);
188 else
189 fputs(oid_to_hex(&commit->object.oid), stdout);
191 if (revs->print_parents) {
192 struct commit_list *parents = commit->parents;
193 while (parents) {
194 printf(" %s", oid_to_hex(&parents->item->object.oid));
195 parents = parents->next;
198 if (revs->children.name) {
199 struct commit_list *children;
201 children = lookup_decoration(&revs->children, &commit->object);
202 while (children) {
203 printf(" %s", oid_to_hex(&children->item->object.oid));
204 children = children->next;
207 show_decorations(revs, commit);
208 if (revs->commit_format == CMIT_FMT_ONELINE)
209 putchar(' ');
210 else if (revs->include_header)
211 putchar('\n');
213 if (revs->verbose_header) {
214 struct strbuf buf = STRBUF_INIT;
215 struct pretty_print_context ctx = {0};
216 ctx.abbrev = revs->abbrev;
217 ctx.date_mode = revs->date_mode;
218 ctx.date_mode_explicit = revs->date_mode_explicit;
219 ctx.fmt = revs->commit_format;
220 ctx.output_encoding = get_log_output_encoding();
221 ctx.color = revs->diffopt.use_color;
222 pretty_print_commit(&ctx, commit, &buf);
223 if (buf.len) {
224 if (revs->commit_format != CMIT_FMT_ONELINE)
225 graph_show_oneline(revs->graph);
227 graph_show_commit_msg(revs->graph, stdout, &buf);
230 * Add a newline after the commit message.
232 * Usually, this newline produces a blank
233 * padding line between entries, in which case
234 * we need to add graph padding on this line.
236 * However, the commit message may not end in a
237 * newline. In this case the newline simply
238 * ends the last line of the commit message,
239 * and we don't need any graph output. (This
240 * always happens with CMIT_FMT_ONELINE, and it
241 * happens with CMIT_FMT_USERFORMAT when the
242 * format doesn't explicitly end in a newline.)
244 if (buf.len && buf.buf[buf.len - 1] == '\n')
245 graph_show_padding(revs->graph);
246 putchar(info->hdr_termination);
247 } else {
249 * If the message buffer is empty, just show
250 * the rest of the graph output for this
251 * commit.
253 if (graph_show_remainder(revs->graph))
254 putchar('\n');
255 if (revs->commit_format == CMIT_FMT_ONELINE)
256 putchar('\n');
258 strbuf_release(&buf);
259 } else {
260 if (graph_show_remainder(revs->graph))
261 putchar('\n');
263 maybe_flush_or_die(stdout, "stdout");
264 finish_commit(commit);
267 static int finish_object(struct object *obj, const char *name UNUSED,
268 void *cb_data)
270 struct rev_list_info *info = cb_data;
271 if (oid_object_info_extended(the_repository, &obj->oid, NULL, 0) < 0) {
272 finish_object__ma(obj);
273 return 1;
275 if (info->revs->verify_objects && !obj->parsed && obj->type != OBJ_COMMIT)
276 parse_object(the_repository, &obj->oid);
277 return 0;
280 static void show_object(struct object *obj, const char *name, void *cb_data)
282 struct rev_list_info *info = cb_data;
283 struct rev_info *revs = info->revs;
285 if (finish_object(obj, name, cb_data))
286 return;
287 display_progress(progress, ++progress_counter);
288 if (show_disk_usage)
289 total_disk_usage += get_object_disk_usage(obj);
290 if (info->flags & REV_LIST_QUIET)
291 return;
293 if (revs->count) {
295 * The object count is always accumulated in the .count_right
296 * field for traversal that is not a left-right traversal,
297 * and cmd_rev_list() made sure that a .count request that
298 * wants to count non-commit objects, which is handled by
299 * the show_object() callback, does not ask for .left_right.
301 revs->count_right++;
302 return;
305 if (arg_show_object_names)
306 show_object_with_name(stdout, obj, name);
307 else
308 printf("%s\n", oid_to_hex(&obj->oid));
311 static void show_edge(struct commit *commit)
313 printf("-%s\n", oid_to_hex(&commit->object.oid));
316 static void print_var_str(const char *var, const char *val)
318 printf("%s='%s'\n", var, val);
321 static void print_var_int(const char *var, int val)
323 printf("%s=%d\n", var, val);
326 static int show_bisect_vars(struct rev_list_info *info, int reaches, int all)
328 int cnt, flags = info->flags;
329 char hex[GIT_MAX_HEXSZ + 1] = "";
330 struct commit_list *tried;
331 struct rev_info *revs = info->revs;
333 if (!revs->commits)
334 return 1;
336 revs->commits = filter_skipped(revs->commits, &tried,
337 flags & BISECT_SHOW_ALL,
338 NULL, NULL);
341 * revs->commits can reach "reaches" commits among
342 * "all" commits. If it is good, then there are
343 * (all-reaches) commits left to be bisected.
344 * On the other hand, if it is bad, then the set
345 * to bisect is "reaches".
346 * A bisect set of size N has (N-1) commits further
347 * to test, as we already know one bad one.
349 cnt = all - reaches;
350 if (cnt < reaches)
351 cnt = reaches;
353 if (revs->commits)
354 oid_to_hex_r(hex, &revs->commits->item->object.oid);
356 if (flags & BISECT_SHOW_ALL) {
357 traverse_commit_list(revs, show_commit, show_object, info);
358 printf("------\n");
361 print_var_str("bisect_rev", hex);
362 print_var_int("bisect_nr", cnt - 1);
363 print_var_int("bisect_good", all - reaches - 1);
364 print_var_int("bisect_bad", reaches - 1);
365 print_var_int("bisect_all", all);
366 print_var_int("bisect_steps", estimate_bisect_steps(all));
368 return 0;
371 static int show_object_fast(
372 const struct object_id *oid,
373 enum object_type type UNUSED,
374 int exclude UNUSED,
375 uint32_t name_hash UNUSED,
376 struct packed_git *found_pack UNUSED,
377 off_t found_offset UNUSED)
379 fprintf(stdout, "%s\n", oid_to_hex(oid));
380 return 1;
383 static void print_disk_usage(off_t size)
385 struct strbuf sb = STRBUF_INIT;
386 if (human_readable)
387 strbuf_humanise_bytes(&sb, size);
388 else
389 strbuf_addf(&sb, "%"PRIuMAX, (uintmax_t)size);
390 puts(sb.buf);
391 strbuf_release(&sb);
394 static inline int parse_missing_action_value(const char *value)
396 if (!strcmp(value, "error")) {
397 arg_missing_action = MA_ERROR;
398 return 1;
401 if (!strcmp(value, "allow-any")) {
402 arg_missing_action = MA_ALLOW_ANY;
403 fetch_if_missing = 0;
404 return 1;
407 if (!strcmp(value, "print")) {
408 arg_missing_action = MA_PRINT;
409 fetch_if_missing = 0;
410 return 1;
413 if (!strcmp(value, "allow-promisor")) {
414 arg_missing_action = MA_ALLOW_PROMISOR;
415 fetch_if_missing = 0;
416 return 1;
419 return 0;
422 static int try_bitmap_count(struct rev_info *revs,
423 int filter_provided_objects)
425 uint32_t commit_count = 0,
426 tag_count = 0,
427 tree_count = 0,
428 blob_count = 0;
429 int max_count;
430 struct bitmap_index *bitmap_git;
432 /* This function only handles counting, not general traversal. */
433 if (!revs->count)
434 return -1;
437 * A bitmap result can't know left/right, etc, because we don't
438 * actually traverse.
440 if (revs->left_right || revs->cherry_mark)
441 return -1;
444 * If we're counting reachable objects, we can't handle a max count of
445 * commits to traverse, since we don't know which objects go with which
446 * commit.
448 if (revs->max_count >= 0 &&
449 (revs->tag_objects || revs->tree_objects || revs->blob_objects))
450 return -1;
453 * This must be saved before doing any walking, since the revision
454 * machinery will count it down to zero while traversing.
456 max_count = revs->max_count;
458 bitmap_git = prepare_bitmap_walk(revs, filter_provided_objects);
459 if (!bitmap_git)
460 return -1;
462 count_bitmap_commit_list(bitmap_git, &commit_count,
463 revs->tree_objects ? &tree_count : NULL,
464 revs->blob_objects ? &blob_count : NULL,
465 revs->tag_objects ? &tag_count : NULL);
466 if (max_count >= 0 && max_count < commit_count)
467 commit_count = max_count;
469 printf("%d\n", commit_count + tree_count + blob_count + tag_count);
470 free_bitmap_index(bitmap_git);
471 return 0;
474 static int try_bitmap_traversal(struct rev_info *revs,
475 int filter_provided_objects)
477 struct bitmap_index *bitmap_git;
480 * We can't use a bitmap result with a traversal limit, since the set
481 * of commits we'd get would be essentially random.
483 if (revs->max_count >= 0)
484 return -1;
486 bitmap_git = prepare_bitmap_walk(revs, filter_provided_objects);
487 if (!bitmap_git)
488 return -1;
490 traverse_bitmap_commit_list(bitmap_git, revs, &show_object_fast);
491 free_bitmap_index(bitmap_git);
492 return 0;
495 static int try_bitmap_disk_usage(struct rev_info *revs,
496 int filter_provided_objects)
498 struct bitmap_index *bitmap_git;
499 off_t size_from_bitmap;
501 if (!show_disk_usage)
502 return -1;
504 bitmap_git = prepare_bitmap_walk(revs, filter_provided_objects);
505 if (!bitmap_git)
506 return -1;
508 size_from_bitmap = get_disk_usage_from_bitmap(bitmap_git, revs);
509 print_disk_usage(size_from_bitmap);
510 return 0;
513 int cmd_rev_list(int argc, const char **argv, const char *prefix)
515 struct rev_info revs;
516 struct rev_list_info info;
517 struct setup_revision_opt s_r_opt = {
518 .allow_exclude_promisor_objects = 1,
520 int i;
521 int bisect_list = 0;
522 int bisect_show_vars = 0;
523 int bisect_find_all = 0;
524 int use_bitmap_index = 0;
525 int filter_provided_objects = 0;
526 const char *show_progress = NULL;
527 int ret = 0;
529 if (argc == 2 && !strcmp(argv[1], "-h"))
530 usage(rev_list_usage);
532 git_config(git_default_config, NULL);
533 repo_init_revisions(the_repository, &revs, prefix);
534 revs.abbrev = DEFAULT_ABBREV;
535 revs.commit_format = CMIT_FMT_UNSPECIFIED;
536 revs.include_header = 1;
539 * Scan the argument list before invoking setup_revisions(), so that we
540 * know if fetch_if_missing needs to be set to 0.
542 * "--exclude-promisor-objects" acts as a pre-filter on missing objects
543 * by not crossing the boundary from realized objects to promisor
544 * objects.
546 * Let "--missing" to conditionally set fetch_if_missing.
549 * NEEDSWORK: These loops that attempt to find presence of
550 * options without understanding that the options they are
551 * skipping are broken (e.g., it would not know "--grep
552 * --exclude-promisor-objects" is not triggering
553 * "--exclude-promisor-objects" option). We really need
554 * setup_revisions() to have a mechanism to allow and disallow
555 * some sets of options for different commands (like rev-list,
556 * replay, etc). Such a mechanism should do an early parsing
557 * of options and be able to manage the `--missing=...` and
558 * `--exclude-promisor-objects` options below.
560 for (i = 1; i < argc; i++) {
561 const char *arg = argv[i];
562 if (!strcmp(arg, "--exclude-promisor-objects")) {
563 fetch_if_missing = 0;
564 revs.exclude_promisor_objects = 1;
565 break;
568 for (i = 1; i < argc; i++) {
569 const char *arg = argv[i];
570 if (skip_prefix(arg, "--missing=", &arg)) {
571 if (revs.exclude_promisor_objects)
572 die(_("options '%s' and '%s' cannot be used together"), "--exclude-promisor-objects", "--missing");
573 if (parse_missing_action_value(arg))
574 break;
578 if (arg_missing_action)
579 revs.do_not_die_on_missing_objects = 1;
581 argc = setup_revisions(argc, argv, &revs, &s_r_opt);
583 memset(&info, 0, sizeof(info));
584 info.revs = &revs;
585 if (revs.bisect)
586 bisect_list = 1;
588 if (revs.diffopt.flags.quick)
589 info.flags |= REV_LIST_QUIET;
590 for (i = 1 ; i < argc; i++) {
591 const char *arg = argv[i];
593 if (!strcmp(arg, "--header")) {
594 revs.verbose_header = 1;
595 continue;
597 if (!strcmp(arg, "--timestamp")) {
598 info.show_timestamp = 1;
599 continue;
601 if (!strcmp(arg, "--bisect")) {
602 bisect_list = 1;
603 continue;
605 if (!strcmp(arg, "--bisect-all")) {
606 bisect_list = 1;
607 bisect_find_all = 1;
608 info.flags |= BISECT_SHOW_ALL;
609 revs.show_decorations = 1;
610 continue;
612 if (!strcmp(arg, "--bisect-vars")) {
613 bisect_list = 1;
614 bisect_show_vars = 1;
615 continue;
617 if (!strcmp(arg, "--use-bitmap-index")) {
618 use_bitmap_index = 1;
619 continue;
621 if (!strcmp(arg, "--test-bitmap")) {
622 test_bitmap_walk(&revs);
623 goto cleanup;
625 if (skip_prefix(arg, "--progress=", &arg)) {
626 show_progress = arg;
627 continue;
629 if (!strcmp(arg, "--filter-provided-objects")) {
630 filter_provided_objects = 1;
631 continue;
633 if (!strcmp(arg, "--filter-print-omitted")) {
634 arg_print_omitted = 1;
635 continue;
638 if (!strcmp(arg, "--exclude-promisor-objects"))
639 continue; /* already handled above */
640 if (skip_prefix(arg, "--missing=", &arg))
641 continue; /* already handled above */
643 if (!strcmp(arg, ("--no-object-names"))) {
644 arg_show_object_names = 0;
645 continue;
648 if (!strcmp(arg, ("--object-names"))) {
649 arg_show_object_names = 1;
650 continue;
653 if (!strcmp(arg, ("--commit-header"))) {
654 revs.include_header = 1;
655 continue;
658 if (!strcmp(arg, ("--no-commit-header"))) {
659 revs.include_header = 0;
660 continue;
663 if (skip_prefix(arg, "--disk-usage", &arg)) {
664 if (*arg == '=') {
665 if (!strcmp(++arg, "human")) {
666 human_readable = 1;
667 } else
668 die(_("invalid value for '%s': '%s', the only allowed format is '%s'"),
669 "--disk-usage=<format>", arg, "human");
670 } else if (*arg) {
672 * Arguably should goto a label to continue chain of ifs?
673 * Doesn't matter unless we try to add --disk-usage-foo
674 * afterwards.
676 usage(rev_list_usage);
678 show_disk_usage = 1;
679 info.flags |= REV_LIST_QUIET;
680 continue;
683 usage(rev_list_usage);
686 if (revs.commit_format != CMIT_FMT_USERFORMAT)
687 revs.include_header = 1;
688 if (revs.commit_format != CMIT_FMT_UNSPECIFIED) {
689 /* The command line has a --pretty */
690 info.hdr_termination = '\n';
691 if (revs.commit_format == CMIT_FMT_ONELINE || !revs.include_header)
692 info.header_prefix = "";
693 else
694 info.header_prefix = "commit ";
696 else if (revs.verbose_header)
697 /* Only --header was specified */
698 revs.commit_format = CMIT_FMT_RAW;
700 if ((!revs.commits && reflog_walk_empty(revs.reflog_info) &&
701 (!(revs.tag_objects || revs.tree_objects || revs.blob_objects) &&
702 !revs.pending.nr) &&
703 !revs.rev_input_given && !revs.read_from_stdin) ||
704 revs.diff)
705 usage(rev_list_usage);
707 if (revs.show_notes)
708 die(_("rev-list does not support display of notes"));
710 if (revs.count &&
711 (revs.tag_objects || revs.tree_objects || revs.blob_objects) &&
712 (revs.left_right || revs.cherry_mark))
713 die(_("marked counting and '%s' cannot be used together"), "--objects");
715 save_commit_buffer = (revs.verbose_header ||
716 revs.grep_filter.pattern_list ||
717 revs.grep_filter.header_list);
718 if (bisect_list)
719 revs.limited = 1;
721 if (show_progress)
722 progress = start_delayed_progress(show_progress, 0);
724 if (use_bitmap_index) {
725 if (!try_bitmap_count(&revs, filter_provided_objects))
726 goto cleanup;
727 if (!try_bitmap_disk_usage(&revs, filter_provided_objects))
728 goto cleanup;
729 if (!try_bitmap_traversal(&revs, filter_provided_objects))
730 goto cleanup;
733 if (prepare_revision_walk(&revs))
734 die("revision walk setup failed");
735 if (revs.tree_objects)
736 mark_edges_uninteresting(&revs, show_edge, 0);
738 if (bisect_list) {
739 int reaches, all;
740 unsigned bisect_flags = 0;
742 if (bisect_find_all)
743 bisect_flags |= FIND_BISECTION_ALL;
745 if (revs.first_parent_only)
746 bisect_flags |= FIND_BISECTION_FIRST_PARENT_ONLY;
748 find_bisection(&revs.commits, &reaches, &all, bisect_flags);
750 if (bisect_show_vars) {
751 ret = show_bisect_vars(&info, reaches, all);
752 goto cleanup;
756 if (filter_provided_objects) {
757 struct commit_list *c;
758 for (i = 0; i < revs.pending.nr; i++) {
759 struct object_array_entry *pending = revs.pending.objects + i;
760 pending->item->flags |= NOT_USER_GIVEN;
762 for (c = revs.commits; c; c = c->next)
763 c->item->object.flags |= NOT_USER_GIVEN;
766 if (arg_print_omitted)
767 oidset_init(&omitted_objects, DEFAULT_OIDSET_SIZE);
768 if (arg_missing_action == MA_PRINT) {
769 oidset_init(&missing_objects, DEFAULT_OIDSET_SIZE);
770 /* Add missing tips */
771 oidset_insert_from_set(&missing_objects, &revs.missing_commits);
772 oidset_clear(&revs.missing_commits);
775 traverse_commit_list_filtered(
776 &revs, show_commit, show_object, &info,
777 (arg_print_omitted ? &omitted_objects : NULL));
779 if (arg_print_omitted) {
780 struct oidset_iter iter;
781 struct object_id *oid;
782 oidset_iter_init(&omitted_objects, &iter);
783 while ((oid = oidset_iter_next(&iter)))
784 printf("~%s\n", oid_to_hex(oid));
785 oidset_clear(&omitted_objects);
787 if (arg_missing_action == MA_PRINT) {
788 struct oidset_iter iter;
789 struct object_id *oid;
790 oidset_iter_init(&missing_objects, &iter);
791 while ((oid = oidset_iter_next(&iter)))
792 printf("?%s\n", oid_to_hex(oid));
793 oidset_clear(&missing_objects);
796 stop_progress(&progress);
798 if (revs.count) {
799 if (revs.left_right && revs.cherry_mark)
800 printf("%d\t%d\t%d\n", revs.count_left, revs.count_right, revs.count_same);
801 else if (revs.left_right)
802 printf("%d\t%d\n", revs.count_left, revs.count_right);
803 else if (revs.cherry_mark)
804 printf("%d\t%d\n", revs.count_left + revs.count_right, revs.count_same);
805 else
806 printf("%d\n", revs.count_left + revs.count_right);
809 if (show_disk_usage)
810 print_disk_usage(total_disk_usage);
812 cleanup:
813 release_revisions(&revs);
814 return ret;