# # # add_dir "tests/disapproving_a_non_head" # # add_file "tests/disapproving_a_non_head/__driver__.lua" # content [a9783880cb997304ea25daa1f52a1f631565081c] # # patch "cmd_ws_commit.cc" # from [10d33763a838c34d36cdacf987678905f77762be] # to [d21dd65d6066f1689d08700039e586f04c8bd6f7] # ============================================================ --- tests/disapproving_a_non_head/__driver__.lua a9783880cb997304ea25daa1f52a1f631565081c +++ tests/disapproving_a_non_head/__driver__.lua a9783880cb997304ea25daa1f52a1f631565081c @@ -0,0 +1,11 @@ +mtn_setup() + +addfile("foo", "bar") +commit() +addfile("xyzzy", "xyzzy") +commit() +to_disapprove = base_revision() +addfile("123", "456") +commit() +check(mtn("disapprove", to_disapprove), 0, true, true) +check(qgrep("divergence", "stderr")) \ No newline at end of file ============================================================ --- cmd_ws_commit.cc 10d33763a838c34d36cdacf987678905f77762be +++ cmd_ws_commit.cc d21dd65d6066f1689d08700039e586f04c8bd6f7 @@ -411,6 +411,12 @@ CMD(disapprove, "disapprove", "", CMD_RE cache_user_key(app.opts, app.lua, db, keys, project); + // for the divergence check, below + set heads; + project.get_branch_heads(app.opts.branch, heads, + app.opts.ignore_suspend_certs); + unsigned int old_head_size = heads.size(); + edge_entry const & old_edge (*rev.edges.begin()); db.get_revision_manifest(edge_old_revision(old_edge), rev_inverse.new_manifest); @@ -437,6 +443,14 @@ CMD(disapprove, "disapprove", "", CMD_RE log_message); guard.commit(); } + + project.get_branch_heads(app.opts.branch, heads, + app.opts.ignore_suspend_certs); + if (heads.size() > old_head_size && old_head_size > 0) { + P(F("note: this revision creates divergence\n" + "note: you may (or may not) wish to run '%s merge'") + % prog_name); + } } CMD(mkdir, "mkdir", "", CMD_REF(workspace), N_("[DIRECTORY...]"),