# # # patch "cmd_diff_log.cc" # from [23daffa4cc24771e90a5a000279851ded2882850] # to [5bb30846bf016826e3b1b29463786481b3233e51] # # patch "tests/automate_log/__driver__.lua" # from [05740c3348c3b070276a119cc149130b7699a5c5] # to [5464e9af1871c162e46633fdd8822dc3bb5b0bb3] # # patch "tests/common/automate_stdio.lua" # from [0aef0317b86901a75009e03d5e6ef6b59a5be570] # to [0f91780229b36c726ec98177ff57a39e7909a5ed] # ============================================================ --- cmd_diff_log.cc 23daffa4cc24771e90a5a000279851ded2882850 +++ cmd_diff_log.cc 5bb30846bf016826e3b1b29463786481b3233e51 @@ -638,7 +638,8 @@ log_common (app_state & app, void log_common (app_state & app, args_vector args, - bool automate) + bool automate, + std::ostream & output) { database db(app); project_t project(db); @@ -829,7 +830,7 @@ log_common (app_state & app, set seen; revision_t rev; // this is instantiated even when not used, but it's lightweight - asciik graph(cout); + asciik graph(output); while(!frontier.empty() && last != 0 && next != 0) { revision_id const & rid = frontier.top().second; @@ -921,7 +922,7 @@ log_common (app_state & app, if (print_this) { if (automate) - log_print_rev (app, db, project, rid, rev, date_fmt, mask, automate, cout); + log_print_rev (app, db, project, rid, rev, date_fmt, mask, automate, output); else { ostringstream out; @@ -930,7 +931,7 @@ log_common (app_state & app, string out_system; utf8_to_system_best_effort(utf8(out.str(), origin::internal), out_system); if (app.opts.no_graph) - cout << out_system; + output << out_system; else graph.print(rid, interesting, out_system); } @@ -944,7 +945,7 @@ log_common (app_state & app, graph.print(rid, interesting, (F("(Revision: %s)") % rid).str()); - cout.flush(); + output.flush(); frontier.pop(); // beware: rid is invalid from now on @@ -975,7 +976,7 @@ CMD(log, "log", "", CMD_REF(informative) options::opts::no_merges | options::opts::no_files | options::opts::no_graph) { - log_common (app, args, false); + log_common (app, args, false, cout); } CMD_AUTOMATE(log, N_("[PATH] ..."), @@ -986,7 +987,7 @@ CMD_AUTOMATE(log, N_("[PATH] ..."), options::opts::depth | options::opts::exclude | options::opts::no_merges | options::opts::no_files) { - log_common (app, args, true); + log_common (app, args, true, output); } // Local Variables: ============================================================ --- tests/automate_log/__driver__.lua 05740c3348c3b070276a119cc149130b7699a5c5 +++ tests/automate_log/__driver__.lua 5464e9af1871c162e46633fdd8822dc3bb5b0bb3 @@ -7,6 +7,7 @@ include("/common/automate_ancestry.lua") check(qgrep("misuse: workspace parent revision '' not found", "stderr")) include("/common/automate_ancestry.lua") +include("/common/automate_stdio.lua") revs = make_graph() -- A @@ -29,4 +30,7 @@ revmap("log", {"--to", "w:", "--from", " revert_to(revs.c) revmap("log", {"--to", "w:", "--from", "h:"}, {revs.b, revs.f, revs.d, revs.e}, false) +-- test automate stdio log +check(run_stdio("l3:loge", 0, 0, "m") == revs.c .. "\n" .. revs.a .. "\n") + -- end of file ============================================================ --- tests/common/automate_stdio.lua 0aef0317b86901a75009e03d5e6ef6b59a5be570 +++ tests/common/automate_stdio.lua 0f91780229b36c726ec98177ff57a39e7909a5ed @@ -1,5 +1,5 @@ -- --- data: stdio input data +-- data: stdio data (as read from a stdout file) -- err: expected error code (0, 1 or 2) -- which: which command to check if data contains input of several command -- (0 by default)