summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8c3275a)
raw | patch | inline | side by side (parent: 8c3275a)
author | Shawn O. Pearce <spearce@spearce.org> | |
Sun, 14 Jan 2007 05:28:53 +0000 (00:28 -0500) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Sun, 14 Jan 2007 20:20:39 +0000 (12:20 -0800) |
Buffering all message output until a merge invocation is complete is
necessary to prevent intereferring with a progress meter that would
indicate the number of files completely merged, and how many remain.
This change does not introduce a progress meter, but merely lays
the groundwork to buffer the output.
To aid debugging output buffering is only enabled if verbosity
is lower than 5. When using verbosity levels above 5 the user is
probably debugging the merge program itself and does not want to
see the output delayed, especially if they are stepping through
portions of the code in a debugger.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
necessary to prevent intereferring with a progress meter that would
indicate the number of files completely merged, and how many remain.
This change does not introduce a progress meter, but merely lays
the groundwork to buffer the output.
To aid debugging output buffering is only enabled if verbosity
is lower than 5. When using verbosity levels above 5 the user is
probably debugging the merge program itself and does not want to
see the output delayed, especially if they are stepping through
portions of the code in a debugger.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
merge-recursive.c | patch | blob | history |
diff --git a/merge-recursive.c b/merge-recursive.c
index ef9932a68ccb11416e0412f02c5dade02505b104..9237a57f8e11e323d6f4b267e09583b3a6c9103b 100644 (file)
--- a/merge-recursive.c
+++ b/merge-recursive.c
unsigned processed:1;
};
+struct output_buffer
+{
+ struct output_buffer *next;
+ char *str;
+};
+
static struct path_list current_file_set = {NULL, 0, 0, 1};
static struct path_list current_directory_set = {NULL, 0, 0, 1};
static int call_depth = 0;
static int verbosity = 2;
+static int buffer_output = 1;
+static struct output_buffer *output_list, *output_end;
static int show (int v)
{
{
va_list args;
va_start(args, fmt);
- if (show(v)) {
+ if (buffer_output && show(v)) {
+ struct output_buffer *b = xmalloc(sizeof(*b));
+ nfvasprintf(&b->str, fmt, args);
+ b->next = NULL;
+ if (output_end)
+ output_end->next = b;
+ else
+ output_list = b;
+ output_end = b;
+ } else if (show(v)) {
int i;
for (i = call_depth; i--;)
fputs(" ", stdout);
va_end(args);
}
+static void flush_output()
+{
+ struct output_buffer *b, *n;
+ for (b = output_list; b; b = n) {
+ int i;
+ for (i = call_depth; i--;)
+ fputs(" ", stdout);
+ fputs(b->str, stdout);
+ fputc('\n', stdout);
+ n = b->next;
+ free(b->str);
+ free(b);
+ }
+ output_list = NULL;
+ output_end = NULL;
+}
+
static void output_commit_title(struct commit *commit)
{
int i;
+ flush_output();
for (i = call_depth; i--;)
fputs(" ", stdout);
if (commit->util)
commit_list_insert(h1, &(*result)->parents);
commit_list_insert(h2, &(*result)->parents->next);
}
+ flush_output();
return clean;
}
branch1 = better_branch_name(branch1);
branch2 = better_branch_name(branch2);
+ if (verbosity >= 5)
+ buffer_output = 0;
if (show(3))
printf("Merging %s with %s\n", branch1, branch2);