# # # patch "cmd_ws_commit.cc" # from [e97c3370d6bfbf92d47910c5933b47b6cd616938] # to [88972fd38450eeb8bc680f2e5114262a08fea881] # # patch "tests/status/__driver__.lua" # from [b37800cc55362822118faeb68913673521ba4924] # to [43ef14b879077e3edc7cd9e4eedaa38f8e33b02c] # ============================================================ --- cmd_ws_commit.cc e97c3370d6bfbf92d47910c5933b47b6cd616938 +++ cmd_ws_commit.cc 88972fd38450eeb8bc680f2e5114262a08fea881 @@ -128,6 +128,7 @@ get_log_message_interactively(lua_hooks static void get_log_message_interactively(lua_hooks & lua, workspace & work, + project_t & project, revision_id const rid, revision_t const & rev, string & author, date_t & date, branch_name & branch, set const & old_branches, @@ -166,6 +167,20 @@ get_log_message_interactively(lua_hooks oss << _("Old Branch: ") << *i << '\n'; oss << _("New Branch: ") << branch << "\n\n"; } + set heads; + project.get_branch_heads(branch, heads, false); + if (!heads.empty()) + { + for (edge_map::const_iterator e = rev.edges.begin(); + e != rev.edges.end(); ++e) + { + if (heads.find(edge_old_revision(e)) == heads.end()) + { + oss << _("*** THIS REVISION WILL CREATE DIVERGENCE ***") << "\n\n"; + break; + } + } + } utf8 notes(oss.str().c_str()); @@ -833,6 +848,20 @@ CMD(status, "status", "", CMD_REF(inform cout << _("Old Branch: ") << *i << '\n'; cout << _("New Branch: ") << app.opts.branch << "\n\n"; } + set heads; + project.get_branch_heads(app.opts.branch, heads, false); + if (!heads.empty()) + { + for (edge_map::const_iterator e = rev.edges.begin(); + e != rev.edges.end(); ++e) + { + if (heads.find(edge_old_revision(e)) == heads.end()) + { + cout << _("*** THIS REVISION WILL CREATE DIVERGENCE ***") << "\n\n"; + break; + } + } + } cout << summary_external; } @@ -1427,7 +1456,7 @@ CMD(commit, "commit", "ci", CMD_REF(work if (!log_message_given) { // This call handles _MTN/log. - get_log_message_interactively(app.lua, work, + get_log_message_interactively(app.lua, work, project, restricted_rev_id, restricted_rev, author, date, app.opts.branch, old_branches, date_fmt, log_message); ============================================================ --- tests/status/__driver__.lua b37800cc55362822118faeb68913673521ba4924 +++ tests/status/__driver__.lua 43ef14b879077e3edc7cd9e4eedaa38f8e33b02c @@ -50,3 +50,17 @@ check(qgrep('^ patched to_patched', "s check(not qgrep('^ add_file added', "stdout")) check(not qgrep('^ patched patched', "stdout")) check(qgrep('^ patched to_patched', "stdout")) + +-- divergence + +check(not qgrep("WILL CREATE DIVERGENCE", "stdout")) +base = base_revision() +addfile("foo", "foo") +commit() +other_tip = base_revision() +check(mtn("status"), 0, true, false) +check(not qgrep("WILL CREATE DIVERGENCE", "stdout")) +remove("dropped") +check(mtn("update", "-r", base), 0, false, false) +check(mtn("status"), 0, true, false) +check(qgrep("WILL CREATE DIVERGENCE", "stdout"))