#
# patch "ChangeLog"
# from [bcfd30729544334c38fcd65612233ffc57e05a5e]
# to [2bfe810091faf93b86093fdee370f8f502ec801c]
#
# patch "commands.cc"
# from [627f94732bd7bd2886d9688dab916bb203b8ed77]
# to [be0e553d14793c7bef3b571d4720b585c5aa5a51]
#
# patch "constants.cc"
# from [6ea5ae0591af040ba8acbaf3cb826b8f2b5dac55]
# to [eabc0d5838a67e3e4d351ce3d28eac0387f773ae]
#
# patch "lua.cc"
# from [e2e91c14e07acc669a5ffb10a9983c5403997cfc]
# to [107b2deb3efdabe34542d967503b2250055b4d23]
#
# patch "lua.hh"
# from [0d70b46599b54eab35528c97bb129b552d6d0f9c]
# to [0c4357742dc32474757a7905380b407e532563f4]
#
# patch "monotone.texi"
# from [2330c9284da3b0c30bafe492364fb36981097993]
# to [9c80ea657ae03c85cdaf1ac96c71959484f5697f]
#
# patch "netcmd.cc"
# from [613fd7d1f3e4a89a5dd2ce5d559000b4e2ce74ab]
# to [36e1f3cae4c4b0ac416d746d2895373068aa043a]
#
# patch "netcmd.hh"
# from [489dc302b98aada3105ece70ca2f850b153f2509]
# to [ab57b4e82546eb7dd946605d4fb84363883e99d9]
#
# patch "netsync.cc"
# from [3356a1e19ea706b038af1c28d74ae55e1e6fc712]
# to [d1af0e63369c9b7d0c70b811c28abdceef436fb0]
#
# patch "netsync.hh"
# from [f1b6305e6b8247f28b646d7b859a8475ef8ed39b]
# to [758b6ef261dc3d69e99e4fbcd79571e89749c9f4]
#
# patch "tests/t_epoch_unidirectional.at"
# from [528d188d22f472cec806609436bbe5afba0cdbcb]
# to [5b50d219fc0b011f307d074ab09336f98c121c65]
#
# patch "tests/t_netsync_defaults.at"
# from [4cef6b25d7b1a2a7bde39fea0453bb21337eddb0]
# to [c041c4c1f93c04041b0fb53257e56c4b3b24a2cf]
#
# patch "tests/t_netsync_error.at"
# from [86b1d02f651b7b4efd9fa8a8524f2ed845e2d43c]
# to [8188034644f18ea9b5da26a66a87d66bf2e345d0]
#
# patch "tests/t_netsync_permissions.at"
# from [1150ab91c13b8c2e3640be346a1a4ba0306e0c72]
# to [73b0366351e254dd0c272fc9d01c04d2b5fba795]
#
# patch "tests/t_netsync_set_defaults.at"
# from [820bc21e9dc6b9c1a518031742a028239c693d58]
# to [7298147ca6098306734be9dee46e1ada45e4d9b2]
#
# patch "tests/t_netsync_single.at"
# from [d7b40fcf0529e589e987774f569edeae0889257f]
# to [10e65a3f83698c36866333909f01cbdb6915efe3]
#
# patch "tests/t_select_cert.at"
# from [b28e5221a8c1d9cf4d4f30b0490a1fbe523dda63]
# to [8090c5f7451d60ab8f321ff9c5abcda473feb070]
#
# patch "tests/t_update_to_revision.at"
# from [a8a0f7025381a5e14f3c650d14c1d21ade3cd589]
# to [b6f804cced8a6863a91e4fef319b8f427762001e]
#
# patch "testsuite.at"
# from [f9801da558a13e2d2ab4fa73d1ad6acefe1eeb86]
# to [d33d13c6d066135f5a93c8a721209b27715fb75b]
#
# patch "vocab_terms.hh"
# from [2ac7518f6c9951c9335409298b21fcbe8ad76e27]
# to [06a7d7d5f8087199299d141b47367c1c851a6012]
#
--- ChangeLog
+++ ChangeLog
@@ -1,3 +1,15 @@
+2005-05-31 Timothy Brownawell
+
+ Remove old collection support in favor of using regexes exclusively.
+ * netsync.cc (convert_pattern): Remove function.
+ * (14 files): collections are unexist; do not mention (potential
+ for confusion)
+ * constants.cc: Increase netsync protocol version.
+ * monotone.texi: Update documentation.
+ * tests/t_epoch_unidirectional.at: Fix to sync subbranches.
+ * commands.cc (CMD update): Fix usage check.
+ * tests/t_select_cert.at: Fix to use --revision.
+
2005-05-30 Timothy Brownawell
* netsync.cc: Call note_netsync_*_received hooks in the order they're
--- commands.cc
+++ commands.cc
@@ -1927,13 +1927,13 @@
static const var_key default_server_key(var_domain("database"),
var_name("default-server"));
-static const var_key default_collection_key(var_domain("database"),
- var_name("default-collection"));
+static const var_key default_pattern_key(var_domain("database"),
+ var_name("default-pattern"));
static void
process_netsync_client_args(std::string const & name,
std::vector const & args,
- utf8 & addr, std::vector & collections,
+ utf8 & addr, std::vector & patterns,
app_state & app)
{
if (args.size() > 2)
@@ -1957,73 +1957,74 @@
addr = utf8(addr_value());
L(F("using default server address: %s\n") % addr);
}
- // NB: even though the netsync code wants a vector of collections, in fact
+ // NB: even though the netsync code wants a vector of patterns, in fact
// this only works for the server; when we're a client, our vector must have
// length exactly 1.
- utf8 collection;
+ utf8 pattern;
if (args.size() >= 2)
{
- collection = idx(args, 1);
- if (!app.db.var_exists(default_collection_key))
+ pattern = idx(args, 1);
+ if (!app.db.var_exists(default_pattern_key))
{
- P(F("setting default collection to %s\n") % collection);
- app.db.set_var(default_collection_key, var_value(collection()));
+ P(F("setting default regex pattern to %s\n") % pattern);
+ app.db.set_var(default_pattern_key, var_value(pattern()));
}
}
else
{
- N(app.db.var_exists(default_collection_key),
- F("no collection given and no default collection set"));
- var_value collection_value;
- app.db.get_var(default_collection_key, collection_value);
- collection = utf8(collection_value());
- L(F("using default collection: %s\n") % collection);
+ N(app.db.var_exists(default_pattern_key),
+ F("no regex pattern given and no default pattern set"));
+ var_value pattern_value;
+ app.db.get_var(default_pattern_key, pattern_value);
+ pattern = utf8(pattern_value());
+ L(F("using default regex pattern: %s\n") % pattern);
}
- collections.push_back(collection);
+ patterns.push_back(pattern);
}
-CMD(push, "network", "[ADDRESS[:PORTNUMBER] [(COLLECTION | /REGEX/)]]",
- "push specified branches to netsync server at ADDRESS", OPT_NONE)
+CMD(push, "network", "[ADDRESS[:PORTNUMBER] [REGEX]]",
+ "push branches matching REGEX to netsync server at ADDRESS", OPT_NONE)
{
utf8 addr;
- vector collections;
- process_netsync_client_args(name, args, addr, collections, app);
+ vector patterns;
+ process_netsync_client_args(name, args, addr, patterns, app);
rsa_keypair_id key;
N(guess_default_key(key, app), F("could not guess default signing key"));
app.signing_key = key;
- run_netsync_protocol(client_voice, source_role, addr, collections, app);
+ run_netsync_protocol(client_voice, source_role, addr, patterns, app);
}
-CMD(pull, "network", "[ADDRESS[:PORTNUMBER] [(COLLECTION | /REGEX/)]]",
- "pull specified branches from netsync server at ADDRESS", OPT_NONE)
+CMD(pull, "network", "[ADDRESS[:PORTNUMBER] [REGEX]]",
+ "pull branches matching REGEX from netsync server at ADDRESS", OPT_NONE)
{
utf8 addr;
- vector collections;
- process_netsync_client_args(name, args, addr, collections, app);
+ vector patterns;
+ process_netsync_client_args(name, args, addr, patterns, app);
if (app.signing_key() == "")
W(F("doing anonymous pull\n"));
- run_netsync_protocol(client_voice, sink_role, addr, collections, app);
+ run_netsync_protocol(client_voice, sink_role, addr, patterns, app);
}
-CMD(sync, "network", "[ADDRESS[:PORTNUMBER] [(COLLECTION | /REGEX/)]]",
- "sync specified branches with netsync server at ADDRESS", OPT_NONE)
+CMD(sync, "network", "[ADDRESS[:PORTNUMBER] [REGEX]]",
+ "sync branches matching REGEX with netsync server at ADDRESS", OPT_NONE)
{
utf8 addr;
- vector collections;
- process_netsync_client_args(name, args, addr, collections, app);
+ vector patterns;
+ process_netsync_client_args(name, args, addr, patterns, app);
rsa_keypair_id key;
N(guess_default_key(key, app), F("could not guess default signing key"));
app.signing_key = key;
- run_netsync_protocol(client_voice, source_and_sink_role, addr, collections, app);
+ run_netsync_protocol(client_voice, source_and_sink_role, addr, patterns,
+ app);
}
-CMD(serve, "network", "ADDRESS[:PORTNUMBER] (COLLECTION | /REGEX/) ...",
+CMD(serve, "network", "ADDRESS[:PORTNUMBER] REGEX ...",
"listen on ADDRESS and serve the specified branches to connecting clients", OPT_PIDFILE)
{
if (args.size() < 2)
@@ -2040,8 +2041,8 @@
require_password(key, app);
utf8 addr(idx(args,0));
- vector collections(args.begin() + 1, args.end());
- run_netsync_protocol(server_voice, source_and_sink_role, addr, collections, app);
+ vector patterns(args.begin() + 1, args.end());
+ run_netsync_protocol(server_voice, source_and_sink_role, addr, patterns, app);
}
@@ -2850,7 +2851,7 @@
if (args.size() > 0)
throw usage(name);
- if (app.revision_selectors.size() > 0)
+ if (app.revision_selectors.size() > 1)
throw usage(name);
if (!app.branch_name().empty())
--- constants.cc
+++ constants.cc
@@ -145,7 +145,7 @@
BOOST_STATIC_ASSERT(merkle_bitmap_length_in_bits > 0);
BOOST_STATIC_ASSERT((merkle_bitmap_length_in_bits % 8) == 0);
- u8 const netcmd_current_protocol_version = 4;
+ u8 const netcmd_current_protocol_version = 5;
size_t const netcmd_minsz = (1 // version
+ 1 // cmd code
+ 1 // smallest uleb possible
--- lua.cc
+++ lua.cc
@@ -951,14 +951,14 @@
}
bool
-lua_hooks::hook_get_netsync_read_permitted(std::string const & collection,
+lua_hooks::hook_get_netsync_read_permitted(std::string const & pattern,
rsa_keypair_id const & identity)
{
bool permitted = false, exec_ok = false;
exec_ok = Lua(st)
.func("get_netsync_read_permitted")
- .push_str(collection)
+ .push_str(pattern)
.push_str(identity())
.call(2,1)
.extract_bool(permitted)
@@ -968,13 +968,13 @@
}
bool
-lua_hooks::hook_get_netsync_anonymous_read_permitted(std::string const & collection)
+lua_hooks::hook_get_netsync_anonymous_read_permitted(std::string const & pattern)
{
bool permitted = false, exec_ok = false;
exec_ok = Lua(st)
.func("get_netsync_anonymous_read_permitted")
- .push_str(collection)
+ .push_str(pattern)
.call(1,1)
.extract_bool(permitted)
.ok();
@@ -983,14 +983,14 @@
}
bool
-lua_hooks::hook_get_netsync_write_permitted(std::string const & collection,
+lua_hooks::hook_get_netsync_write_permitted(std::string const & pattern,
rsa_keypair_id const & identity)
{
bool permitted = false, exec_ok = false;
exec_ok = Lua(st)
.func("get_netsync_write_permitted")
- .push_str(collection)
+ .push_str(pattern)
.push_str(identity())
.call(2,1)
.extract_bool(permitted)
--- lua.hh
+++ lua.hh
@@ -62,10 +62,10 @@
std::map const & new_results);
// network hooks
- bool hook_get_netsync_read_permitted(std::string const & collection,
+ bool hook_get_netsync_read_permitted(std::string const & pattern,
rsa_keypair_id const & identity);
- bool hook_get_netsync_anonymous_read_permitted(std::string const & collection);
- bool hook_get_netsync_write_permitted(std::string const & collection,
+ bool hook_get_netsync_anonymous_read_permitted(std::string const & pattern);
+ bool hook_get_netsync_write_permitted(std::string const & pattern,
rsa_keypair_id const & identity);
// local repo hooks
--- monotone.texi
+++ monotone.texi
@@ -1632,19 +1632,19 @@
@smallexample
@group
$ cat >>~/.monotone/monotonerc
-function get_netsync_read_permitted (collection, identity)
+function get_netsync_read_permitted (regex, identity)
if (identity == "abe@@juicebot.co.jp") then return true end
if (identity == "beth@@juicebot.co.jp") then return true end
return false
end
-function get_netsync_write_permitted (collection, identity)
+function get_netsync_write_permitted (regex, identity)
if (identity == "abe@@juicebot.co.jp") then return true end
if (identity == "beth@@juicebot.co.jp") then return true end
return false
end
-function get_netsync_anonymous_read_permitted (collection)
+function get_netsync_anonymous_read_permitted (regex)
return false
end
^D
@@ -1657,13 +1657,13 @@
@smallexample
@group
-$ monotone --db=jim.db serve jim-laptop.juicebot.co.jp jp.co.juicebot.jb7
+$ monotone --db=jim.db serve jim-laptop.juicebot.co.jp jp.co.juicebot.jb7.*
@end group
@end smallexample
This command sets up a single listener loop on the host
address@hidden, serving the
address@hidden collection. This collection will naturally
address@hidden, serving all branches matching
address@hidden This will naturally
include the @code{jp.co.juicebot.jb7} branch, and any sub-branches.
Now Abe decides he wishes to fetch Jim's code. To do this he issues
@@ -1671,8 +1671,8 @@
@smallexample
@group
-monotone --db=abe.db sync jim-laptop.juicebot.co.jp jp.co.juicebot.jb7
-monotone: rebuilding merkle trees for collection jp.co.juicebot.jb7
+monotone --db=abe.db sync jim-laptop.juicebot.co.jp jp.co.juicebot.jb7.*
+monotone: rebuilding merkle trees for pattern jp.co.juicebot.jb7.*
monotone: connecting to jim-laptop.juicebot.co.jp
monotone: [bytes in: 3200] [bytes out: 673]
monotone: successful exchange with jim-laptop.juicebot.co.jp
@@ -1817,8 +1817,8 @@
@smallexample
@group
-$ monotone sync jim-laptop.juicebot.co.jp jp.co.juicebot.jb7
-monotone: rebuilding merkle trees for collection jp.co.juicebot.jb7
+$ monotone sync jim-laptop.juicebot.co.jp jp.co.juicebot.jb7.*
+monotone: rebuilding merkle trees for pattern jp.co.juicebot.jb7.*
monotone: including branch jp.co.juicebot.jb7
monotone: [keys: 2] [rcerts: 8]
monotone: connecting to jim-laptop.juicebot.co.jp
@@ -1832,8 +1832,8 @@
@smallexample
@group
-monotone --db=beth.db sync jim-laptop.juicebot.co.jp jp.co.juicebot.jb7
-monotone: rebuilding merkle trees for collection jp.co.juicebot.jb7
+monotone --db=beth.db sync jim-laptop.juicebot.co.jp jp.co.juicebot.jb7.*
+monotone: rebuilding merkle trees for pattern jp.co.juicebot.jb7.*
monotone: connecting to jim-laptop.juicebot.co.jp
monotone: [bytes in: 3200] [bytes out: 673]
monotone: successful exchange with jim-laptop.juicebot.co.jp
@@ -1884,8 +1884,8 @@
@smallexample
@group
-$ monotone sync jim-laptop.juicebot.co.jp jp.co.juicebot.jb7
-monotone: rebuilding merkle trees for collection jp.co.juicebot.jb7
+$ monotone sync jim-laptop.juicebot.co.jp jp.co.juicebot.jb7.*
+monotone: rebuilding merkle trees for pattern jp.co.juicebot.jb7.*
monotone: including branch jp.co.juicebot.jb7
monotone: [keys: 3] [rcerts: 12]
monotone: connecting to jim-laptop.juicebot.co.jp
@@ -2637,8 +2637,8 @@
@item default-server
The default server for netsync operations to use. Automatically set
by first use of netsync.
address@hidden default-collection
-The default collection for netsync operations to use. Automatically
address@hidden default-pattern
+The default regex pattern for netsync operations to use. Automatically
set by first use of netsync.
@end table
@@ -3011,7 +3011,7 @@
The CVS command contacts a network server, retrieves a revision, and
stores it in your working copy. There are two cosmetic differences
with the monotone command: remote databases are specified by hostnames
-and collections, and revisions are denoted by @sc{sha1} values (or
+and regexes, and revisions are denoted by @sc{sha1} values (or
selectors).
There is also one deep difference: pulling revisions into your
@@ -3608,10 +3608,10 @@
@section Network
@ftable @command
address@hidden monotone serve @var{address}[:@var{port}] (@var{collection}|@var{/regex/}) [...]
address@hidden monotone pull address@hidden:@var{port}] [(@var{collection}|@var{/regex/})]]
address@hidden monotone push address@hidden:@var{port}] [(@var{collection}|@var{/regex/})]]
address@hidden monotone sync address@hidden:@var{port}] [(@var{collection}|@var{/regex/})]]
address@hidden monotone serve @var{address}[:@var{port}] @var{regex} [...]
address@hidden monotone pull address@hidden:@var{port}] address@hidden
address@hidden monotone push address@hidden:@var{port}] address@hidden
address@hidden monotone sync address@hidden:@var{port}] address@hidden
These commands operate the ``netsync'' protocol built into
monotone. This is a custom protocol for rapidly synchronizing two
@@ -3621,18 +3621,16 @@
The network @var{address} specified in each case should be the same: a
host name to listen on, or connect to, optionally followed by a colon
-and a port number. The @var{collection} parameter indicates a set of
-branches to exchange; every branch for which @var{collection} is a
-prefix will be indexed and made available for synchronization.
-Alternatively, a regex may be used instead; in that case every branch
-which matches the regex exactly will be made available.
+and a port number. The @var{regex} parameter indicates a set of
+branches to exchange; every branch which matches @var{regex} exactly
+will be indexed and made available for synchronization.
-The @command{serve} command can take multiple collections, and it will
-then accept clients requesting any of the listed collections. Different
-permissions can be applied to each collection; see the hooks
+The @command{serve} command can take multiple regexes, and it will
+make available all branches matching any of the listed regexes. Different
+permissions can be applied to each regex; see the hooks
@code{get_netsync_read_permitted}, @code{get_netsync_write_permitted},
and @code{get_netsync_anonymous_read_permitted}, all of which take a
address@hidden argument (see @ref{Hook Reference}).
address@hidden argument (see @ref{Hook Reference}).
For example, supposing Bob and Alice wish to synchronize their
@code{net.venge.monotone.win32} and @code{net.venge.monotone.i18n}
@@ -3641,7 +3639,7 @@
@smallexample
@group
-$ monotone serve alice.someisp.com net.venge.monotone
+$ monotone serve alice.someisp.com net.venge.monotone.*
@end group
@end smallexample
@@ -3649,18 +3647,18 @@
@smallexample
@group
-$ monotone sync alice.someisp.com net.venge.monotone
+$ monotone sync alice.someisp.com net.venge.monotone.*
@end group
@end smallexample
-When the operation completes, all branches beginning with
address@hidden will be synchronized between Alice and Bob's
+When the operation completes, all branches matching
address@hidden will be synchronized between Alice and Bob's
databases.
The @command{pull}, @command{push}, and @command{sync} commands only
-require you pass @var{address} and @var{collection} the first time you
+require you pass @var{address} and @var{regex} the first time you
use one of them; monotone will memorize this use and in the future
-default to the same server and collection. For instance, if Bob wants
+default to the same server and regex. For instance, if Bob wants
to @command{sync} with Alice again, he can simply run:
@smallexample
@@ -3670,10 +3668,10 @@
@end smallexample
Of course, he can still @command{sync} with other people and other
-branches by passing an address or address plus collection on the command
+branches by passing an address or address plus regex on the command
line; this will not affect his default affinity for Alice. If you ever
do want to change your defaults, use @code{monotone unset database
-default-server} or @code{monotone unset database default-collection};
+default-server} or @code{monotone unset database default-pattern};
these will clear your defaults, and cause them to be reset to the next
person you netsync with.
@@ -5358,12 +5356,13 @@
@end smallexample
address@hidden get_netsync_read_permitted (@var{collection}, @var{identity})
address@hidden get_netsync_read_permitted (@var{regex}, @var{identity})
Returns @code{true} if a peer authenticated as key @var{identity}
should be allowed to read from your database certs, revisions,
-manifests, and files associated with the netsync index
address@hidden; otherwise @code{false}. This hook has no default
+manifests, and files associated with the branches matching
address@hidden; otherwise @code{false}. @var{regex} will be one of the
+regexes specified on the server command line. This hook has no default
definition, therefore the default behavior is to deny all reads.
Note that the @var{identity} value is a key ID (such as
@@ -5373,22 +5372,25 @@
key fingerprints of each key in your database, as key ID strings are
``convenience names'', not security tokens.
address@hidden get_netsync_anonymous_read_permitted (@var{collection})
address@hidden get_netsync_anonymous_read_permitted (@var{regex})
This hook has identical semantics to @code{get_netsync_read_permitted}
except that it is called when a connecting client requests anonymous
-read access to a collection. There is no corresponding anonymous write
+read access. There is no corresponding anonymous write
access hook. This hook has no default definition, therefore the
default behavior is to deny all anonymous reads.
address@hidden get_netsync_write_permitted (@var{collection}, @var{identity})
address@hidden get_netsync_write_permitted (@var{regex}, @var{identity})
Returns @code{true} if a peer authenticated as key @var{identity}
should be allowed to write into your database certs, revisions,
-manifests, and files associated with the netsync index
address@hidden; otherwise @code{false}. This hook has no default
+manifests, and files associated with the branches matching
address@hidden; otherwise @code{false}. This hook has no default
definition, therefore the default behavior is to deny all writes.
+Note that if write access is granted for one set of branches, there
+is currently no way to restrict that access to only that set of branches.
+
Note that the @var{identity} value is a key ID (such as
address@hidden@@pobox.com}'') but will correspond to a @emph{unique}
key fingerprint (hash) in your database. Monotone will not permit two
@@ -6701,20 +6703,20 @@
@item @b{refresh_inodeprints}
Turn on inodeprints mode, and force a cache refresh.
address@hidden @b{push} @i{ }
-Push contents of @i{} to database on @i{}
address@hidden @b{push} @i{ }
+Push contents of branches matching @i{} to database on @i{}
@comment TROFF INPUT: .SH DESCRIPTION
address@hidden @b{pull} @i{ }
-Pull contents of @i{} from database on @i{}
address@hidden @b{pull} @i{ }
+Pull contents of branches matching @i{} from database on @i{}
@comment TROFF INPUT: .SH DESCRIPTION
address@hidden @b{sync} @i{ }
-Sync contents of @i{} with database on @i{}
address@hidden @b{sync} @i{ }
+Sync contents of branches matching @i{} with database on @i{}
@comment TROFF INPUT: .SH DESCRIPTION
address@hidden @b{serve} @i{ }
-Serve contents of @i{} at network address @i{}
address@hidden @b{serve} @i{ }
+Serve contents of branches matching @i{} at network address @i{}
@comment TROFF INPUT: .SH DESCRIPTION
@item @b{automate} @i{(interface_version|heads|ancestors|attributes|parents|descendents|children|graph|erase_ancestors|toposort|ancestry_difference|leaves|inventory|stdio|certs|select)}
--- netcmd.cc
+++ netcmd.cc
@@ -205,18 +205,18 @@
void
read_anonymous_cmd_payload(std::string const & in,
protocol_role & role,
- std::string & collection,
+ std::string & pattern,
id & nonce2)
{
size_t pos = 0;
- // syntax is:
+ // syntax is:
u8 role_byte = extract_datum_lsb(in, pos, "anonymous netcmd, role");
if (role_byte != static_cast(source_role)
&& role_byte != static_cast(sink_role)
&& role_byte != static_cast(source_and_sink_role))
throw bad_decode(F("unknown role specifier %d") % widen(role_byte));
role = static_cast(role_byte);
- extract_variable_length_string(in, collection, pos, "anonymous netcmd, collection name");
+ extract_variable_length_string(in, pattern, pos, "anonymous netcmd, pattern");
nonce2 = id(extract_substring(in, pos, constants::merkle_hash_length_in_bytes,
"anonymous netcmd, nonce2"));
assert_end_of_buffer(in, pos, "anonymous netcmd payload");
@@ -224,27 +224,27 @@
void
write_anonymous_cmd_payload(protocol_role role,
- std::string const & collection,
+ std::string const & pattern,
id const & nonce2,
std::string & out)
{
I(nonce2().size() == constants::merkle_hash_length_in_bytes);
out += static_cast(role);
- insert_variable_length_string(collection, out);
+ insert_variable_length_string(pattern, out);
out += nonce2();
}
void
read_auth_cmd_payload(string const & in,
protocol_role & role,
- string & collection,
+ string & pattern,
id & client,
id & nonce1,
id & nonce2,
string & signature)
{
size_t pos = 0;
- // syntax is:
+ // syntax is:
//
//
u8 role_byte = extract_datum_lsb(in, pos, "auth netcmd, role");
@@ -253,7 +253,7 @@
&& role_byte != static_cast(source_and_sink_role))
throw bad_decode(F("unknown role specifier %d") % widen(role_byte));
role = static_cast(role_byte);
- extract_variable_length_string(in, collection, pos, "auth netcmd, collection name");
+ extract_variable_length_string(in, pattern, pos, "auth netcmd, pattern");
client = id(extract_substring(in, pos, constants::merkle_hash_length_in_bytes,
"auth netcmd, client identifier"));
nonce1 = id(extract_substring(in, pos, constants::merkle_hash_length_in_bytes,
@@ -266,7 +266,7 @@
void
write_auth_cmd_payload(protocol_role role,
- string const & collection,
+ string const & pattern,
id const & client,
id const & nonce1,
id const & nonce2,
@@ -277,7 +277,7 @@
I(nonce1().size() == constants::merkle_hash_length_in_bytes);
I(nonce2().size() == constants::merkle_hash_length_in_bytes);
out += static_cast(role);
- insert_variable_length_string(collection, out);
+ insert_variable_length_string(pattern, out);
out += client();
out += nonce1();
out += nonce2();
@@ -576,13 +576,13 @@
protocol_role out_role = source_and_sink_role, in_role;
string buf;
id out_nonce2(raw_sha1("nonce start my heart")), in_nonce2;
- string out_collection("radishes galore!"), in_collection;
+ string out_pattern("radishes galore!"), in_pattern;
out_cmd.cmd_code = anonymous_cmd;
- write_anonymous_cmd_payload(out_role, out_collection, out_nonce2, out_cmd.payload);
+ write_anonymous_cmd_payload(out_role, out_pattern, out_nonce2, out_cmd.payload);
write_netcmd(out_cmd, buf);
BOOST_CHECK(read_netcmd(buf, in_cmd));
- read_anonymous_cmd_payload(in_cmd.payload, in_role, in_collection, in_nonce2);
+ read_anonymous_cmd_payload(in_cmd.payload, in_role, in_pattern, in_nonce2);
BOOST_CHECK(in_cmd == out_cmd);
BOOST_CHECK(in_nonce2 == out_nonce2);
BOOST_CHECK(in_role == out_role);
@@ -598,15 +598,15 @@
id out_client(raw_sha1("happy client day")), out_nonce1(raw_sha1("nonce me amadeus")),
out_nonce2(raw_sha1("nonce start my heart")),
in_client, in_nonce1, in_nonce2;
- string out_signature(raw_sha1("burble") + raw_sha1("gorby")), out_collection("radishes galore!"),
- in_signature, in_collection;
+ string out_signature(raw_sha1("burble") + raw_sha1("gorby")), out_pattern("radishes galore!"),
+ in_signature, in_pattern;
out_cmd.cmd_code = auth_cmd;
- write_auth_cmd_payload(out_role, out_collection, out_client, out_nonce1,
+ write_auth_cmd_payload(out_role, out_pattern, out_client, out_nonce1,
out_nonce2, out_signature, out_cmd.payload);
write_netcmd(out_cmd, buf);
BOOST_CHECK(read_netcmd(buf, in_cmd));
- read_auth_cmd_payload(in_cmd.payload, in_role, in_collection, in_client,
+ read_auth_cmd_payload(in_cmd.payload, in_role, in_pattern, in_client,
in_nonce1, in_nonce2, in_signature);
BOOST_CHECK(in_cmd == out_cmd);
BOOST_CHECK(in_client == out_client);
--- netcmd.hh
+++ netcmd.hh
@@ -77,22 +77,22 @@
void read_anonymous_cmd_payload(std::string const & in,
protocol_role & role,
- std::string & collection,
+ std::string & pattern,
id & nonce2);
void write_anonymous_cmd_payload(protocol_role role,
- std::string const & collection,
+ std::string const & pattern,
id const & nonce2,
std::string & out);
void read_auth_cmd_payload(std::string const & in,
protocol_role & role,
- std::string & collection,
+ std::string & pattern,
id & client,
id & nonce1,
id & nonce2,
std::string & signature);
void write_auth_cmd_payload(protocol_role role,
- std::string const & collection,
+ std::string const & pattern,
id const & client,
id const & nonce1,
id const & nonce2,
--- netsync.cc
+++ netsync.cc
@@ -209,7 +209,7 @@
{
protocol_role role;
protocol_voice const voice;
- vector collections;
+ vector patterns;
app_state & app;
string peer_id;
@@ -258,7 +258,7 @@
session(protocol_role role,
protocol_voice voice,
- vector const & collections,
+ vector const & patterns,
app_state & app,
string const & peer,
Netxx::socket_type sock,
@@ -415,14 +415,14 @@
session::session(protocol_role role,
protocol_voice voice,
- vector const & collections,
+ vector const & patterns,
app_state & app,
string const & peer,
Netxx::socket_type sock,
Netxx::Timeout const & to) :
role(role),
voice(voice),
- collections(collections),
+ patterns(patterns),
app(app),
peer_id(peer),
fd(sock),
@@ -450,9 +450,9 @@
{
if (voice == client_voice)
{
- N(collections.size() == 1,
+ N(patterns.size() == 1,
F("client can only sync one pattern at a time"));
- this->pattern = idx(collections, 0);
+ this->pattern = idx(patterns, 0);
}
dbw.set_on_revision_written(boost::bind(&session::rev_written_callback,
@@ -1625,14 +1625,14 @@
}
vector c;
- for(vector::const_iterator i=collections.begin();
- i!=collections.end(); i++)
+ for(vector::const_iterator i=patterns.begin();
+ i!=patterns.end(); i++)
{
if(app.lua.hook_get_netsync_anonymous_read_permitted((*i)()))
c.push_back(*i);
}
- collections=c;
- if(!collections.size())
+ patterns=c;
+ if(!patterns.size())
{
W(F("denied anonymous read permission for '%s'\n") % pattern);
this->saved_nonce = id("");
@@ -1728,14 +1728,14 @@
}
vector c;
- for(vector::const_iterator i=collections.begin();
- i!=collections.end(); i++)
+ for(vector::const_iterator i=patterns.begin();
+ i!=patterns.end(); i++)
{
if(app.lua.hook_get_netsync_read_permitted((*i)(), their_id()))
c.push_back(*i);
}
- collections=c;
- if(!collections.size())
+ patterns=c;
+ if(!patterns.size())
{
W(F("denied '%s' read permission for '%s'\n") % their_id % pattern);
this->saved_nonce = id("");
@@ -1758,14 +1758,14 @@
}
vector c;
- for(vector::const_iterator i=collections.begin();
- i!=collections.end(); i++)
+ for(vector::const_iterator i=patterns.begin();
+ i!=patterns.end(); i++)
{
if(app.lua.hook_get_netsync_write_permitted((*i)(), their_id()))
c.push_back(*i);
}
- collections=c;
- if(!collections.size())
+ patterns=c;
+ if(!patterns.size())
{
W(F("denied '%s' write permission for '%s'\n") % their_id % pattern);
this->saved_nonce = id("");
@@ -2966,7 +2966,7 @@
static void
call_server(protocol_role role,
- vector const & collections,
+ vector const & patterns,
app_state & app,
utf8 const & address,
Netxx::port_type default_port,
@@ -2979,10 +2979,10 @@
P(F("connecting to %s\n") % address());
Netxx::Stream server(address().c_str(), default_port, timeout);
- session sess(role, client_voice, collections, app,
+ session sess(role, client_voice, patterns, app,
address(), server.get_socketfd(), timeout);
- sess.rebuild_merkle_trees(app, idx(collections, 0)());
+ sess.rebuild_merkle_trees(app, idx(patterns, 0)());
sess.byte_in_ticker.reset(new ticker("bytes in", ">", 1024, true));
sess.byte_out_ticker.reset(new ticker("bytes out", "<", 1024, true));
@@ -3132,7 +3132,7 @@
Netxx::StreamServer & server,
Netxx::Timeout & timeout,
protocol_role role,
- vector const & collections,
+ vector const & patterns,
map > & sessions,
app_state & app)
{
@@ -3147,7 +3147,7 @@
else
{
P(F("accepted new client connection from %s\n") % client);
- shared_ptr sess(new session(role, server_voice, collections,
+ shared_ptr sess(new session(role, server_voice, patterns,
app,
lexical_cast(client),
client.get_socketfd(), timeout));
@@ -3262,7 +3262,7 @@
static void
serve_connections(protocol_role role,
- vector const & collections,
+ vector const & patterns,
app_state & app,
utf8 const & address,
Netxx::port_type default_port,
@@ -3315,7 +3315,7 @@
// we either got a new connection
else if (fd == server)
handle_new_connection(addr, server, timeout, role,
- collections, sessions, app);
+ patterns, sessions, app);
// or an existing session woke up
else
@@ -3402,30 +3402,6 @@
}
}
-string
-convert_pattern(string pattern)
-{
- if(pattern.size() > 2 && pattern[0] == '/'
- && pattern[pattern.size()-1] == '/')
- {
- pattern=pattern.substr(1, pattern.size()-2);
- }
- else
- {
- string x=pattern;
- pattern="";
- string e=".|*?+()[]{}^$\\";
- for(string::const_iterator i=x.begin(); i!=x.end(); i++)
- {
- if(e.find(*i) != e.npos)
- pattern+='\\';
- pattern+=*i;
- }
- pattern=pattern+".*";
- }
- return pattern;
-}
-
bool
matches_one(string s, vector r)
{
@@ -3459,10 +3435,10 @@
set branchnames;
set badbranch;
app.db.get_revision_certs(branch_cert_name, certs);
- boost::regex reg(convert_pattern(pattern()));
+ boost::regex reg(pattern());
vector allowed;
- for(vector::const_iterator i=collections.begin();
- i!=collections.end(); i++)
+ for(vector::const_iterator i=patterns.begin();
+ i!=patterns.end(); i++)
{
allowed.push_back(boost::regex((*i)()));
}
@@ -3564,7 +3540,7 @@
run_netsync_protocol(protocol_voice voice,
protocol_role role,
utf8 const & addr,
- vector collections,
+ vector patterns,
app_state & app)
{
try
@@ -3572,7 +3548,7 @@
start_platform_netsync();
if (voice == server_voice)
{
- serve_connections(role, collections, app,
+ serve_connections(role, patterns, app,
addr, static_cast(constants::netsync_default_port),
static_cast(constants::netsync_timeout_seconds),
static_cast(constants::netsync_connection_limit));
@@ -3581,7 +3557,7 @@
{
I(voice == client_voice);
transaction_guard guard(app.db);
- call_server(role, collections, app,
+ call_server(role, patterns, app,
addr, static_cast(constants::netsync_default_port),
static_cast(constants::netsync_timeout_seconds));
guard.commit();
--- netsync.hh
+++ netsync.hh
@@ -22,7 +22,7 @@
void run_netsync_protocol(protocol_voice voice,
protocol_role role,
utf8 const & addr,
- std::vector collections,
+ std::vector patterns,
app_state & app);
#endif // __NETSYNC_H__
--- tests/t_epoch_unidirectional.at
+++ tests/t_epoch_unidirectional.at
@@ -17,7 +17,7 @@
AT_CHECK(MONOTONE2 add testfile, [], [ignore], [ignore])
AT_CHECK(MONOTONE2 commit --message=foo --branch=testbranch.subbranch, [], [ignore], [ignore])
-RUN_NETSYNC(pull, testbranch)
+RUN_NETSYNC(pull, 'testbranch.*')
CHECK_DIFFERENT_STDOUT(MONOTONE list epochs, MONOTONE2 list epochs)
--- tests/t_netsync_defaults.at
+++ tests/t_netsync_defaults.at
@@ -1,4 +1,4 @@
-AT_SETUP([default server/collection])
+AT_SETUP([default server/pattern])
AT_KEYWORDS(netsync)
MONOTONE_SETUP
NETSYNC_SETUP
@@ -20,23 +20,23 @@
NETSYNC_SERVE_START(testbranch otherbranch thirdbranch)
-# First make sure netsync with explicit server/collection override defaults
+# First make sure netsync with explicit server/pattern override defaults
AT_CHECK(MONOTONE2 set database default-server nonsense, [], [ignore], [ignore])
-AT_CHECK(MONOTONE2 set database default-collection nonsense, [], [ignore], [ignore])
+AT_CHECK(MONOTONE2 set database default-pattern nonsense, [], [ignore], [ignore])
NETSYNC_CLIENT_RUN(pull, testbranch, 0)
AT_CHECK(MONOTONE2 checkout --branch=testbranch --revision=$TESTBRANCH_R testdir1, [], [ignore], [ignore])
AT_CHECK(test -f testdir1/testfile)
-# Now make sure explicit server with default collection works...
+# Now make sure explicit server with default pattern works...
AT_CHECK(MONOTONE2 set database default-server nonsense, [], [ignore], [ignore])
-AT_CHECK(MONOTONE2 set database default-collection otherbranch, [], [ignore], [ignore])
+AT_CHECK(MONOTONE2 set database default-pattern otherbranch, [], [ignore], [ignore])
NETSYNC_CLIENT_RUN(pull, [])
AT_CHECK(MONOTONE2 checkout --branch=otherbranch --revision=$OTHERBRANCH_R testdir2, [], [ignore], [ignore])
AT_CHECK(test -f testdir2/testfile)
# And finally,
AT_CHECK(MONOTONE2 set database default-server 127.0.0.1:$_PORT, [], [ignore], [ignore])
-AT_CHECK(MONOTONE2 set database default-collection thirdbranch, [], [ignore], [ignore])
+AT_CHECK(MONOTONE2 set database default-pattern thirdbranch, [], [ignore], [ignore])
AT_CHECK(MONOTONE2 sync, [], [ignore], [ignore])
AT_CHECK(MONOTONE2 checkout --branch=thirdbranch --revision=$THIRDBRANCH_R testdir3, [], [ignore], [ignore])
AT_CHECK(test -f testdir3/testfile)
--- tests/t_netsync_error.at
+++ tests/t_netsync_error.at
@@ -1,6 +1,6 @@
AT_SETUP([netsync badhost gives nice error])
MONOTONE_SETUP
-AT_CHECK(MONOTONE pull nosuchhost__blahblah__asdvasoih.com some.collection, [1], [ignore], [ignore])
+AT_CHECK(MONOTONE pull nosuchhost__blahblah__asdvasoih.com some.pattern, [1], [ignore], [ignore])
AT_CLEANUP
--- tests/t_netsync_permissions.at
+++ tests/t_netsync_permissions.at
@@ -14,15 +14,15 @@
# test with open security settings
AT_DATA(open.lua, [
-function get_netsync_read_permitted(collection, identity)
+function get_netsync_read_permitted(pattern, identity)
return true
end
-function get_netsync_write_permitted(collection, identity)
+function get_netsync_write_permitted(pattern, identity)
return true
end
-function get_netsync_anonymous_read_permitted(collection)
+function get_netsync_anonymous_read_permitted(pattern)
return true
end
])
@@ -101,17 +101,17 @@
# test with closed security settings
AT_DATA(closed.lua, [
-function get_netsync_read_permitted(collection, identity)
+function get_netsync_read_permitted(pattern, identity)
if (identity == "address@hidden") then return true end
return false
end
-function get_netsync_write_permitted(collection, identity)
+function get_netsync_write_permitted(pattern, identity)
if (identity == "address@hidden") then return true end
return false
end
-function get_netsync_anonymous_read_permitted(collection)
+function get_netsync_anonymous_read_permitted(pattern)
return false
end
])
--- tests/t_netsync_set_defaults.at
+++ tests/t_netsync_set_defaults.at
@@ -1,4 +1,4 @@
-AT_SETUP([default server/collection setting])
+AT_SETUP([default server/pattern setting])
AT_KEYWORDS(netsync)
MONOTONE_SETUP
NETSYNC_SETUP
--- tests/t_netsync_single.at
+++ tests/t_netsync_single.at
@@ -7,11 +7,11 @@
AT_CHECK(cp test.db test2.db)
AT_DATA(netsync.lua, [
-function get_netsync_read_permitted(collection, identity)
+function get_netsync_read_permitted(pattern, identity)
return true
end
-function get_netsync_write_permitted(collection, identity)
+function get_netsync_write_permitted(pattern, identity)
return true
end
])
--- tests/t_select_cert.at
+++ tests/t_select_cert.at
@@ -38,10 +38,10 @@
AT_CHECK(grep 'has multiple ambiguous expansions' stderr, [0], [ignore])
# Check that exact value succeed...
-AT_CHECK(MONOTONE update 'c:testcert=value', [], [ignore], [ignore])
+AT_CHECK(MONOTONE update --revision='c:testcert=value', [], [ignore], [ignore])
AT_CHECK(cmp testfile testfile2, [], [ignore])
-AT_CHECK(MONOTONE update 'c:testcert=value=with=equal=signs', [], [ignore], [ignore])
+AT_CHECK(MONOTONE update --revision='c:testcert=value=with=equal=signs', [], [ignore], [ignore])
AT_CHECK(cmp testfile testfile1, [], [ignore])
AT_CLEANUP
--- tests/t_update_to_revision.at
+++ tests/t_update_to_revision.at
@@ -50,7 +50,7 @@
# Create leaf revision based off middle.
AT_CHECK(cp left-leaf testfile)
-AT_CHECK(MONOTONE commit --message blah-blah, [], [ignore], [ignore])g
+AT_CHECK(MONOTONE commit --message blah-blah, [], [ignore], [ignore])
LEFT_LEAF_R_SHA=`BASE_REVISION`
# Test going backward in the revision tree.
--- testsuite.at
+++ testsuite.at
@@ -323,11 +323,11 @@
AT_CHECK(cp test.db test2.db)
AT_CHECK(cp test.db test3.db)
AT_DATA(netsync.lua, [
-function get_netsync_read_permitted(collection, identity)
+function get_netsync_read_permitted(pattern, identity)
return true
end
-function get_netsync_write_permitted(collection, identity)
+function get_netsync_write_permitted(pattern, identity)
return true
end
])
@@ -376,14 +376,14 @@
rm -f monotone_at.pid 2>/dev/null
])
-# run as NETSYNC_SERVE_N_START(2|3, collection name)
+# run as NETSYNC_SERVE_N_START(2|3, pattern)
# note that NETSYNC_SERVE_START is _not_ a special case of this macro.
m4_define([NETSYNC_SERVE_N_START], [
NETSYNC_KILLHARD
MONOTONE --db=test$1.db --rcfile=netsync.lua --pid-file=monotone_at.pid serve localhost:$_PORT $2 &
sleep 4
])
-# run as NETSYNC_SERVE_START(collection name)
+# run as NETSYNC_SERVE_START(pattern)
m4_define([NETSYNC_SERVE_START], [
NETSYNC_KILLHARD
MONOTONE --rcfile=netsync.lua --pid-file=monotone_at.pid serve localhost:$_PORT $1 &
@@ -395,16 +395,16 @@
sleep 1
NETSYNC_KILLHARD
])
-# run as NETSYNC_CLIENT_N_RUN(2|3, push|pull|sync, collection name[, expected result])
+# run as NETSYNC_CLIENT_N_RUN(2|3, push|pull|sync, pattern[, expected result])
# first argument chooses whether to use the 2nd or 3rd database
m4_define([NETSYNC_CLIENT_N_RUN], [
AT_CHECK(MONOTONE --db=test$1.db --rcfile=netsync.lua $2 localhost:$_PORT $3, [$4], [ignore], [ignore])
])
-# run as NETSYNC_CLIENT_RUN(push|pull|sync, collection name[, expected result])
+# run as NETSYNC_CLIENT_RUN(push|pull|sync, pattern[, expected result])
m4_define([NETSYNC_CLIENT_RUN], [
NETSYNC_CLIENT_N_RUN(2, $1, $2, $3)
])
-# run as RUN_NETSYNC(push|pull|sync, collection name)
+# run as RUN_NETSYNC(push|pull|sync, pattern)
# It is the second database that is always the client; take this into
# account when choosing push|pull|sync.
m4_define([RUN_NETSYNC], [
--- vocab_terms.hh
+++ vocab_terms.hh
@@ -22,7 +22,7 @@
ATOMIC(cert_name); // symbol-of-your-choosing
ATOMIC_NOVERIFY(cert_value); // symbol-of-your-choosing
-// some domains: "database" (+ default_server, default_collection),
+// some domains: "database" (+ default_server, default_pattern),
// server_key (+ servername/key)
// branch_alias (+ short form/long form)
// trust_seed (+ branch/seed)