# # # rename "tests/clone_-b_no_dir" # to "tests/clone_branch_no_dir" # # patch "NEWS" # from [49a8c5b13ad1c7c93ad0499e5ab119e8fd8ce313] # to [61d68f95c56c02ec59ba527504fdb6be2d1313a6] # # patch "cmd_netsync.cc" # from [27ebccae0f902d134ed780bc678b73c954613e43] # to [34174bb7ce83722d7a9859b7065c40243ca0ba75] # # patch "tests/clone_branch_no_dir/__driver__.lua" # from [6261c4ed37c1a5e10ea7e27aacdf722287ec8682] # to [79f7583ce446afedfea0330cf7b9ea059f17b2ea] # # patch "tests/clone_creates__MTN_log/__driver__.lua" # from [b55d72be85979711d50af45907e134f18428a405] # to [8c7d4dfb26d1a16a1607d6fc85fc17c6fca9df5f] # # patch "tests/clone_creates_right__MTN_options/__driver__.lua" # from [99090f6f660254a145fd2d892282bca37a723361] # to [695c3942a9dfe2396f40ab60b378537c114b8dec] # # patch "tests/clone_validates_target_directory/__driver__.lua" # from [bb4ba95dd27e59251ea97e3e108800223c52874a] # to [1e23852712399fd277092c8ba08bbd164179e873] # # patch "tests/clone_warning_with_multiple_heads/__driver__.lua" # from [7185de1271934179a95cf11aa12b561404323c61] # to [365ab7fea2b251874a264a9c21ec0ca17770c14c] # ============================================================ --- NEWS 49a8c5b13ad1c7c93ad0499e5ab119e8fd8ce313 +++ NEWS 61d68f95c56c02ec59ba527504fdb6be2d1313a6 @@ -1,23 +1,32 @@ ??? ??? ?? ???????? UTC 2008 0.41 release + Changes + + - mtn clone now takes a branch argument rather than a branch option + which is more what people expect given the the fact that + mtn push/pull/sync do not use a branch option either + Bugs fixed - - If the options --db or --keydir were previously specified for a + - If the options --db or --keydir were previously specified for a command which was executed inside a workspace and one or both - option arguments were invalid (f.e. invalid paths), they were + option arguments were invalid (f.e. invalid paths), they were still written to _MTN/options of the particular workspace. - This lead to errors on any subsequent command which used these + This lead to errors on any subsequent command which used these options. This bug is fixed in so far that basic file type checks are applied on both options, so its no longer possible to set non-existing paths accidently or use a path to a directory as option argument for --db. - - If a key clash occurs on a netsync operation, i.e. two different - keys with the same key id are encountered, mtn now fails cleanly + - If a key clash occurs on a netsync operation, i.e. two different + keys with the same key id are encountered, mtn now fails cleanly and provides further guidance how to proceed. - + + - It was previously not possible to clone a branch / database + anonymously; this has been fixed. + Fri Apr 11 22:50:44 UTC 2008 0.40 release. ============================================================ --- cmd_netsync.cc 27ebccae0f902d134ed780bc678b73c954613e43 +++ cmd_netsync.cc 34174bb7ce83722d7a9859b7065c40243ca0ba75 @@ -50,7 +50,7 @@ find_key(options & opts, return; rsa_keypair_id key; - + utf8 host(info.client.unparsed); if (!info.client.u.host.empty()) host = utf8(info.client.u.host); @@ -108,7 +108,7 @@ build_client_connection_info(options & o { N(!include_or_exclude_given, F("Include/exclude pattern was given both as part of the URL and as a separate argument.")); - + // Pull include/exclude from the query string char const separator = '/'; char const negate = '-'; @@ -127,7 +127,7 @@ build_client_connection_info(options & o if (begin < query.size()) end = query.find(separator, begin); } - + bool is_exclude = false; if (item.size() >= 1 && item.at(0) == negate) { @@ -143,7 +143,7 @@ build_client_connection_info(options & o is_exclude = true; item.erase(0, string("exclude=").size()); } - + if (is_exclude) excludes.push_back(arg_type(urldecode(item))); else @@ -152,7 +152,7 @@ build_client_connection_info(options & o info.client.include_pattern = globish(includes); info.client.exclude_pattern = globish(excludes); } - + // Maybe set the default values. if (!db.var_exists(default_server_key) || opts.set_default) { @@ -175,7 +175,7 @@ build_client_connection_info(options & o db.set_var(default_exclude_pattern_key, var_value(info.client.exclude_pattern())); } - + info.client.use_argv = lua.hook_get_netsync_connect_command(info.client.u, info.client.include_pattern, @@ -313,14 +313,14 @@ CMD(clone, "clone", "", CMD_REF(network) }; CMD(clone, "clone", "", CMD_REF(network), - N_("ADDRESS[:PORTNUMBER] [DIRECTORY]"), + N_("ADDRESS[:PORTNUMBER] BRANCH [DIRECTORY]"), N_("Checks out a revision from a remote database into a directory"), N_("If a revision is given, that's the one that will be checked out. " "Otherwise, it will be the head of the branch supplied. " "If no directory is given, the branch name will be used as directory"), - options::opts::branch | options::opts::revision) + options::opts::revision) { - if (args.size() < 1 || args.size() > 2 || app.opts.revision_selectors.size() > 1) + if (args.size() < 2 || args.size() > 3 || app.opts.revision_selectors.size() > 1) throw usage(execid); revision_id ident; @@ -328,18 +328,19 @@ CMD(clone, "clone", "", CMD_REF(network) netsync_connection_info info; info.client.unparsed = idx(args, 0); - N(app.opts.branch_given && !app.opts.branchname().empty(), - F("you must specify a branch to clone")); + branch_name branchname(idx(args, 1)()); - if (args.size() == 1) + N(!branchname().empty(), F("you must specify a branch to clone")); + + if (args.size() == 2) { // No checkout dir specified, use branch name for dir. - workspace_dir = system_path(app.opts.branchname()); + workspace_dir = system_path(branchname()); } else { // Checkout to specified dir. - workspace_dir = system_path(idx(args, 1)); + workspace_dir = system_path(idx(args, 2)); } require_path_is_nonexistent @@ -359,9 +360,12 @@ CMD(clone, "clone", "", CMD_REF(network) / bookkeeping_root_component / ws_internal_db_file_name); - // must do this after setting dbname so that _MTN/options is written - // correctly + // this is actually stupid, but app.opts.branchname must be set here + // otherwise it will not be written into _MTN/options, in case + // a revision is chosen which has multiple branch certs + app.opts.branchname = branchname; workspace::create_workspace(app.opts, app.lua, workspace_dir); + app.opts.branchname = branch_name(); database db(app); if (get_path_status(db.get_filename()) == path::nonexistent) @@ -372,10 +376,11 @@ CMD(clone, "clone", "", CMD_REF(network) key_store keys(app); project_t project(db); - info.client.include_pattern = globish(app.opts.branchname()); + info.client.include_pattern = globish(branchname()); info.client.exclude_pattern = globish(app.opts.exclude_patterns); + build_client_connection_info(app.opts, app.lua, db, keys, - info, true, true); + info, true, true, false); if (app.opts.signing_key() == "") P(F("doing anonymous pull; use -kKEYNAME if you need authentication")); @@ -392,23 +397,19 @@ CMD(clone, "clone", "", CMD_REF(network) if (app.opts.revision_selectors.size() == 0) { - // use branch head revision - N(!app.opts.branchname().empty(), - F("use --revision or --branch to specify what to checkout")); - set heads; - project.get_branch_heads(app.opts.branchname, heads, + project.get_branch_heads(branchname, heads, app.opts.ignore_suspend_certs); N(heads.size() > 0, - F("branch '%s' is empty") % app.opts.branchname); + F("branch '%s' is empty") % branchname); if (heads.size() > 1) { - P(F("branch %s has multiple heads:") % app.opts.branchname); + P(F("branch %s has multiple heads:") % branchname); for (set::const_iterator i = heads.begin(); i != heads.end(); ++i) P(i18n_format(" %s") % describe_revision(project, *i)); - P(F("choose one with '%s checkout -r'") % ui.prog_name); - E(false, F("branch %s has multiple heads") % app.opts.branchname); + P(F("choose one with '%s clone -r SERVER BRANCH'") % ui.prog_name); + E(false, F("branch %s has multiple heads") % branchname); } ident = *(heads.begin()); } @@ -417,12 +418,9 @@ CMD(clone, "clone", "", CMD_REF(network) // use specified revision complete(app.opts, app.lua, project, idx(app.opts.revision_selectors, 0)(), ident); - guess_branch(app.opts, project, ident); - I(!app.opts.branchname().empty()); - - N(project.revision_is_in_branch(ident, app.opts.branchname), + N(project.revision_is_in_branch(ident, branchname), F("revision %s is not a member of branch %s") - % ident % app.opts.branchname); + % ident % branchname); } roster_t empty_roster, current_roster; @@ -495,7 +493,7 @@ CMD_NO_WORKSPACE(serve, "serve", "", CMD pid_file pid(app.opts.pidfile); db.ensure_open(); - + netsync_connection_info info; info.server.addrs = app.opts.bind_uris; ============================================================ --- tests/clone_branch_no_dir/__driver__.lua 6261c4ed37c1a5e10ea7e27aacdf722287ec8682 +++ tests/clone_branch_no_dir/__driver__.lua 79f7583ce446afedfea0330cf7b9ea059f17b2ea @@ -7,16 +7,16 @@ testURI="file:" .. test.root .. "/test.d testURI="file:" .. test.root .. "/test.db" -check(nodb_mtn("clone", "-b", "mybranch", testURI), 0, false, false) +check(nodb_mtn("clone", testURI, "mybranch"), 0, false, false) check(exists("mybranch")) check(readfile("foo") == readfile("mybranch/foo")) -- but now that that directory exists, this clone should fail -check(nodb_mtn("clone", "-b", "mybranch", testURI), 1, false, false) +check(nodb_mtn("clone", testURI, "mybranch"), 1, false, false) -- but succeed if given a specific dir -check(nodb_mtn("clone", "-b", "mybranch", testURI, "otherdir"), 0, false, false) +check(nodb_mtn("clone", testURI, "mybranch", "otherdir"), 0, false, false) -- clone into . should also fail, unlike checkout mkdir("test4") +check(indir("test4", nodb_mtn("clone", testURI, "mybranch", ".")), 1, false, false) -check(indir("test4", nodb_mtn("clone", "-b", "mybranch", testURI, ".")), 1, false, false) ============================================================ --- tests/clone_creates__MTN_log/__driver__.lua b55d72be85979711d50af45907e134f18428a405 +++ tests/clone_creates__MTN_log/__driver__.lua 8c7d4dfb26d1a16a1607d6fc85fc17c6fca9df5f @@ -14,7 +14,7 @@ testURI="file:" .. test.root .. "/test.d testURI="file:" .. test.root .. "/test.db" -check(nodb_mtn("--branch=testbranch", "clone", testURI, "testbranch"), 0, false, true) +check(nodb_mtn("clone", testURI, "testbranch", "testbranch"), 0, false, true) check(exists("testbranch/_MTN/log")) check(fsize("_MTN/log") == 0) ============================================================ --- tests/clone_creates_right__MTN_options/__driver__.lua 99090f6f660254a145fd2d892282bca37a723361 +++ tests/clone_creates_right__MTN_options/__driver__.lua 695c3942a9dfe2396f40ab60b378537c114b8dec @@ -18,15 +18,15 @@ testURI="file:" .. test.root .. "/test.d -- all of these inherit options settings from the current _MTN dir -- unless they override them on the command line -check(nodb_mtn("--branch=testbranch", "clone", testURI, "test_dir1"), 0, false, false) -check(nodb_mtn("--branch=testbranch", "clone", testURI, "--revision", rev, "test_dir2"), 0, false, false) -check(nodb_mtn("--db=" .. test.root .. "/test-old.db", "--branch=testbranch", "clone", testURI, "test_dir3"), 0, false, false) -check(nodb_mtn("--db=" .. test.root .. "/test-old.db", "--branch=testbranch", "clone", testURI, "--revision", rev, "test_dir4"), 0, false, false) +check(nodb_mtn("clone", testURI, "testbranch", "test_dir1"), 0, false, false) +check(nodb_mtn("clone", "--revision", rev, testURI, "testbranch", "test_dir2"), 0, false, false) +check(nodb_mtn("--db=" .. test.root .. "/test-old.db", "clone", testURI, "testbranch", "test_dir3"), 0, false, false) +check(nodb_mtn("--db=" .. test.root .. "/test-old.db", "clone", testURI, "testbranch", "--revision", rev, "test_dir4"), 0, false, false) -- checkout fails if the specified revision is not a member of the specified branch -check(nodb_mtn("--branch=foobar", "clone", testURI, "--revision", rev, "test_dir5"), 1, false, false) +check(nodb_mtn("clone", testURI, "--revision", rev, "foobar", "test_dir5"), 1, false, false) check(mtn("cert", rev, "branch", "foobar"), 0, false, false) -check(nodb_mtn("--branch=foobar", "clone", testURI, "--revision", rev, "test_dir6"), 0, false, false) +check(nodb_mtn("clone", testURI, "--revision", rev, "foobar", "test_dir6"), 0, false, false) for i = 1,2 do ============================================================ --- tests/clone_validates_target_directory/__driver__.lua bb4ba95dd27e59251ea97e3e108800223c52874a +++ tests/clone_validates_target_directory/__driver__.lua 1e23852712399fd277092c8ba08bbd164179e873 @@ -7,13 +7,13 @@ testURI="file:" .. test.root .. "/test.d testURI="file:" .. test.root .. "/test.db" -check(nodb_mtn("--branch=testbranch", "clone", testURI, "test_dir1"), 0, false, false) +check(nodb_mtn("clone", testURI, "testbranch", "test_dir1"), 0, false, false) writefile("test_dir2") -check(nodb_mtn("--branch=testbranch", "clone", testURI, "test_dir2"), 1, false, false) +check(nodb_mtn("clone", testURI, "testbranch", "test_dir2"), 1, false, false) mkdir("test_dir3") -check(nodb_mtn("--branch=testbranch", "clone", testURI, "test_dir3"), 1, false, false) +check(nodb_mtn("clone", testURI, "testbranch", "test_dir3"), 1, false, false) if existsonpath("chmod") and existsonpath("test") then -- skip this part if run as root (hi Gentoo!) @@ -26,9 +26,9 @@ if existsonpath("chmod") and existsonpat else mkdir("test_dir4") check({"chmod", "444", "test_dir4"}, 0, false) - check(nodb_mtn("--branch=testbranch", "clone", testURI, "test_dir4"), + check(nodb_mtn("clone", testURI, "testbranch", "test_dir4"), 1, false, false) - check(nodb_mtn("--branch=testbranch", "clone", testURI, "test_dir4/subdir"), + check(nodb_mtn("clone", testURI, "testbranch", "test_dir4/subdir"), 1, false, false) -- Reset the permissions so Autotest can correctly clean up our -- temporary directory. ============================================================ --- tests/clone_warning_with_multiple_heads/__driver__.lua 7185de1271934179a95cf11aa12b561404323c61 +++ tests/clone_warning_with_multiple_heads/__driver__.lua 365ab7fea2b251874a264a9c21ec0ca17770c14c @@ -17,7 +17,7 @@ testURI="file:" .. test.root .. "/test.d testURI="file:" .. test.root .. "/test.db" -check(nodb_mtn("--branch=testbranch", "clone", testURI, "test_dirA"), +check(nodb_mtn("clone", testURI, "testbranch", "test_dirA"), 1, false, true) check(qgrep(REV2, "stderr")) check(qgrep(REV3, "stderr"))