# # # patch "NEWS" # from [8583baa78f5a64175d6d8f7914fddb3ad407296e] # to [c8167e3a2744c6208c26a10363d138f9137b9ddf] # # patch "cmd_diff_log.cc" # from [02e74a470fac835fd9fe1a52dd0f3d641ee9419e] # to [6914d0a46555999efc63db64bcc3f7ba35a92917] # # patch "tests/log_--last=N_--next=N/__driver__.lua" # from [21b02d0169db170b1debe2d676785155a6d62a6d] # to [9c875eeb85731d6f204ce7bc98e577d889ee198c] # # patch "tests/log_--last=N_FILENAME/__driver__.lua" # from [0a1303520e6371358fd057f619e54abb3952086d] # to [0f22e2b0afa2e0f92b403061492051ad933ca048] # # patch "tests/log_dir/__driver__.lua" # from [a3a018269f3258a93e03b7640d062c79234fb14e] # to [8b1e8d2d2cd743bc3416bd464be6ec5d25cc3a19] # # patch "tests/log_with_restriction/__driver__.lua" # from [b6b73b9435a5440043f7f9c80c0fa7b0e135e00d] # to [d7523060346d5f3f8fd2dbbadac938291eacae25] # ============================================================ --- NEWS 8583baa78f5a64175d6d8f7914fddb3ad407296e +++ NEWS c8167e3a2744c6208c26a10363d138f9137b9ddf @@ -54,6 +54,10 @@ own for directory creation and permissions if you take the key on standard output and redirect it to a file.) + - The log command was missing --depth and --exclude options used to + restrict revisions printed to those touching specific paths. Log now + allows these options and uses them properly. + New features - The `mtn_automate' lua function now correctly parses and sets ============================================================ --- cmd_diff_log.cc 02e74a470fac835fd9fe1a52dd0f3d641ee9419e +++ cmd_diff_log.cc 6914d0a46555999efc63db64bcc3f7ba35a92917 @@ -647,11 +647,12 @@ CMD(log, "log", "", CMD_REF(informative) N_("This command prints history in reverse order, filtering it by " "FILE if given. If one or more revisions are given, uses them as " "a starting point."), - options::opts::last | options::opts::next - | options::opts::from | options::opts::to - | options::opts::brief | options::opts::diffs - | options::opts::no_merges | options::opts::no_files - | options::opts::no_graph) + options::opts::last | options::opts::next | + options::opts::from | options::opts::to | + options::opts::brief | options::opts::diffs | + options::opts::depth | options::opts::exclude | + options::opts::no_merges | options::opts::no_files | + options::opts::no_graph) { database db(app); project_t project(db); @@ -701,7 +702,7 @@ CMD(log, "log", "", CMD_REF(informative) node_restriction mask; - if (!args.empty()) + if (!args.empty() || !app.opts.exclude_patterns.empty()) { // User wants to trace only specific files if (app.opts.from.empty()) @@ -764,13 +765,9 @@ CMD(log, "log", "", CMD_REF(informative) set relatives; MM(relatives); if (next > 0) - { - db.get_revision_children(rid, relatives); - } + db.get_revision_children(rid, relatives); else - { - db.get_revision_parents(rid, relatives); - } + db.get_revision_parents(rid, relatives); for (set::const_iterator i = relatives.begin(); i != relatives.end(); ++i) @@ -796,14 +793,13 @@ CMD(log, "log", "", CMD_REF(informative) cert_name comment_name(comment_cert_name); // we can use the markings if we walk backwards for a restricted log - bool use_markings(!(next>0) && !mask.empty()); + bool use_markings(next <= 0 && !mask.empty()); set seen; revision_t rev; // this is instantiated even when not used, but it's lightweight asciik graph(cout); - while(! frontier.empty() && (last == -1 || last > 0) - && (next == -1 || next > 0)) + while(! frontier.empty() && last != 0 && next != 0) { revision_id const & rid = frontier.top().second; @@ -969,6 +965,8 @@ CMD(log, "log", "", CMD_REF(informative) graph.print(rid, interesting, (F("(Revision: %s)") % rid).str()); + cout.flush(); + frontier.pop(); // beware: rid is invalid from now on for (set::const_iterator i = interesting.begin(); ============================================================ --- tests/log_--last=N_--next=N/__driver__.lua 21b02d0169db170b1debe2d676785155a6d62a6d +++ tests/log_--last=N_--next=N/__driver__.lua 9c875eeb85731d6f204ce7bc98e577d889ee198c @@ -15,8 +15,8 @@ for i = 1,3 do check(mtn("log", "--last=0"), 1, 0, false) for i = 1,3 do - check(mtn("log", "--last="..i), 0, true) - check(grep("^[\\|\\\\\/ ]+Revision:", "stdout"), 0, true) + check(mtn("log", "--no-graph", "--last="..i), 0, true) + check(grep("^Revision:", "stdout"), 0, true) check(numlines("stdout") == i) end @@ -26,7 +26,7 @@ for i = 1,3 do check(mtn("log", "--next=0"), 1, 0, false) for i = 1,3 do - check(mtn("log", "--next="..i), 0, true) - check(grep("^[\\|\\\\\/ ]+Revision:", "stdout"), 0, true) + check(mtn("log", "--no-graph", "--next="..i), 0, true) + check(grep("^Revision:", "stdout"), 0, true) check(numlines("stdout") == i) end ============================================================ --- tests/log_--last=N_FILENAME/__driver__.lua 0a1303520e6371358fd057f619e54abb3952086d +++ tests/log_--last=N_FILENAME/__driver__.lua 0f22e2b0afa2e0f92b403061492051ad933ca048 @@ -10,6 +10,6 @@ commit("testbranch", "Addition of baz.") addfile("baz", "baz") commit("testbranch", "Addition of baz.") -check(mtn("log", "--last=1", "foo"), 0, true, false) -check(grep("^[\\| ]+Revision:", "stdout"), 0, true, false) +check(mtn("log", "--no-graph", "--last=1", "foo"), 0, true, false) +check(grep("^Revision:", "stdout"), 0, true, false) check(numlines("stdout") == 1) ============================================================ --- tests/log_dir/__driver__.lua a3a018269f3258a93e03b7640d062c79234fb14e +++ tests/log_dir/__driver__.lua 8b1e8d2d2cd743bc3416bd464be6ec5d25cc3a19 @@ -47,12 +47,12 @@ for n,x in pairs{[""] = {0,0,0,0,0,0,0} dir1 = {1,0,1,0,0,1,1}, dir2 = {1,1,0,0,1,0,0}} do if n == "" then - check(mtn("log"), 0, true) + check(mtn("log", "--no-graph"), 0, true) else - check(mtn("log", n), 0, true) + check(mtn("log", "--no-graph", n), 0, true) end for i,v in pairs(x) do L("Checking log of '", n, "' for revision ", i, "\n") - check((v == 0) == qgrep("^[\\|\\\\\/ ]+Revision: "..revs[i], "stdout")) + check((v == 0) == qgrep("^Revision: "..revs[i], "stdout")) end end ============================================================ --- tests/log_with_restriction/__driver__.lua b6b73b9435a5440043f7f9c80c0fa7b0e135e00d +++ tests/log_with_restriction/__driver__.lua d7523060346d5f3f8fd2dbbadac938291eacae25 @@ -3,6 +3,76 @@ mtn_setup() mtn_setup() +mkdir("1") +mkdir("1/2") +mkdir("1/2/3") +mkdir("1/2/3/4") + +check(mtn("add", "."), 0, true, false) +commit("testbranch") + +check(mtn("add", "1"), 0, true, false) +commit("testbranch") + +check(mtn("add", "1/2"), 0, true, false) +commit("testbranch") + +check(mtn("add", "1/2/3"), 0, true, false) +commit("testbranch") + +check(mtn("add", "1/2/3/4"), 0, true, false) +commit("testbranch") + +-- the project tree now looks like this +-- . root depth=0 added in 1st commit +-- ./1 dir depth=1 added in 2nd commit +-- ./1/2 dir depth=2 added in 3rd commit +-- ./1/2/3 dir depth=3 added in 4th commit +-- ./1/2/3/4 dir depth=4 added in 5th commit + +-- include commit 1 +check(mtn("log", "--no-graph", "--brief", "--depth", "0", "."), 0, true, false) +check(numlines("stdout") == 1) + +-- include commits 1,2 +check(mtn("log", "--no-graph", "--brief", "--depth", "1", "."), 0, true, false) +check(numlines("stdout") == 2) + +-- include commits 1,2,3 +check(mtn("log", "--no-graph", "--brief", "--depth", "2", "."), 0, true, false) +check(numlines("stdout") == 3) + +-- include commits 1,2,3,4 +check(mtn("log", "--no-graph", "--brief", "--depth", "3", "."), 0, true, false) +check(numlines("stdout") == 4) + +-- include commits 1,2,3,4,5 +check(mtn("log", "--no-graph", "--brief", "--depth", "4", "."), 0, true, false) +check(numlines("stdout") == 5) + + +-- exclude commit 1 +check(mtn("log", "--no-graph", "--brief", "--depth", "0", "--exclude", "."), 0, true, false) +check(numlines("stdout") == 4) + +-- eclude commits 1,2 +check(mtn("log", "--no-graph", "--brief", "--depth", "1", "--exclude", "."), 0, true, false) +check(numlines("stdout") == 3) + +-- exclude commits 1,2,3 +check(mtn("log", "--no-graph", "--brief", "--depth", "2", "--exclude", "."), 0, true, false) +check(numlines("stdout") == 2) + +-- exclude commits 1,2,3,4 +check(mtn("log", "--no-graph", "--brief", "--depth", "3", "--exclude", "."), 0, true, false) +check(numlines("stdout") == 1) + +-- exclude commits 1,2,3,4,5 +check(mtn("log", "--no-graph", "--brief", "--depth", "4", "--exclude", "."), 0, true, false) +check(numlines("stdout") == 0) + + + addfile("early", "early") commit("testbranch", "Addition of an early file.") @@ -25,13 +95,14 @@ rev_foo3 = base_revision() commit("testbranch", "foo has changed again.") rev_foo3 = base_revision() -check(mtn("log", "foo"), 0, true, false) +check(mtn("log", "--no-graph", "foo"), 0, true, false) rename("stdout", "log") -check(grep("^[\\|\\\\\/ ]+Revision:", "log"), 0, true, false) +check(grep("^Revision:", "log"), 0, true, false) rename("stdout", "revs") check(numlines("revs") == 3) -check(grep("^[\\|\\\\\/ ]+Revision: " .. rev_foo1, "log"), 0, true) -check(grep("^[\\|\\\\\/ ]+Revision: " .. rev_foo2, "log"), 0, true) -check(grep("^[\\|\\\\\/ ]+Revision: " .. rev_foo3, "log"), 0, true) +check(grep("^Revision: " .. rev_foo1, "log"), 0, true) +check(grep("^Revision: " .. rev_foo2, "log"), 0, true) +check(grep("^Revision: " .. rev_foo3, "log"), 0, true) +