# # add_file "tests/t_status.at" # # patch "ChangeLog" # from [d8b4e1c1edb8e4b021fe0557d74e745be470fbbf] # to [b142bb9466661d4be7e9738a713327386c0659be] # # patch "commands.cc" # from [5d992c6d2826ea22eba4bfc5366f35e21c433a86] # to [0219fa13f31351d209832ea210bb1e7a46bef761] # # patch "monotone.cc" # from [c2d839bc84a52c398ae42a860f31b87d0004cc85] # to [8469a8de748e5eb3958f74fc204703a041b1a86c] # # patch "monotone.texi" # from [a17c1a2ee169272aafec741dcc5f6b41908548d0] # to [6fb3fe1d81b2cc330e4dc04e54df634721817965] # # patch "tests/t_status.at" # from [] # to [0b361ba1ed3579bcd794fb3edd21a881f4a46e23] # # patch "testsuite.at" # from [353e351595bd4a6dadf8360e19ee41a4f4d8e68a] # to [2635480ab5d48f5eae96909a5e59ef20a7b0c36d] # --- ChangeLog +++ ChangeLog @@ -1,3 +1,16 @@ +2005-06-11 Derek Scherger + + * commands.cc (complete_command): log command expansion messages + with L instead of P to reduce chatter + (status): add --brief option and corresponding output + (identify): add trailing space to comment gcc complains about + * monotone.cc: fix comment typo and add additional details for + command specific options + * monotone.texi (Automation): list inventory status code + combinations and descriptions + * tests/t_status.at: new test of status command and --brief option + * testsuite.at: add it + 2005-06-11 Matt Johnston * commands.cc: revert should ignore the ignore hooks, otherwise bad --- commands.cc +++ commands.cc @@ -129,7 +129,7 @@ { if (cmd.length() == 0 || cmds.find(cmd) != cmds.end()) return cmd; - P(F("expanding command '%s'\n") % cmd); + L(F("expanding command '%s'\n") % cmd); vector matched; @@ -146,7 +146,7 @@ if (matched.size() == 1) { string completed = *matched.begin(); - P(F("expanded command to '%s'\n") % completed); + L(F("expanded command to '%s'\n") % completed); return completed; } else if (matched.size() > 1) @@ -1263,7 +1263,7 @@ } CMD(status, "informative", "[PATH]...", "show status of working copy", - OPT_DEPTH) + OPT_DEPTH % OPT_BRIEF) { revision_set rs; manifest_map m_old, m_new; @@ -1273,8 +1273,50 @@ calculate_restricted_revision(app, args, rs, m_old, m_new); - write_revision_set(rs, tmp); - cout << endl << tmp << endl; + if (global_sanity.brief) + { + I(rs.edges.size() == 1); + change_set const & changes = edge_changes(rs.edges.begin()); + change_set::path_rearrangement const & rearrangement = changes.rearrangement; + change_set::delta_map const & deltas = changes.deltas; + + for (path_set::const_iterator i = rearrangement.deleted_files.begin(); + i != rearrangement.deleted_files.end(); ++i) + cout << "dropped " << *i << endl; + + for (path_set::const_iterator i = rearrangement.deleted_dirs.begin(); + i != rearrangement.deleted_dirs.end(); ++i) + cout << "dropped " << *i << "/" << endl; + + for (map::const_iterator + i = rearrangement.renamed_files.begin(); + i != rearrangement.renamed_files.end(); ++i) + cout << "renamed " << i->first << endl + << " to " << i->second << endl; + + for (map::const_iterator + i = rearrangement.renamed_dirs.begin(); + i != rearrangement.renamed_dirs.end(); ++i) + cout << "renamed " << i->first << "/" << endl + << " to " << i->second << "/" << endl; + + for (path_set::const_iterator i = rearrangement.added_files.begin(); + i != rearrangement.added_files.end(); ++i) + cout << "added " << *i << endl; + + for (change_set::delta_map::const_iterator i = deltas.begin(); + i != deltas.end(); ++i) + { + // don't bother printing patches on added files + if (rearrangement.added_files.find(i->first) == rearrangement.added_files.end()) + cout << "patched " << i->first << endl; + } + } + else + { + write_revision_set(rs, tmp); + cout << endl << tmp << endl; + } } CMD(identify, "working copy", "[PATH]", "calculate identity of PATH or stdin", @@ -2949,7 +2991,7 @@ // we have the following // // old --- working - // \ \ + // \ \ // chosen --- merged // // - old is the revision specified in MT/revision --- monotone.cc +++ monotone.cc @@ -35,9 +35,12 @@ char * argstr = NULL; long arglong = 0; -// Options are divide into two tables. The first one is command-specific +// Options are split between two tables. The first one is command-specific // options (hence the `c' in `coptions'). The second is the global one // with options that aren't tied to specific commands. +// +// the intent is to ensure that any command specific options mean the same +// thing to all commands that use them struct poptOption coptions[] = { --- monotone.texi +++ monotone.texi @@ -5006,6 +5006,65 @@ 'M' the file is missing but is included in the current manifest @end verbatim +Note that there are 45 possible status code combinations, some of which +are not valid, detailed below. + address@hidden +' ' unchanged +' P' patched (contents changed) +' U' unknown (exists on the filesystem but not tracked) +' I' ignored (exists on the filesystem but excluded by lua hook) +' M' missing (exists in the manifest but not on the filesystem) + +' A ' added (invalid, add should have associated patch) +' AP' added and patched +' AU' added but unknown (invalid) +' AI' added but ignored (seems invalid, but may be possible?) +' AM' added but missing from the filesystem + +' R ' rename target +' RP' rename target and patched +' RU' rename target but unknown (invalid) +' RI' rename target but ignored (seems invalid, but may be possible?) +' RM' rename target but missing from the filesystem + +'D ' dropped +'D P' dropped and patched (invalid) +'D U' dropped and unknown (still exists on the filesystem) +'D I' dropped and ignored (seems invalid, but may be possible?) +'D M' dropped and missing (invalid) + +'DA ' dropped and added (invalid, add should have associated patch) +'DAP' dropped and added and patched +'DAU' dropped and added but unknown (invalid) +'DAI' dropped and added but ignored (seems invalid, but may be possible?) +'DAM' dropped and added but missing from the filesystem + +'DR ' dropped and rename target +'DRP' dropped and rename target and patched +'DRU' dropped and rename target but unknown (invalid) +'DRI' dropped and rename target but ignored (invalid) +'DRM' dropped and rename target but missing from the filesystem + +'R ' rename source +'R P' rename source and patched (invalid) +'R U' rename source and unknown (still exists on the filesystem) +'R I' rename source and ignored (seems invalid, but may be possible?) +'R M' rename source and missing (invalid) + +'RA ' rename source and added (invalid, add should have associated patch) +'RAP' rename source and added and patched +'RAU' rename source and added but unknown (invalid) +'RAI' rename source and added but ignored (seems invalid, but may be possible?) +'RAM' rename source and added but missing from the filesystem + +'RR ' rename source and target +'RRP' rename source and target and target patched +'RRU' rename source and target and target unknown (invalid) +'RRI' rename source and target and target ignored (seems invalid, but may be possible?) +'RRM' rename source and target and target missing address@hidden verbatim + Full support for versioned directories is not yet complete and the inventory will only list entries for renamed or dropped directories. --- tests/t_status.at +++ tests/t_status.at @@ -0,0 +1,63 @@ +AT_SETUP([status with missing files]) +MONOTONE_SETUP + +# patch existing file +# add new file (with patch) +# rename existing file +# rename and patch existing file +# drop existing file + +# again with --brief + +ADD_FILE(from, [from +]) +ADD_FILE(from_patched, [from_patched +]) +ADD_FILE(patched, [patched +]) +ADD_FILE(dropped, [dropped +]) + +COMMIT(testbranch) + +ADD_FILE(added, [added +]) + +AT_DATA(from_patched, [from_patched +patched +]) +AT_DATA(patched, [patched +patched +]) + +AT_CHECK(MONOTONE drop dropped, [], [ignore], [ignore]) + +AT_CHECK(mv from to, [], [ignore], [ignore]) +AT_CHECK(mv from_patched to_patched, [], [ignore], [ignore]) + +AT_CHECK(MONOTONE rename from to, [], [ignore], [ignore]) +AT_CHECK(MONOTONE rename from_patched to_patched, [], [ignore], [ignore]) + +AT_CHECK(MONOTONE status, [], [stdout], [ignore]) +AT_CHECK(grep '^delete_file "dropped"' stdout, [], [ignore], [ignore]) +AT_CHECK(grep '^rename_file "from"' stdout, [], [ignore], [ignore]) +AT_CHECK(grep '^ to "to"' stdout, [], [ignore], [ignore]) +AT_CHECK(grep '^rename_file "from_patched"' stdout, [], [ignore], [ignore]) +AT_CHECK(grep '^ to "to_patched"' stdout, [], [ignore], [ignore]) +AT_CHECK(grep '^add_file "added"' stdout, [], [ignore], [ignore]) +AT_CHECK(grep '^patch "added"' stdout, [], [ignore], [ignore]) +AT_CHECK(grep '^patch "patched"' stdout, [], [ignore], [ignore]) +AT_CHECK(grep '^patch "to_patched"' stdout, [], [ignore], [ignore]) + +AT_CHECK(MONOTONE status --brief, [], [stdout], [ignore]) +AT_CHECK(grep '^dropped dropped' stdout, [], [ignore], [ignore]) +AT_CHECK(grep '^renamed from' stdout, [], [ignore], [ignore]) +AT_CHECK(grep '^ to to' stdout, [], [ignore], [ignore]) +AT_CHECK(grep '^renamed from_patched' stdout, [], [ignore], [ignore]) +AT_CHECK(grep '^ to to_patched' stdout, [], [ignore], [ignore]) +AT_CHECK(grep '^added added' stdout, [], [ignore], [ignore]) +AT_CHECK(grep '^patched added' stdout, [1], [ignore], [ignore]) +AT_CHECK(grep '^patched patched' stdout, [], [ignore], [ignore]) +AT_CHECK(grep '^patched to_patched' stdout, [], [ignore], [ignore]) + +AT_CLEANUP --- testsuite.at +++ testsuite.at @@ -658,3 +658,5 @@ m4_include(tests/t_restricted_commit_with_inodeprints.at) m4_include(tests/t_merge_manual.at) m4_include(tests/t_revert_restrict.at) +m4_include(tests/t_status.at) +