# # # patch "cmd_ws_commit.cc" # from [d1cea384ed16b9443f13c685dad44c45146d72c2] # to [2377cf24799c95b98017f037562f549429f83ed9] # ============================================================ --- cmd_ws_commit.cc d1cea384ed16b9443f13c685dad44c45146d72c2 +++ cmd_ws_commit.cc 2377cf24799c95b98017f037562f549429f83ed9 @@ -972,12 +972,10 @@ CMD_AUTOMATE(drop_attribute, N_("PATH [K app.work.update_any_attrs(); } -CMD(commit, "commit", "ci", CMD_REF(workspace), N_("[PATH]..."), - N_("Commits workspace changes to the database"), - "", - options::opts::branch | options::opts::message | options::opts::msgfile - | options::opts::date | options::opts::author | options::opts::depth - | options::opts::exclude) +static void +commit(app_state & app, commands::command_id const & execid, + args_vector const & args, std::ostream & output, + bool automate) { utf8 log_message(""); bool log_message_given; @@ -1035,8 +1033,11 @@ CMD(commit, "commit", "ci", CMD_REF(work app.opts.branchname = branchname; } + if (automate) + output << app.opts.branchname << "\n"; + else + P(F("beginning commit on branch '%s'") % app.opts.branchname); - P(F("beginning commit on branch '%s'") % app.opts.branchname); L(FL("new manifest '%s'\n" "new revision '%s'\n") % restricted_rev.new_manifest @@ -1184,7 +1185,10 @@ CMD(commit, "commit", "ci", CMD_REF(work // small race condition here... app.work.put_work_rev(remaining); - P(F("committed revision %s") % restricted_rev_id); + if (automate) + output << restricted_rev_id << "\n"; + else + P(F("committed revision %s") % restricted_rev_id); app.work.blank_user_log(); @@ -1220,12 +1224,27 @@ CMD(commit, "commit", "ci", CMD_REF(work } } +CMD(commit, "commit", "ci", CMD_REF(workspace), N_("[PATH]..."), + N_("Commits workspace changes to the database"), + "", + options::opts::branch | options::opts::message | options::opts::msgfile + | options::opts::date | options::opts::author | options::opts::depth + | options::opts::exclude) +{ + commit(app, execid, args, output, false); +} + +// outputs the branch followed a newline followed by the new revision id: +// net.venge.monotone\n +// d2510c2eca90359794ba34989314f97a623566bc\n CMD_AUTOMATE(commit, N_("[PATH]..."), N_("Commits workspace changes to the database"), "", - options::opts::none) + options::opts::branch | options::opts::message | options::opts::msgfile + | options::opts::date | options::opts::author | options::opts::depth + | options::opts::exclude) { - commands::commit_cmd.exec(app, execid, args, output); + commit(app, execid, args, output, true); } CMD_NO_WORKSPACE(setup, "setup", "", CMD_REF(tree), N_("[DIRECTORY]"),