# # # patch "cmd_netsync.cc" # from [c4ccd721df4c51c47d13c4344ede78088655ddac] # to [7ebeec90d949fecfa3e89fe9ed5097069236807a] # # patch "monotone.texi" # from [331c7383844c822b0c9c0ce6031e6785c8498552] # to [7ca3e47a431d45e0b4053dac7507569bf55ab628] # # patch "options_list.hh" # from [8bc3f3aa0f02d498748398dcf0b7969734492b4d] # to [bfe72482f6c82ec90a15fdc3d3b540ac241b05d9] # ============================================================ --- cmd_netsync.cc c4ccd721df4c51c47d13c4344ede78088655ddac +++ cmd_netsync.cc 7ebeec90d949fecfa3e89fe9ed5097069236807a @@ -232,13 +232,14 @@ CMD_AUTOMATE_NO_STDIO(remote_stdio, } CMD_AUTOMATE_NO_STDIO(remote_stdio, - N_("[ADDRESS[:PORTNUMBER]"), + N_("[ADDRESS[:PORTNUMBER]]"), N_("Opens an 'automate stdio' connection to a remote server"), "", options::opts::max_netsync_version | - options::opts::min_netsync_version) + options::opts::min_netsync_version | + options::opts::set_default) { - if (args.size() != 1) + if (args.size() > 1) throw usage(execid); database db(app); @@ -246,9 +247,30 @@ CMD_AUTOMATE_NO_STDIO(remote_stdio, project_t project(db); netsync_connection_info info; - info.client.unparsed = idx(args, 0); + + if (args.size() == 1) + { + info.client.unparsed = idx(args, 0); + } + else + { + E(db.var_exists(default_server_key), origin::user, + F("no server given and no default server set")); + var_value addr_value; + db.get_var(default_server_key, addr_value); + info.client.unparsed = typecast_vocab(addr_value); + L(FL("using default server address: %s") % info.client.unparsed); + } + parse_uri(info.client.unparsed(), info.client.uri, origin::user); + if (!db.var_exists(default_server_key) || app.opts.set_default) + { + P(F("setting default server to %s") % info.client.unparsed()); + db.set_var(default_server_key, + typecast_vocab(info.client.unparsed)); + } + info.client.use_argv = app.lua.hook_get_netsync_connect_command(info.client.uri, info.client.include_pattern, @@ -338,7 +360,8 @@ CMD_AUTOMATE_NO_STDIO(remote, "", options::opts::remote_stdio_host | options::opts::max_netsync_version | - options::opts::min_netsync_version) + options::opts::min_netsync_version | + options::opts::set_default) { E(args.size() >= 1, origin::user, F("wrong argument count")); @@ -348,9 +371,30 @@ CMD_AUTOMATE_NO_STDIO(remote, project_t project(db); netsync_connection_info info; - info.client.unparsed = app.opts.remote_stdio_host; + + if (app.opts.remote_stdio_host_given) + { + info.client.unparsed = app.opts.remote_stdio_host; + } + else + { + E(db.var_exists(default_server_key), origin::user, + F("no server given and no default server set")); + var_value addr_value; + db.get_var(default_server_key, addr_value); + info.client.unparsed = typecast_vocab(addr_value); + L(FL("using default server address: %s") % info.client.unparsed); + } + parse_uri(info.client.unparsed(), info.client.uri, origin::user); + if (!db.var_exists(default_server_key) || app.opts.set_default) + { + P(F("setting default server to %s") % info.client.unparsed()); + db.set_var(default_server_key, + typecast_vocab(info.client.unparsed)); + } + info.client.use_argv = app.lua.hook_get_netsync_connect_command(info.client.uri, info.client.include_pattern, ============================================================ --- monotone.texi 331c7383844c822b0c9c0ce6031e6785c8498552 +++ monotone.texi 7ca3e47a431d45e0b4053dac7507569bf55ab628 @@ -7754,13 +7754,13 @@ @section Automation @end table address@hidden mtn automate remote_stdio @var{hostname} address@hidden mtn automate remote_stdio address@hidden @table @strong @item Arguments @var{hostname} is the host (and optionally port) of the monotone server -process to connect to. +process to connect to. If not given, the default server is used. @item Added in @@ -7796,9 +7796,9 @@ @section Automation @item Arguments A command and its arguments, to execute on the remote server specified -by the @option{--remote-stdio-host} option. If options are to be passed to -the command, they must be preceded by @option{--} to prevent them from being -interpreted as local options. +by the @option{--remote-stdio-host} option. If no host is given, the default +server is used. If options are to be passed to the command, they must be +preceded by @option{--} to prevent them from being interpreted as local options. Remote options @strong{must} be given as a single token, ie @option{--branch=foo} or @option{-bfoo}. This is because the local and remote ============================================================ --- options_list.hh 8bc3f3aa0f02d498748398dcf0b7969734492b4d +++ options_list.hh bfe72482f6c82ec90a15fdc3d3b540ac241b05d9 @@ -671,7 +671,8 @@ OPT(set_default, "set-default", bool, fa #endif OPT(set_default, "set-default", bool, false, - gettext_noop("use the current arguments as the future default")) + gettext_noop("use the current netsync arguments and options " + "as the future default")) #ifdef option_bodies { set_default = true;