# # patch "commands.cc" # from [8792a0f332033eefb23dce29a50ac93e002374a5] # to [2c40c9b048b0632f82f720800c692e3250c3ecca] # --- commands.cc +++ commands.cc @@ -3750,43 +3750,26 @@ do_annotate(app, file, fid, rid); } -CMD(log, "informative", "[ID] [file]", "print history in reverse order starting from 'ID' (filtering by 'file')") +CMD(log, "informative", "[--revision=REVISION] [file]", "print history in reverse order starting from revision REVISION (filtering by 'file')") { - revision_set rev; revision_id rid; - set< pair > frontier; file_path file; - if (args.size() > 2) + if (app.revision_selectors.size() == 0) + app.require_working_copy(); + + if (args.size() > 1 || app.revision_selectors.size() > 1) throw usage(name); - if (args.size() == 2) - { - complete(app, idx(args, 0)(), rid); - file = file_path(idx(args, 1)()); - } - else if (args.size() == 1) - { - std::string arg=idx(args, 0)(); - if (arg.find_first_not_of(constants::legal_id_bytes) == string::npos - && arg.size()<=constants::idlen) - { - complete(app, arg, rid); - } - else - { - app.require_working_copy(); // no id arg, must have working copy + if (args.size() > 0) + file=file_path(idx(args, 0)()); /* specified a file */ + + if (app.revision_selectors.size() == 0) + get_revision_id(rid); + else + complete(app, idx(app.revision_selectors, 0)(), rid); - file = file_path(arg); - get_revision_id(rid); - } - } - else - { - app.require_working_copy(); // no id arg, must have working copy - get_revision_id(rid); - } - + set< pair > frontier; frontier.insert(make_pair(file, rid)); cert_name author_name(author_cert_name); @@ -3799,6 +3782,7 @@ set seen; long depth = app.depth; + revision_set rev; while(! frontier.empty() && (depth == -1 || depth > 0)) { set< pair > next_frontier;