# # add_file "tests/t_netsync_globs.at" # # patch "ChangeLog" # from [ce8e52ee011a7e9a7905d6ea8b6260a6c049df56] # to [25e008239fd5cad9a208851b8bcd0d7f3be03de5] # # patch "globish.cc" # from [6ae57bf040ce47674abb56f2e0c764f994d5ee62] # to [276e3e515b8fbdc98b00b49c6f7f331affd0053f] # # patch "tests/t_netsync_globs.at" # from [] # to [3dff1121e0e6897d4f16ed9141253806e5b65939] # # patch "testsuite.at" # from [e6acd9db25c55028d15b0e56f32214a94e55b4fc] # to [3d2b4ab8782f8c58fb72a8a12793ba102105e2c7] # --- ChangeLog +++ ChangeLog @@ -1,3 +1,9 @@ +2005-07-05 Nathaniel Smith + + * globish.cc (combine_and_check_globish): Don't add unnecessary + {}'s. + * tests/t_netsync_globs.at, testsuite.at: New test. + 2005-07-04 Nathaniel Smith * netcmd.cc (do_netcmd_roundtrip, test_netcmd_mac): Update for new --- globish.cc +++ globish.cc @@ -100,10 +100,11 @@ } void -combine_and_check_globish(std::set const &patterns, utf8 & pattern) +combine_and_check_globish(std::set const & patterns, utf8 & pattern) { std::string p; - p += '{'; + if (patterns.size() > 1) + p += '{'; bool first = true; for (std::set::const_iterator i = patterns.begin(); i != patterns.end(); ++i) { @@ -115,7 +116,8 @@ first = false; p += (*i)(); } - p += '}'; + if (patterns.size() > 1) + p += '}'; pattern = utf8(p); } --- tests/t_netsync_globs.at +++ tests/t_netsync_globs.at @@ -0,0 +1,40 @@ +AT_SETUP([netsync with globs]) +MONOTONE_SETUP +NETSYNC_SETUP + +ADD_FILE(testfile, [foo +]) +COMMIT(1branch1) +REV11=`BASE_REVISION` + +AT_CHECK(rm -rf MT) +AT_CHECK(MONOTONE setup .) +ADD_FILE(testfile, [bar +]) +COMMIT(1branch2) +REV12=`BASE_REVISION` + +AT_CHECK(rm -rf MT) +AT_CHECK(MONOTONE setup .) +ADD_FILE(testfile, [baz +]) +COMMIT(2branch1) +REV21=`BASE_REVISION` + +NETSYNC_SERVE_START("*") + +# check a glob +NETSYNC_CLIENT_N_RUN(2, pull, "*anch2") +AT_CHECK(MONOTONE2 cat revision $REV12, [], [ignore], [ignore]) +AT_CHECK(MONOTONE2 cat revision $REV11, [1], [ignore], [ignore]) +AT_CHECK(MONOTONE2 cat revision $REV21, [1], [ignore], [ignore]) + +# check explicit multiple branches +NETSYNC_CLIENT_N_RUN(3, pull, 1branch1 2branch1) +AT_CHECK(MONOTONE3 cat revision $REV12, [1], [ignore], [ignore]) +AT_CHECK(MONOTONE3 cat revision $REV11, [], [ignore], [ignore]) +AT_CHECK(MONOTONE3 cat revision $REV21, [], [ignore], [ignore]) + +NETSYNC_SERVE_STOP + +AT_CLEANUP --- testsuite.at +++ testsuite.at @@ -661,3 +661,4 @@ m4_include(tests/t_status.at) m4_include(tests/t_rcfile_dir.at) m4_include(tests/t_lua_includedir.at) +m4_include(tests/t_netsync_globs.at)