# # # patch "cmd_ws_commit.cc" # from [8321ee742a65e2ebaf58c328bdf6bdda11c8f21c] # to [c526804d60744f302780eaf3fd89663836591710] # ============================================================ --- cmd_ws_commit.cc 8321ee742a65e2ebaf58c328bdf6bdda11c8f21c +++ cmd_ws_commit.cc c526804d60744f302780eaf3fd89663836591710 @@ -984,12 +984,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; @@ -1047,7 +1045,10 @@ CMD(commit, "commit", "ci", CMD_REF(work app.opts.branchname = branchname; } - P(F("beginning commit on branch '%s'") % app.opts.branchname); + if (automate) + output << app.opts.branchname << "\n"; + else + P(F("beginning commit on branch '%s'") % app.opts.branchname); L(FL("new manifest '%s'\n" "new revision '%s'\n") @@ -1196,7 +1197,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(); @@ -1232,6 +1236,29 @@ 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, std::cout, 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::branch | options::opts::message | options::opts::msgfile + | options::opts::date | options::opts::author | options::opts::depth + | options::opts::exclude) +{ + commit(app, execid, args, output, true); +} + CMD_NO_WORKSPACE(setup, "setup", "", CMD_REF(tree), N_("[DIRECTORY]"), N_("Sets up a new workspace directory"), N_("If no directory is specified, uses the current directory."),