# # # add_dir "tests/log_--to" # # add_file "tests/log_--to/__driver__.lua" # content [f27b09211d9b427422d6d8b26684402afa9a9459] # # patch "ChangeLog" # from [c1ee9064be33f06d3e4552f554c2f88785d72235] # to [bafa1cb677b0d5be41de73e9366fd37ed1e14f4c] # # patch "cmd_diff_log.cc" # from [ad597a711af534bd952b3753d0af247f9e8c1223] # to [6e88a90a051633ad7d436799eb8a591573707622] # # patch "monotone.texi" # from [414a511aca4ab92d13eb98af0662f95ef8d4adec] # to [b17357a14a40f60e2b3420f07c43e49e717bf242] # # patch "options_list.hh" # from [583180dc9e0734a39d4ef0c7a97a40ef72ec9a66] # to [35f36f423168154a9345e5ffeb35f38bbe09c300] # # patch "tester.cc" # from [1122b5db5c0daec9ddca454bfd5e75d63f79c377] # to [35367b9206fd4ade47c190dd37b49397705781f4] # # patch "testsuite.lua" # from [2188f4ffa8cfc4a560da9af28c071820f1a889ca] # to [20856a39779e9b64b52975107c638df0e45b6677] # ============================================================ --- tests/log_--to/__driver__.lua f27b09211d9b427422d6d8b26684402afa9a9459 +++ tests/log_--to/__driver__.lua f27b09211d9b427422d6d8b26684402afa9a9459 @@ -0,0 +1,30 @@ + +mtn_setup() + +addfile("file", "contents") +commit("testbranch", "comment1") + +firstrev = base_revision() + +addfile("file2", "quack") +commit("testbranch", "comment2") +check(mtn("tag", base_revision(), "mytag"), 0, false, false) + +check(mtn("update", "-r", firstrev), 0, false, false) + +addfile("file3", "foo") +commit("testbranch", "comment3") + +check(mtn("merge"), 0, false, false) + +check(mtn("update"), 0, false, false) + +addfile("file4", "q") +commit("testbranch", "comment4") + +check(mtn("log", "--to", "t:mytag"), 0, true, false) + +check(not qgrep("comment2", "stdout")) +check(qgrep("comment3", "stdout")) +check(qgrep("comment4", "stdout")) +check(not qgrep("comment1", "stdout")) ============================================================ --- ChangeLog c1ee9064be33f06d3e4552f554c2f88785d72235 +++ ChangeLog bafa1cb677b0d5be41de73e9366fd37ed1e14f4c @@ -1,3 +1,9 @@ +2006-12-10 Timothy Brownawell + + Implement a "mtn log --to ", that doesn't log the + revisions that would be logged when was given as + the starting revision. + 2006-12-09 Richard Levitte * tests/netsync_permissions_wildcards/__driver__.lua: ============================================================ --- cmd_diff_log.cc ad597a711af534bd952b3753d0af247f9e8c1223 +++ cmd_diff_log.cc 6e88a90a051633ad7d436799eb8a591573707622 @@ -603,8 +603,9 @@ CMD(log, N_("informative"), N_("[FILE] . CMD(log, N_("informative"), N_("[FILE] ..."), N_("print history in reverse order (filtering by 'FILE'). If one or more\n" "revisions are given, use them as a starting point."), - options::opts::last | options::opts::next | options::opts::revision | options::opts::brief - | options::opts::diffs | options::opts::no_merges | options::opts::no_files) + options::opts::last | options::opts::next | options::opts::revision + | options::opts::brief | options::opts::diffs | options::opts::no_merges + | options::opts::no_files | options::opts::to) { if (app.opts.revision_selectors.size() == 0) app.require_workspace("try passing a --revision to start at"); @@ -616,7 +617,7 @@ CMD(log, N_("informative"), N_("[FILE] . F("only one of --last/--next allowed")); frontier_t frontier(rev_cmp(!(next>0))); - revision_id first_rid; + revision_id first_rid; // for mapping paths to node ids when restricted if (app.opts.revision_selectors.size() == 0) { @@ -668,6 +669,62 @@ CMD(log, N_("informative"), N_("[FILE] . old_roster, new_roster, app); } + // If --to was given, don't log past those revisions. + set disallowed; + bool use_disallowed(!app.opts.to.empty()); + if (use_disallowed) + { + std::deque to; + for (vector::const_iterator i = app.opts.to.begin(); + i != app.opts.to.end(); i++) + { + MM(*i); + set rids; + complete(app, (*i)(), rids); + for (set::const_iterator j = rids.begin(); + j != rids.end(); ++j) + { + I(!null_id(*j)); + pair::iterator, bool> res = disallowed.insert(*j); + if (res.second) + { + to.push_back(*j); + } + } + } + + while (!to.empty()) + { + revision_id const & rid(to.front()); + MM(rid); + + set relatives; + MM(relatives); + if (next > 0) + { + app.db.get_revision_children(rid, relatives); + } + else + { + app.db.get_revision_parents(rid, relatives); + } + + for (set::const_iterator i = relatives.begin(); + i != relatives.end(); ++i) + { + if (null_id(*i)) + continue; + pair::iterator, bool> res = disallowed.insert(*i); + if (res.second) + { + to.push_back(*i); + } + } + + to.pop_front(); + } + } + cert_name author_name(author_cert_name); cert_name date_name(date_cert_name); cert_name branch_name(branch_cert_name); @@ -848,6 +905,10 @@ CMD(log, N_("informative"), N_("[FILE] . for (set::const_iterator i = interesting.begin(); i != interesting.end(); ++i) { + if (use_disallowed && (disallowed.find(*i) != disallowed.end())) + { + continue; + } rev_height height; app.db.get_rev_height(*i, height); frontier.push(make_pair(height, *i)); ============================================================ --- monotone.texi 414a511aca4ab92d13eb98af0662f95ef8d4adec +++ monotone.texi b17357a14a40f60e2b3420f07c43e49e717bf242 @@ -4598,7 +4598,7 @@ @section Informative changed within the current subdirectory of the workspace. @item mtn log address@hidden mtn log address@hidden address@hidden address@hidden [...]] [--brief] [--no-merges] [--no-files] [--diffs] address@hidden [...]] address@hidden mtn log address@hidden address@hidden address@hidden [...]] address@hidden [...]] [--brief] [--no-merges] [--no-files] [--diffs] address@hidden [...]] This command prints out a log, in reverse-ancestry order, of small history summaries. Each summary contains author, date, changelog and @@ -4616,6 +4616,11 @@ @section Informative revision in forward-ancestry order. This is useful to review changes that will be applied to the workspace when @command{update} is run. +if @address@hidden is given, log will only print entries for revisions +that would not also be printed when logging from the revisions specified in address@hidden This is useful for reviewing changes between two points +in history. + By default, the log entries for merge nodes are shown. If @option{--no-merges} is given, the log entries for these nodes will be excluded. ============================================================ --- options_list.hh 583180dc9e0734a39d4ef0c7a97a40ef72ec9a66 +++ options_list.hh 35f36f423168154a9345e5ffeb35f38bbe09c300 @@ -486,12 +486,20 @@ GOPT(ticker, "ticker", std::string, , } #endif +OPT(to, "to", std::vector, , gettext_noop("revision(s) to stop logging at")) +#ifdef option_bodies +{ + to.push_back(utf8(arg)); +} +#endif + OPT(unknown, "unknown", bool, false, gettext_noop("perform the operations for unknown files from workspace")) #ifdef option_bodies { unknown = true; } + #endif OPT(verbose, "verbose", bool, false, ============================================================ --- tester.cc 1122b5db5c0daec9ddca454bfd5e75d63f79c377 +++ tester.cc 35367b9206fd4ade47c190dd37b49397705781f4 @@ -18,6 +18,8 @@ #include #include +#include + #include #include @@ -127,7 +129,13 @@ void do_copy_recursive(fs::path const &f void do_copy_recursive(fs::path const &from, fs::path to) { if (!fs::exists(from)) - throw fs::filesystem_error("Source for copy does not exist", from, 0); + { +#if BOOST_VERSION < 103400 + throw fs::filesystem_error("Source for copy does not exist", from, 0); +#else + throw fs::filesystem_path_error("Source for copy does not exist", from, 0); +#endif + } if (fs::exists(to)) { if (fs::is_directory(to)) ============================================================ --- testsuite.lua 2188f4ffa8cfc4a560da9af28c071820f1a889ca +++ testsuite.lua 20856a39779e9b64b52975107c638df0e45b6677 @@ -693,3 +693,4 @@ table.insert(tests, "netsync_permissions table.insert(tests, "spawn_redirected_hook_helper") table.insert(tests, "import") table.insert(tests, "netsync_permissions_wildcards") +table.insert(tests, "log_--to")