# # patch "ChangeLog" # from [aa73ab67056020ef19a9851e0f52eb2884e5f3a5] # to [5eeed1b05411fd7abeee4677fab0c7a1938330b7] # # patch "app_state.cc" # from [bffe24c585ea92098bc0013787e0fcc07a13af5c] # to [cc0de5fca6542f8df529f9232a06ffe32f8b5366] # # patch "app_state.hh" # from [397ffb8acbff1ede6b7ed235481deb090ba177d4] # to [e635a3561b1ac5c00aa5f443ff98d95b17134f3d] # # patch "cert.cc" # from [0437f6358ca654a4e43b3cf8e4bde2c6920a56c0] # to [fb3486083d858f9181317ac8551bff9e85d6f51c] # # patch "commands.cc" # from [2bbd1a33377ead4b9b09bcdbe5d8eddbe3d2a891] # to [16f27966ed65d063603b06d4f8e460a282025135] # # patch "monotone.cc" # from [c44e323fa88aa1053a8fd0060f418b1c4870123b] # to [8cb7a023798adb3cfe759d2030151cba793fa733] # ======================================================================== --- ChangeLog aa73ab67056020ef19a9851e0f52eb2884e5f3a5 +++ ChangeLog 5eeed1b05411fd7abeee4677fab0c7a1938330b7 @@ -1,3 +1,19 @@ +2005-10-25 Emile Snyder + + Fix bug reported on mailing list by Wim Oudshoorn and Tom Koelman + where 'disapprove REV' inappropriately uses your working copy + branch for the disapproved revision. + * app_state.{cc,hh} (set_is_explicit_option, is_explicit_option): + New methods to determine if a given option value was set via + command line flag or not. + * cert.cc (guess_branch): Only accept explicit --branch values in + preference to the branch the given revision lives on. + * commands.cc (CMD(commit)): Explicitly use app.branch_name() if + it exists before calling guess_branch, so pick up MT/options + setting. + * monotone.cc (cpp_main): Set the explicit_option_map entries for + select command line flag processing. + 2005-10-26 Matt Johnston * INSTALL: mention that zlib is required ======================================================================== --- app_state.cc bffe24c585ea92098bc0013787e0fcc07a13af5c +++ app_state.cc cc0de5fca6542f8df529f9232a06ffe32f8b5366 @@ -52,6 +52,20 @@ } void +app_state::set_is_explicit_option (int option_id) +{ + explicit_option_map[option_id] = true; +} + +bool +app_state::is_explicit_option(int option_id) const +{ + std::map::const_iterator i = explicit_option_map.find(option_id); + if (i == explicit_option_map.end()) return false; + return i->second; +} + +void app_state::allow_working_copy() { L(F("initializing from directory %s\n") % fs::initial_path().string()); ======================================================================== --- app_state.hh 397ffb8acbff1ede6b7ed235481deb090ba177d4 +++ app_state.hh e635a3561b1ac5c00aa5f443ff98d95b17134f3d @@ -70,6 +70,9 @@ system_path confdir; bool have_set_key_dir; + std::map explicit_option_map; // set if the value of the flag was explicitly given on the command line + void set_is_explicit_option (int option_id); + bool is_explicit_option(int option_id) const; // These are used to cache signers/verifiers (if the hook allows). // They can't be function-static variables in key.cc, since they must be ======================================================================== --- cert.cc 0437f6358ca654a4e43b3cf8e4bde2c6920a56c0 +++ cert.cc fb3486083d858f9181317ac8551bff9e85d6f51c @@ -1,3 +1,4 @@ +// -*- mode: C++; c-file-style: "gnu"; indent-tabs-mode: nil -*- // copyright (C) 2002, 2003 graydon hoare // all rights reserved. // licensed to the public under the terms of the GNU GPL (>= 2) @@ -13,6 +14,7 @@ #include "sanity.hh" #include "transforms.hh" #include "ui.hh" +#include "options.hh" #include #include @@ -469,7 +471,7 @@ app_state & app, cert_value & branchname) { - if (app.branch_name() != "") + if ((app.branch_name() != "") && app.is_explicit_option(OPT_BRANCH_NAME)) { branchname = app.branch_name(); } ======================================================================== --- commands.cc 2bbd1a33377ead4b9b09bcdbe5d8eddbe3d2a891 +++ commands.cc 16f27966ed65d063603b06d4f8e460a282025135 @@ -2346,7 +2346,10 @@ get_branch_heads(app.branch_name(), app, heads); unsigned int old_head_size = heads.size(); - guess_branch(edge_old_revision(rs.edges.begin()), app, branchname); + if (app.branch_name() != "") + branchname = app.branch_name(); + else + guess_branch(edge_old_revision(rs.edges.begin()), app, branchname); P(F("beginning commit on branch '%s'\n") % branchname); L(F("new manifest '%s'\n" ======================================================================== --- monotone.cc c44e323fa88aa1053a8fd0060f418b1c4870123b +++ monotone.cc 8cb7a023798adb3cfe759d2030151cba793fa733 @@ -360,6 +360,7 @@ case OPT_BRANCH_NAME: app.set_branch(string(argstr)); + app.set_is_explicit_option(OPT_BRANCH_NAME); break; case OPT_VERSION: @@ -378,10 +379,12 @@ case OPT_MESSAGE: app.set_message(string(argstr)); + app.set_is_explicit_option(OPT_MESSAGE); break; case OPT_MSGFILE: app.set_message_file(string(argstr)); + app.set_is_explicit_option(OPT_MSGFILE); break; case OPT_DATE: @@ -465,6 +468,7 @@ app.bind_address = utf8(addr_part); app.bind_port = utf8(port_part); } + app.set_is_explicit_option(OPT_BIND); break; case OPT_MISSING: