# # # add_file "tests/t_automate_common_ancestors.at" # content [94723f6ac9d44fc4ea4953ab61d998a497f59174] # # patch "ChangeLog" # from [e9e8644c9797016151bce85adfc60ae717dc3106] # to [d205040f4f1cc400c1b107c350060fc8e8399746] # # patch "automate.cc" # from [98ecc36c35fa4e784477961ca856cecfb38f30bd] # to [5bba76ec5f876b32c8dae8f064196cac46a6e59e] # # patch "cmd_automate.cc" # from [bf13b71b0bfaf0c50f5e06eb0dd2d1685335250a] # to [d973f6704cc5cf5a777b8e4f5bdd60ee10048b7c] # # patch "monotone.texi" # from [a8090f78bdbff0e198d5ab8da6d20439e67c71e4] # to [802a23b113a4364948bafcd21ba2e9441a09e471] # # patch "testsuite.at" # from [0cfa0b8041e6430815f65965145117420a9b8110] # to [24507499f62a5b6244fcc625a0af06168be34dbf] # ============================================================ --- tests/t_automate_common_ancestors.at 94723f6ac9d44fc4ea4953ab61d998a497f59174 +++ tests/t_automate_common_ancestors.at 94723f6ac9d44fc4ea4953ab61d998a497f59174 @@ -0,0 +1,91 @@ +AT_SETUP([automate common_ancestors]) +MTN_SETUP + +# A +# / \ +# B C +# |\ +# D E +# \/ +# F + +ADD_FILE(testfile, [A +]) +COMMIT(testbranch) +REV_A=`BASE_REVISION` + +SET_FILE(testfile, [B +]) +COMMIT(testbranch) +REV_B=`BASE_REVISION` + +REVERT_TO($REV_A) + +SET_FILE(testfile, [C +]) +COMMIT(testbranch) +REV_C=`BASE_REVISION` + +SET_FILE(testfile, [D +]) +COMMIT(testbranch) +REV_D=`BASE_REVISION` + +REVERT_TO($REV_C) + +ADD_FILE(otherfile, [E +]) +COMMIT(testbranch) +REV_E=`BASE_REVISION` + +AT_CHECK(MTN explicit_merge $REV_D $REV_E testbranch, [], [ignore], [ignore]) +AT_CHECK(MTN update, [], [ignore], [ignore]) +REV_F=`BASE_REVISION` + +AT_CHECK(test $REV_F != $REV_D) +AT_CHECK(test $REV_F != $REV_E) + +# Now do some checks + +AT_CHECK(MTN automate common_ancestors c7539264e83c5d6af4c792f079b5d46e9c128665, [1], [ignore], [ignore]) +AT_CHECK(MTN automate common_ancestors $REV_A c7539264e83c5d6af4c792f079b5d46e9c128665, [1], [ignore], [ignore]) + +AT_CHECK(MTN automate common_ancestors $REV_A, [], [stdout], [ignore]) +AT_CHECK(CANONICALISE(stdout)) +CHECK_SAME_STDOUT(cat stdout, echo $REV_A) +AT_CHECK(MTN automate common_ancestors $REV_A $REV_A, [], [stdout], [ignore]) +AT_CHECK(CANONICALISE(stdout)) +CHECK_SAME_STDOUT(cat stdout, echo $REV_A) + +AT_CHECK(MTN automate common_ancestors $REV_A $REV_B, [], [stdout], [ignore]) +AT_CHECK(CANONICALISE(stdout)) +CHECK_SAME_STDOUT(cat stdout, echo $REV_A) + +AT_CHECK(MTN automate common_ancestors $REV_A $REV_F, [], [stdout], [ignore]) +AT_CHECK(CANONICALISE(stdout)) +CHECK_SAME_STDOUT(cat stdout, echo $REV_A) + +AT_CHECK(MTN automate common_ancestors $REV_F $REV_F, [], [stdout], [ignore]) +AT_CHECK(CANONICALISE(stdout)) +AT_CHECK(echo $REV_A >acdef) +AT_CHECK(echo $REV_C >>acdef) +AT_CHECK(echo $REV_D >>acdef) +AT_CHECK(echo $REV_E >>acdef) +AT_CHECK(echo $REV_F >>acdef) +CHECK_SAME_STDOUT(cat stdout, sort acdef) + +AT_CHECK(MTN automate common_ancestors $REV_B $REV_F, [], [stdout], [ignore]) +AT_CHECK(CANONICALISE(stdout)) +CHECK_SAME_STDOUT(cat stdout, echo $REV_A) + +AT_CHECK(MTN automate common_ancestors $REV_F $REV_D $REV_E, [], [stdout], [ignore]) +AT_CHECK(CANONICALISE(stdout)) +AT_CHECK(echo $REV_A >ac) +AT_CHECK(echo $REV_C >>ac) +CHECK_SAME_STDOUT(cat stdout, sort ac) + +AT_CHECK(MTN automate common_ancestors $REV_B $REV_E, [], [stdout], [ignore]) +AT_CHECK(CANONICALISE(stdout)) +CHECK_SAME_STDOUT(cat stdout, echo $REV_A) + +AT_CLEANUP ============================================================ --- ChangeLog e9e8644c9797016151bce85adfc60ae717dc3106 +++ ChangeLog d205040f4f1cc400c1b107c350060fc8e8399746 @@ -1,3 +1,10 @@ +2006-05-16 Timothy Brownawell
+ + * automate.cc: Uncomment automate_common_ancestors. + * tests/t_automate_common_ancestors.at, testsuite.at: Test it. + * monotone.texi: Document it. + * cmd_automate.cc: Add it to the command description for automate. + 2006-05-13 Timothy Brownawell * netsync.cc: (process_hello_cmd) Build our merkle tries after ============================================================ --- automate.cc 98ecc36c35fa4e784477961ca856cecfb38f30bd +++ automate.cc 5bba76ec5f876b32c8dae8f064196cac46a6e59e @@ -27,7 +27,7 @@ #include "keys.hh" #include "packet.hh" -static std::string const interface_version = "2.0"; +static std::string const interface_version = "2.1"; // Name: interface_version // Arguments: none @@ -1607,7 +1607,16 @@ output.write(prt.buf.data(), prt.buf.size()); } -/* FIXME: add test & documentation, then uncomment +// Name: common_ancestors +// Arguments: +// 1 or more revision ids +// Added in: 2.1 +// Purpose: Prints all revisions which are ancestors of all of the revisions +// given as arguments. +// Output format: A list of revision ids, in hexadecimal, each followed by a +// newline. Revisions are printed in alphabetically sorted order. +// Error conditions: If any of the revisions do not exist, prints nothing to +// stdout, prints an error message to stderr, and exits with status 1. static void automate_common_ancestors(std::vector