# # patch "ChangeLog" # from [0224581c6a31cc101294b0a2473a084ee03fee8b] # to [e982eddbf888a6572202ccfc1ff02f5da407abc8] # # patch "automate.cc" # from [a39a6df56427a12cf3e79ee2cd155e5239393560] # to [dc6c34d27c31057be28379b197a9ba535716e713] # # patch "monotone.texi" # from [383efd9fcf269d36a6519cea9645d7a674be4478] # to [86788028f6e7a05e423af34635bd568f6966eb40] # # patch "tests/t_automate_ancestors.at" # from [c36a2bcf865fd4a911a178f824210a68fc2e6751] # to [124aceb5207b063700bcf665cfafd5ffd48b7cd1] # --- ChangeLog +++ ChangeLog @@ -1,4 +1,10 @@ 2005-04-20 Sebastian Spaeth + * automate.cc: fix typo, add sanity check to avoid empty r_id's + bein passed in. The automate version was bumped to 0.2 due to + popular request of a single person. + * t_automate_ancestors.at: adapt test; it passes now + +2005-04-20 Sebastian Spaeth * testuite.at: * t_automate_ancestors.at: new test; automate ancestors. This is still _failing_ as a) it outputs empty newlines when no ancestor exists and --- automate.cc +++ automate.cc @@ -12,7 +12,7 @@ #include "commands.hh" #include "revision.hh" -static std::string const interface_version = "0.1"; +static std::string const interface_version = "0.2"; // Name: interface_version // Arguments: none @@ -66,7 +66,7 @@ // Name: ancestors // Arguments: // 1 or more: revision ids -// Added in: 0.1 +// Added in: 0.2 // Purpose: Prints the ancestors (exclusive) of the given revisions // Output format: A list of revision ids, in hexadecimal, each followed by a // newline. Revision ids are printed in alphabetically sorted order. @@ -93,23 +93,27 @@ { revision_id rid = frontier.back(); frontier.pop_back(); - std::set parents; - app.db.get_revision_parents(rid, ancestors); - for (std::set::const_iterator i = parents.begin(); - i != parents.end(); ++i) - { - if (ancestors.find(*i) == ancestors.end()) - { - frontier.push_back(*i); - ancestors.insert(*i); - } - } + if(!null_id(rid)) { + std::set parents; + app.db.get_revision_parents(rid, parents); + for (std::set::const_iterator i = parents.begin(); + i != parents.end(); ++i) + { + if (ancestors.find(*i) == ancestors.end()) + { + frontier.push_back(*i); + ancestors.insert(*i); + } + } + } } for (std::set::const_iterator i = ancestors.begin(); i != ancestors.end(); ++i) - output << (*i).inner()() << std::endl; + if (!null_id(*i)) + output << (*i).inner()() << std::endl; } + // Name: descendents // Arguments: // 1 or more: revision ids --- monotone.texi +++ monotone.texi @@ -4302,7 +4302,7 @@ @item Added in: -0.1 +0.2 @item Purpose: --- tests/t_automate_ancestors.at +++ tests/t_automate_ancestors.at @@ -67,9 +67,13 @@ AT_CHECK(MONOTONE automate ancestors $REV_E, [], [stdout], [ignore]) AT_CHECK(CANONICALISE(stdout)) AT_CHECK(echo $REV_C > tmp) -AT_CHECK(cmp tmp stdout) +AT_CHECK(echo $REV_A >> tmp) +AT_CHECK(sort tmp > tmp2) +AT_CHECK(cmp tmp2 stdout) AT_CHECK(echo $REV_D > tmp) +AT_CHECK(echo $REV_A >> tmp) +AT_CHECK(echo $REV_C >> tmp) AT_CHECK(echo $REV_E >> tmp) AT_CHECK(sort tmp > tmp2) AT_CHECK(MONOTONE automate ancestors $REV_F, [], [stdout], [ignore])