# # # patch "cmd_diff_log.cc" # from [caf5335a9a55a96e92391a998d953b4ddae1b92a] # to [e00ed993d60e3ee63935f2449e540590f11378ca] # # patch "cmd_ws_commit.cc" # from [55bf3a32074c86e68d93fc43bdfaf217dcf61476] # to [8cf3dd2b94ac78d1872281c43906e8d8f87bf665] # # patch "options_list.hh" # from [378027f37a6be67813e219ef02b3450d70dee2e4] # to [c8cb455b2b3eae1cebb293f799987c8f92cf9a37] # # patch "project.cc" # from [86618b33d4154fb81225a6fb34480ebf63c1d220] # to [a74422b7bd8cda784839e15882261ebb798c16d4] # # patch "work.cc" # from [8639fa3a282cb2ce24dd2b582d9be4ad833b43ac] # to [e57d238d69746e7c28770be5f588294a9f624f21] # ============================================================ --- cmd_diff_log.cc caf5335a9a55a96e92391a998d953b4ddae1b92a +++ cmd_diff_log.cc e00ed993d60e3ee63935f2449e540590f11378ca @@ -19,6 +19,7 @@ #include "cmd.hh" #include "diff_output.hh" #include "file_io.hh" +#include "globish.hh" #include "restrictions.hh" #include "revision.hh" #include "rev_height.hh" @@ -642,16 +643,53 @@ typedef priority_queue >, rev_cmp> frontier_t; +struct cert_globber +{ + database & db; + cert_name name; + globish glob; + + cert_globber(database & db, cert_name const & name, + string const & pattern) + : db(db), name(name), glob(pattern, origin::user) {} + + cert_globber(database & db, cert_name const & name, + vector const & patterns) + : db(db), name(name) + { + vector args; + for (vector::const_iterator i = patterns.begin(); + i != patterns.end(); ++i) + args.push_back(arg_type(*i, origin::user)); + glob = globish(args); + } + + bool match(revision_id const & rid) + { + vector< revision > certs; + db.get_revision_certs(rid, name, certs); + + for (vector< revision >::const_iterator i = certs.begin(); + i != certs.end(); ++i) + if (glob.matches(i->inner().value())) + return true; + + return false; + } +}; + CMD(log, "log", "", CMD_REF(informative), N_("[FILE] ..."), N_("Prints history in reverse order"), 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::no_merges | options::opts::no_files | + options::opts::no_graph | + options::opts::author | options::opts::branch | options::opts::date | + options::opts::message) { database db(app); project_t project(db); @@ -798,6 +836,12 @@ CMD(log, "log", "", CMD_REF(informative) // we can use the markings if we walk backwards for a restricted log bool use_markings(!(next>0) && !mask.empty()); + cert_globber author_globber(db, author_name, app.opts.author()); + cert_globber branch_globber(db, branch_name, app.opts.branch()); + cert_globber changelog_globber(db, changelog_name, app.opts.message); + cert_globber comment_globber(db, comment_name, app.opts.message); + cert_globber date_globber(db, date_name, app.opts.date); + set seen; revision_t rev; // this is instantiated even when not used, but it's lightweight @@ -872,9 +916,21 @@ CMD(log, "log", "", CMD_REF(informative) } } - if (app.opts.no_merges && rev.is_merge_node()) + if (print_this && app.opts.no_merges && rev.is_merge_node()) print_this = false; + if (print_this && app.opts.author_given) + print_this = author_globber.match(rid); + + if (print_this && !app.opts.branch().empty()) + print_this = branch_globber.match(rid); + + if (print_this && app.opts.message_given) + print_this = changelog_globber.match(rid) | comment_globber.match(rid); + + if (print_this && app.opts.date_given) + print_this = date_globber.match(rid); + set interesting; // if rid is not marked we can jump directly to the marked ancestors, // otherwise we need to visit the parents @@ -964,6 +1020,8 @@ CMD(log, "log", "", CMD_REF(informative) cout << out_system; else graph.print(rid, interesting, out_system); + + cout.flush(); } else if (use_markings && !app.opts.no_graph) graph.print(rid, interesting, ============================================================ --- cmd_ws_commit.cc 55bf3a32074c86e68d93fc43bdfaf217dcf61476 +++ cmd_ws_commit.cc 8cf3dd2b94ac78d1872281c43906e8d8f87bf665 @@ -1085,9 +1085,9 @@ CMD(commit, "commit", "ci", CMD_REF(work CMD(commit, "commit", "ci", CMD_REF(workspace), N_("[PATH]..."), N_("Commits workspace changes to the database"), "", - options::opts::branch | options::opts::message | options::opts::msgfile - | options::opts::date | options::opts::author | options::opts::depth - | options::opts::exclude) + options::opts::branch | options::opts::message | options::opts::msgfile | + options::opts::date | options::opts::author | options::opts::depth | + options::opts::exclude) { database db(app); key_store keys(app); ============================================================ --- options_list.hh 378027f37a6be67813e219ef02b3450d70dee2e4 +++ options_list.hh c8cb455b2b3eae1cebb293f799987c8f92cf9a37 @@ -165,18 +165,11 @@ GOPT(no_default_confdir, "no-default-con } #endif -OPT(date, "date", date_t, , +OPT(date, "date", std::string, , gettext_noop("override date/time for commit")) #ifdef option_bodies { - try - { - date = date_t(arg); - } - catch (std::exception &e) - { - throw bad_arg_internal(e.what()); - } + date = arg; } #endif ============================================================ --- project.cc 86618b33d4154fb81225a6fb34480ebf63c1d220 +++ project.cc a74422b7bd8cda784839e15882261ebb798c16d4 @@ -350,7 +350,7 @@ project_t::put_standard_certs_from_optio { date_t date; if (opts.date_given) - date = opts.date; + date = date_t(opts.date); else date = date_t::now(); ============================================================ --- work.cc 8639fa3a282cb2ce24dd2b582d9be4ad833b43ac +++ work.cc e57d238d69746e7c28770be5f588294a9f624f21 @@ -467,7 +467,7 @@ workspace::get_options(options & opts) opts.key_dir_given = true; } - if (opts.branch().empty() && !workspace_branch().empty()) + if (!opts.branch_given && !workspace_branch().empty()) { opts.branch = workspace_branch; branch_is_sticky = true;