# # # delete "tests/automate_get_revision/expected2" # # patch "NEWS" # from [5ec365e12d5019e6aa57168d9774b9d261319fff] # to [7abc7f1445a83e0c15527d2686750fc1eea143ef] # # patch "automate.cc" # from [3b00aaab59f25242202fb0768290952122e17583] # to [0cf7d9f616bf0c51ba9038a38bbc18a7b0635ce5] # # patch "monotone.texi" # from [93f947bdd8181f8c36ac6a04c926be4d0f45a3c5] # to [55b5571894d88207a2251fd6eccfa922534bcbc2] # # patch "tests/automate_get_current_revision/__driver__.lua" # from [dc822a42c1e122836b812958cb6aa5e8f2f76cd2] # to [7fc7f1ab42d64321b50735919feab05536f7d25a] # # patch "tests/automate_get_current_revision_id/__driver__.lua" # from [e47ff08a045482db81b698d51752069bbffb2a56] # to [f0f457f58dc21abc321660374cfa48d3fcecc724] # # patch "tests/automate_get_revision/__driver__.lua" # from [86d844d42180fe5d15d92feb3ead32d41438cec3] # to [7829cd17ae7c8bef765f962c12bd8922d73939cf] # # patch "tests/merge_into_workspace_files_added/__driver__.lua" # from [e09ec5adbbdd7e60dc85d72fbbb8029152a9cce3] # to [f82162202f622b3740678a48d948486744408b59] # # patch "tests/normalized_filenames/__driver__.lua" # from [2948e8e6933cdf7851d6892df016aec48bf54525] # to [efb87fb9db95c9de10d34d47cef41694aad67780] # # patch "tests/pluck_lifecycle/__driver__.lua" # from [9108772eb30390339e6e827295af01751a471562] # to [e8bec243a84a65c3089a64fdd393f518c324fcce] # # patch "tests/workspace_migration/__driver__.lua" # from [e3b4942919d5e99c74ae0098986fa216d780bf40] # to [50f17508a5202fd16f9dd1db9c46b69413b101e9] # # patch "tests/ws_ops_with_wrong_node_type/__driver__.lua" # from [03a8a667a4e0da6917d7f00774021fe19e117207] # to [484fd66d2cda9044cdc048298f75c0accfe5ff16] # ============================================================ --- NEWS 5ec365e12d5019e6aa57168d9774b9d261319fff +++ NEWS 7abc7f1445a83e0c15527d2686750fc1eea143ef @@ -12,6 +12,10 @@ which returns all database variables similar to 'list vars' in basic_io format, optionally restricted by domain. + - The REVID argument of 'automate get_revision' is now mandatory; + to retrieve the current workspace revision, use the new command + 'automate get_current_revision' + - messages describing conflicts from all of the various merge commands have been reworked and should be much more informative. @@ -53,8 +57,8 @@ directories. The typical case of listing files that need attention now runs at least four times faster. - - 'automate get_current_revision' retrieves restricted revision - represented by current workspace + - 'automate get_current_revision' which outputs the revision text of + changes in the current workspace Wed Dec 12 21:21:15 UTC 2007 ============================================================ --- automate.cc 3b00aaab59f25242202fb0768290952122e17583 +++ automate.cc 0cf7d9f616bf0c51ba9038a38bbc18a7b0635ce5 @@ -1094,9 +1094,9 @@ CMD_AUTOMATE(inventory, N_("[PATH]...") // Name: get_revision // Arguments: -// 1: a revision id (optional, determined from the workspace if -// non-existant) +// 1: a revision id // Added in: 1.0 +// Changed in: 7.0 (REVID argument is now mandatory) // Purpose: Prints change information for the specified revision id. // There are several changes that are described; each of these is @@ -1155,41 +1155,22 @@ CMD_AUTOMATE(inventory, N_("[PATH]...") // the same type will be sorted by the filename they refer to. // Error conditions: If the revision specified is unknown or invalid // prints an error message to stderr and exits with status 1. -CMD_AUTOMATE(get_revision, N_("[REVID]"), +CMD_AUTOMATE(get_revision, N_("REVID"), N_("Shows change information for a revision"), "", options::opts::none) { - N(args.size() < 2, + N(args.size() == 1, F("wrong argument count")); - temp_node_id_source nis; revision_data dat; revision_id ident; - if (args.size() == 0) - { - roster_t new_roster; - parent_map old_rosters; - revision_t rev; + ident = revision_id(idx(args, 0)()); + N(app.db.revision_exists(ident), + F("no revision %s found in database") % ident); + app.db.get_revision(ident, dat); - app.require_workspace(); - app.work.get_parent_rosters(old_rosters); - app.work.get_current_roster_shape(new_roster, nis); - app.work.update_current_roster_from_filesystem(new_roster); - - make_revision(old_rosters, new_roster, rev); - calculate_ident(rev, ident); - write_revision(rev, dat); - } - else - { - ident = revision_id(idx(args, 0)()); - N(app.db.revision_exists(ident), - F("no revision %s found in database") % ident); - app.db.get_revision(ident, dat); - } - L(FL("dumping revision %s") % ident); output.write(dat.inner()().data(), dat.inner()().size()); } @@ -1198,6 +1179,8 @@ CMD_AUTOMATE(get_revision, N_("[REVID]") // Arguments: // 1: list of restriction paths // Added in: 7.0 +// Purpose: Outputs (an optionally restricted) revision based on +// changes in the current workspace CMD_AUTOMATE(get_current_revision, N_("[PATHS ...]"), N_("Shows change information for a workspace"), @@ -1207,21 +1190,21 @@ CMD_AUTOMATE(get_current_revision, N_("[ temp_node_id_source nis; revision_data dat; revision_id ident; - + roster_t new_roster; parent_map old_rosters; revision_t rev; cset excluded; - + app.require_workspace(); app.work.get_parent_rosters(old_rosters); app.work.get_current_roster_shape(new_roster, nis); - + node_restriction mask(args_to_paths(args), args_to_paths(app.opts.exclude_patterns), app.opts.depth, old_rosters, new_roster, app); - + app.work.update_current_roster_from_filesystem(new_roster, mask); make_revision(old_rosters, new_roster, rev); @@ -1229,7 +1212,7 @@ CMD_AUTOMATE(get_current_revision, N_("[ excluded, execid); calculate_ident(rev, ident); write_revision(rev, dat); - + L(FL("dumping revision %s") % ident); output.write(dat.inner()().data(), dat.inner()().size()); } ============================================================ --- monotone.texi 93f947bdd8181f8c36ac6a04c926be4d0f45a3c5 +++ monotone.texi 55b5571894d88207a2251fd6eccfa922534bcbc2 @@ -7272,20 +7272,23 @@ @section Automation @end table address@hidden mtn automate get_revision @item mtn automate get_revision @var{id} @table @strong @item Arguments: -Specifying the option @var{id} argument outputs the changeset -information for the specified @var{id}. Otherwise, @var{id} is -determined from the workspace. +The argument @var{id} specifies the revision id for which the changeset +information should be printed. @item Added in: 1.0 address@hidden Changed in: + +7.0 (@var{id} is now mandatory) + + @item Purpose: Prints change information for the specified revision id. @@ -7392,7 +7395,8 @@ @section Automation @item Purpose: -Prints change information for the restricted workspace revision. +Prints change information for the current workspace, optionally restricted by +one or more paths. @item Sample output: ============================================================ --- tests/automate_get_current_revision/__driver__.lua dc822a42c1e122836b812958cb6aa5e8f2f76cd2 +++ tests/automate_get_current_revision/__driver__.lua 7fc7f1ab42d64321b50735919feab05536f7d25a @@ -5,14 +5,14 @@ check(mtn("commit", "--date=2005-05-21T1 check(mtn("commit", "--date=2005-05-21T12:30:51", "--branch=testbranch", "--message=blah-blah"), 0, false, false) --- ensure that bad restriction paths fails +-- ensure that bad restriction paths fail check(mtn("automate", "get_current_revision", "foo-bar"), 1, true, false) check(fsize("stdout") == 0) addfile("foox", "blah\n") addfile("barx", "blah2\n") --- ensure that no resrtiction yields the same as '.' as restriction +-- ensure that no restriction yields the same as '.' as restriction check(mtn("automate", "get_current_revision"), 0, true, false) no_restrict = get("stdout") @@ -50,8 +50,7 @@ check( qgrep("ttt/xxx/vvv", "stdout" check(mtn("automate", "get_current_revision", "--depth=0", "ttt", "ttt/xxx", "ttt/xxx/vvv"), 0, true, false) check( qgrep("ttt/xxx/vvv", "stdout") ) -- XXX: check node_restriction for --- looks like yyy gets into revision even if we explicitly --- forbidden recursion +-- looks like yyy gets into revision even if we explicitly forbid recursion -- check( not qgrep("yyy", "stdout") ) check( not qgrep("zzz", "stdout") ) check( not qgrep("foox", "stdout") ) ============================================================ --- tests/automate_get_current_revision_id/__driver__.lua e47ff08a045482db81b698d51752069bbffb2a56 +++ tests/automate_get_current_revision_id/__driver__.lua f0f457f58dc21abc321660374cfa48d3fcecc724 @@ -1,10 +1,10 @@ function chk() mtn_setup() function chk() check(mtn("automate", "get_current_revision_id"), 0, true, false) rename("stdout", "current") - check(mtn("automate", "get_revision"), 0, true) + check(mtn("automate", "get_current_revision"), 0, true) check(mtn("identify"), 0, true, nil, {"stdout"}) check(trim(readfile("current")) == trim(readfile("stdout"))) end ============================================================ --- tests/automate_get_revision/__driver__.lua 86d844d42180fe5d15d92feb3ead32d41438cec3 +++ tests/automate_get_revision/__driver__.lua 7829cd17ae7c8bef765f962c12bd8922d73939cf @@ -1,8 +1,7 @@ check(get("expected")) mtn_setup() check(get("expected")) -check(get("expected2")) addfile("foo", "blah\n") check(mtn("commit", "--date=2005-05-21T12:30:51", @@ -14,10 +13,8 @@ check(samefile("expected", "stdout")) canonicalize("stdout") check(samefile("expected", "stdout")) --- should work even if we don't specify the revision -check(mtn("automate", "get_revision"), 0, true, false) -canonicalize("stdout") -check(samefile("expected2", "stdout")) +-- should error out if we don't specify the revision +check(mtn("automate", "get_revision"), 1, false, false) -- ensure that missing revisions fail check(mtn("automate", "get_file", string.rep("0", 40)), 1, true, false) ============================================================ --- tests/merge_into_workspace_files_added/__driver__.lua e09ec5adbbdd7e60dc85d72fbbb8029152a9cce3 +++ tests/merge_into_workspace_files_added/__driver__.lua f82162202f622b3740678a48d948486744408b59 @@ -43,7 +43,7 @@ check(get("expected-revision")) -- "automate get_revision" should report each of "left" and "right" as -- added versus their respective parents, and no other changes check(get("expected-revision")) -check(mtn("automate", "get_revision"), 0, {"expected-revision"}, nil) +check(mtn("automate", "get_current_revision"), 0, {"expected-revision"}, nil) -- a commit at this point should succeed commit() ============================================================ --- tests/normalized_filenames/__driver__.lua 2948e8e6933cdf7851d6892df016aec48bf54525 +++ tests/normalized_filenames/__driver__.lua efb87fb9db95c9de10d34d47cef41694aad67780 @@ -10,5 +10,5 @@ check(mtn("automate", "get_manifest_of") append("_MTN/revision", '\nadd_dir "./bar"\n') check(mtn("automate", "get_manifest_of"), 3, false, false) -check(mtn("automate", "get_revision"), 3, false, false) +check(mtn("automate", "get_current_revision"), 3, false, false) check(mtn("commit", "--message=foo", "--branch=foo"), 3, false, false) ============================================================ --- tests/pluck_lifecycle/__driver__.lua 9108772eb30390339e6e827295af01751a471562 +++ tests/pluck_lifecycle/__driver__.lua e8bec243a84a65c3089a64fdd393f518c324fcce @@ -51,7 +51,7 @@ check(readfile("b") == "updated\n", 0, f check(readfile("b") == "updated\n", 0, false, false) -- check the pending rev; we don't expect to see changes from two_rev -check(mtn("automate", "get_revision"), 0, true, false) +check(mtn("automate", "get_current_revision"), 0, true, false) check(not qgrep("delete", "stdout")) check(not qgrep("add_file", "stdout")) ============================================================ --- tests/workspace_migration/__driver__.lua e3b4942919d5e99c74ae0098986fa216d780bf40 +++ tests/workspace_migration/__driver__.lua 50f17508a5202fd16f9dd1db9c46b69413b101e9 @@ -48,9 +48,9 @@ function check_workspace_matches_current function check_workspace_matches_current(dir, refdir) check(samefile("nonsense-options", dir.."/_MTN/options")) - check(indir(refdir, mtn("automate", "get_revision")), 0, true, false) + check(indir(refdir, mtn("automate", "get_current_revision")), 0, true, false) rename("stdout", "current-rev") - check(indir(dir, mtn("automate", "get_revision")), 0, true, false) + check(indir(dir, mtn("automate", "get_current_revision")), 0, true, false) check(samefile("stdout", "current-rev")) -- and the log file check(samefile(dir .. "/_MTN/log", refdir .. "/_MTN/log")) ============================================================ --- tests/ws_ops_with_wrong_node_type/__driver__.lua 03a8a667a4e0da6917d7f00774021fe19e117207 +++ tests/ws_ops_with_wrong_node_type/__driver__.lua 484fd66d2cda9044cdc048298f75c0accfe5ff16 @@ -5,12 +5,12 @@ commit() check(mtn("add", "dir"), 0, false, false) commit() -check(mtn("automate", "get_revision"), 0, true, false) +check(mtn("automate", "get_current_revision"), 0, true, false) rename("stdout", "orig_rev") -- fail to move a dir under a file check(mtn("rename", "--bookkeep-only", "dir", "file/subdir"), 1, false, false) -check(mtn("automate", "get_revision"), 0, true, false) +check(mtn("automate", "get_current_revision"), 0, true, false) check(samefile("stdout", "orig_rev")) -- running a recursive add what's supposed to be a file, but is actually a