# # # add_dir "tests/netsync,--anonymous" # # add_file "tests/netsync,--anonymous/__driver__.lua" # content [0cd2a3ed0eec16642f4223270629839751fa847e] # # patch "NEWS" # from [0ca6a4be4c4d8778468cb584963db8c98c1959b2] # to [75e8148357631f39daad202d7c415a2d5a3bdb2f] # # patch "cmd_netsync.cc" # from [ecf459ce845f38db058d30ad04910d57ee1310f2] # to [48e4d01f58a75e63ad50a8a50db97dac5469573c] # # patch "keys.cc" # from [c422791c7c491e8cd0360ddc4f93f2a59b8651ae] # to [a62f99c2c6db4dc0b1f03fbc117365c3ecaa336d] # # patch "options_list.hh" # from [4f0483db8e18e652824cd16c29d34ff3c8f31c79] # to [c2d08729bfd4ab5997e672e659e2bce31f52571f] # # patch "work.cc" # from [28266a7fbb698d94c998047e52842b220b37756d] # to [54a58a98f671c71b875db5e6d8a371ebbccd4ef2] # ============================================================ --- tests/netsync,--anonymous/__driver__.lua 0cd2a3ed0eec16642f4223270629839751fa847e +++ tests/netsync,--anonymous/__driver__.lua 0cd2a3ed0eec16642f4223270629839751fa847e @@ -0,0 +1,24 @@ +include("common/netsync.lua") +mtn_setup() +netsync.setup() +rseed = get_pid() + +addfile("testfile", "foo") +commit() +t1 = base_revision() + +-- pull with key in db 2 +math.randomseed(rseed) +netsync.pull("testbranch") +check(not qgrep("anonymous","ts-stderr")) +check(mtn2("automate", "get_revision", t1), 0, false, false) + +addfile("testfile", "bar") +commit() +t2 = base_revision() + +-- pull anonymously in db 2 +math.randomseed(rseed) +netsync.pull({"testbranch","--anonymous"}) +check(qgrep("anonymous","ts-stderr")) +check(mtn2("automate", "get_revision", t2), 0, false, false) ============================================================ --- NEWS 0ca6a4be4c4d8778468cb584963db8c98c1959b2 +++ NEWS 75e8148357631f39daad202d7c415a2d5a3bdb2f @@ -26,6 +26,10 @@ xxx xxx xx xx:xx:xx UTC 2010 don't have to worry about forgetting to give the include pattern and accidentally trying to sync everything to the second server. + - The commands 'clone', 'pull', 'automate clone' and 'automate pull' + now take the option '--anonymous' for temporary anonymous pulls. + Note that this doesn't change any options stored in _MTN/options. + Bugs fixed - A regression in 0.47 prevent successful execution of push / pull / ============================================================ --- cmd_netsync.cc ecf459ce845f38db058d30ad04910d57ee1310f2 +++ cmd_netsync.cc 48e4d01f58a75e63ad50a8a50db97dac5469573c @@ -549,7 +549,8 @@ CMD(pull, "pull", "", CMD_REF(network), N_("This pulls all branches that match the pattern given in PATTERN " "from the netsync server at the address ADDRESS."), options::opts::max_netsync_version | options::opts::min_netsync_version | - options::opts::set_default | options::opts::exclude) + options::opts::set_default | options::opts::exclude | + options::opts::anonymous) { database db(app); key_store keys(app); @@ -571,7 +572,8 @@ CMD_AUTOMATE(pull, N_("[ADDRESS[:PORTNUM "", options::opts::max_netsync_version | options::opts::min_netsync_version | - options::opts::set_default | options::opts::exclude) + options::opts::set_default | options::opts::exclude | + options::opts::anonymous) { database db(app); key_store keys(app); @@ -645,7 +647,7 @@ CMD(clone, "clone", "", CMD_REF(network) "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::max_netsync_version | options::opts::min_netsync_version | - options::opts::revision) + options::opts::revision | options::opts::anonymous) { if (args.size() < 2 || args.size() > 3 || app.opts.revision_selectors.size() > 1) throw usage(execid); ============================================================ --- keys.cc c422791c7c491e8cd0360ddc4f93f2a59b8651ae +++ keys.cc a62f99c2c6db4dc0b1f03fbc117365c3ecaa336d @@ -120,6 +120,9 @@ get_user_key(options const & opts, lua_h database & db, key_store & keys, project_t & project, key_id & key) { + if (opts.anonymous) + return; + if (keys.have_signing_key()) { key = keys.signing_key; @@ -168,6 +171,9 @@ cache_netsync_key(options const & opts, return; } + if (opts.anonymous) + return; + bool found_key = false; key_id key; ============================================================ --- options_list.hh 4f0483db8e18e652824cd16c29d34ff3c8f31c79 +++ options_list.hh c2d08729bfd4ab5997e672e659e2bce31f52571f @@ -484,9 +484,19 @@ OPTION(globals, key, true, "key,k", #ifdef option_bodies { signing_key = external_key_name(arg, origin::user); + anonymous = false; } #endif +OPT(anonymous, "anonymous", bool, false, "allows for anonymous communication") +#ifdef option_bodies +{ + anonymous = true; + signing_key = external_key_name(); + key_given = false; +} +#endif + // Remember COMMA doesn't work with GOPT, use long form. //GOPT(key_dir, "keydir", system_path, get_default_keydir() COMMA origin::user, // gettext_noop("set location of key store")) ============================================================ --- work.cc 28266a7fbb698d94c998047e52842b220b37756d +++ work.cc 54a58a98f671c71b875db5e6d8a371ebbccd4ef2 @@ -528,7 +528,7 @@ workspace::get_options(options & opts) L(FL("branch name is '%s'") % opts.branch); - if (!opts.key_given) + if (!opts.key_given && !opts.anonymous) opts.signing_key = workspace_key; }