# # patch "commands.cc" # from [400007bbe4081dd7a864b5846eec71e141728c67] # to [818fd46e80adbfe53c903b22bf76e03279b8363b] # # patch "database.cc" # from [86ca32f9f4b9c948c428c2bf5b4945f93e4f80be] # to [2f0d694a3ff58c86f98ae425dba01c9f0e467578] # # patch "monotone.texi" # from [0911de02d10901b09939d1b699c3a347dade0a79] # to [04108f667408cf261bf63a145abede097a3d282b] # --- commands.cc +++ commands.cc @@ -3767,27 +3767,23 @@ } -CMD(annotate, "informative", "[ID] file", "print annotated copy of 'file' from revision 'ID')") +CMD(annotate, "informative", "[--revision=REVISION] PATH", "print annotated copy of the file from REVISION") { revision_id rid; file_path file; - if ((args.size() > 2) || (args.size() < 1)) + 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) - { - app.require_working_copy(); // no id arg, must have working copy + file=file_path(idx(args, 0)()); + if (app.revision_selectors.size() == 0) + get_revision_id(rid); + else + complete(app, idx(app.revision_selectors, 0)(), rid); - file = file_path(idx(args, 0)()); - get_revision_id(rid); - } - L(F("annotate file file_path '%s'\n") % file); // find the version of the file requested @@ -3796,9 +3792,8 @@ app.db.get_revision(rid, rev); app.db.get_manifest(rev.new_manifest, mm); manifest_map::const_iterator i = mm.find(file); - //N(i != mm.end(), - // L(F("No such file '%s' in revision %s\n") % file % rid)); - I(i != mm.end()); + N(i != mm.end(), + F("No such file '%s' in revision %s\n") % file % rid); file_id fid = manifest_entry_id(*i); L(F("annotate for file_id %s\n") % manifest_entry_id(*i)); --- database.cc +++ database.cc @@ -895,42 +895,6 @@ unpack(del_packed, del); } - -void -database::get_file_delta(file_id const & src, - file_id const & dst, - file_delta & del) -{ - results res; - // FIXME: testing, only ever do it the hard way - if (0) { //try { - fetch(res, one_col, one_row, - "SELECT delta from '%q' WHERE id = '%q' AND base = '%q'", - "file_deltas", (src.inner())().c_str(), (dst.inner())().c_str()); - del = file_delta(res[0][0]); - } else { //} catch (...) { - // no delta, try to fetch each file and construct delta - file_data src_data, dst_data; - - get_file_version(src, src_data); - get_file_version(dst, dst_data); - - data src_unpacked, dst_unpacked; - //unpack(src_data.inner(), src_unpacked); - //unpack(dst_data.inner(), dst_unpacked); - src_unpacked = src_data.inner(); - dst_unpacked = dst_data.inner(); - - // do the xdelta - string result; - compute_delta(src_unpacked(), dst_unpacked(), result); - //compute_delta(dst_unpacked(), src_unpacked(), result); - base64< gzip > del_inner; - pack(delta(result), del_inner); - del = file_delta(delta(result)); //del_inner); - } -} - void database::put(hexenc const & ident, data const & dat, --- monotone.texi +++ monotone.texi @@ -3640,7 +3640,7 @@ copy. @item monotone annotate @var{file} address@hidden monotone annotate @var{file} @var{id} address@hidden monotone annotate address@hidden @var{file} Dumps an annotated copy of the file to stdout. Each line of the file is translated to : in the output, where