# # add_file "tests/t_multiple_heads_msg.at" # # patch "ChangeLog" # from [535f25be8b0b24866f6590c8302e5a18c816b4a2] # to [26d654047b7b3194e45dd7f238d29bbc1eeb1783] # # patch "commands.cc" # from [cbf282bd907acd6ae708ee5ca8fc5a4f3b85a381] # to [66bf9df3449b8dec9e3df3dddd4a19150cc3fc51] # # patch "tests/t_multiple_heads_msg.at" # from [] # to [99d4be761e132208fa93e1d73375656509956c69] # --- ChangeLog +++ ChangeLog @@ -1,3 +1,10 @@ +2005-04-21 Jeremy Cowgar + + * commands.cc: Renamed maybe_show_multiple_heads to + notify_if_multiple_heads, renamed headSize to head_size for + coding standards/consistency. + * tests/t_multiple_heads_msg.at: Added to monotone this time. + 2005-04-20 Jeremy Cowgar * commands.cc: Added maybe_show_multiple_heads, update now notifies --- commands.cc +++ commands.cc @@ -676,7 +676,7 @@ } static void -maybe_show_multiple_heads(app_state & app) { +notify_if_multiple_heads(app_state & app) { set heads; get_branch_heads(app.branch_name(), app, heads); if (heads.size() > 1) { @@ -2643,7 +2643,7 @@ set heads; get_branch_heads(app.branch_name(), app, heads); - unsigned int headSize = heads.size(); + unsigned int head_size = heads.size(); guess_branch(edge_old_revision(rs.edges.begin()), app, branchname); @@ -2779,7 +2779,7 @@ blank_user_log(); get_branch_heads(app.branch_name(), app, heads); - if (heads.size() > headSize) { + if (heads.size() > head_size) { P(F("note: this revision creates divergence\n" "note: you may (or may not) wish to run 'monotone merge'")); } @@ -3237,7 +3237,7 @@ F("no revision %s found in database") % r_chosen_id); } - maybe_show_multiple_heads(app); + notify_if_multiple_heads(app); if (r_old_id == r_chosen_id) { --- tests/t_multiple_heads_msg.at +++ tests/t_multiple_heads_msg.at @@ -0,0 +1,57 @@ +# -*- Autoconf -*- + +AT_SETUP([commit/update multiple heads message]) + +MONOTONE_SETUP + +# Create a single revision in branch1 +# +# root (branch1) +# +# branch1 heads: root + +AT_DATA(f, [base data +]) + +AT_CHECK(MONOTONE add f, [], [ignore], [ignore]) +AT_CHECK(MONOTONE --branch=branch1 commit --message blah-blah, [], [ignore], [ignore]) +ROOT_R_SHA=`BASE_REVISION` + +AT_CHECK(MONOTONE --branch=branch1 heads, [], [stdout], [ignore]) +AT_CHECK(grep -q $ROOT_R_SHA stdout) + +# Create a child +# +# root (branch1) +# / +# child1 (branch1) +# +# branch1 heads: child1 + +AT_DATA(f, [child1 data +]) +AT_CHECK(MONOTONE --branch=branch1 commit --message blah-blah, [], [ignore], [ignore]) +CHILD1_R_SHA=`BASE_REVISION` + +AT_CHECK(MONOTONE --branch=branch1 heads, [], [stdout], [ignore]) +AT_CHECK(grep -q $ROOT_R_SHA stdout, [1]) +AT_CHECK(grep -q $CHILD1_R_SHA stdout) + +# Create another child +# +# root (branch1) +# / \ +# child1 (branch1) child2 (branch1) +# +# branch1 heads: child1, child2 + +REVERT_TO($ROOT_R_SHA) +AT_DATA(f, [child2 data +]) +AT_CHECK(MONOTONE --branch=branch1 commit --message blah-blah, [], [ignore], [stderr]) +AT_CHECK(grep -q 'this revision creates divergence' stderr, []) + +AT_CHECK(MONOTONE --branch=branch1 update, [], [ignore], [stderr]) +AT_CHECK(grep -q 'has multiple heads' stderr, []) + +AT_CLEANUP