#
# patch "ChangeLog"
# from [0ca93767cb63da9e8be5fdc8455639412d25be84]
# to [b52234a6c67f46af1ec7c215089e6428c3b4ba77]
#
# patch "commands.cc"
# from [d127c7cd5850b011fce7ebb5247d172a9ce461c2]
# to [6d3576bd14d6e1fe8c595a75dcf50a478e6f1f65]
#
# patch "monotone.1"
# from [8b3699fb3547458585d9e9acb48f4baf5fd0b6fa]
# to [da6b32b820606a2fa282d47374330c0ca455ffb8]
#
# patch "monotone.texi"
# from [9329f360a56f9f72673f52a94f3293ce9c13a35d]
# to [18fdc4eac00664cacf2ca7e151a07c8ece75a479]
#
--- ChangeLog
+++ ChangeLog
@@ -1,6 +1,13 @@
2005-07-04 Nathaniel Smith
+ * monotone.texi, monotone.1: Update for new glob stuff.
* commands.cc (process_netsync_args, push, pull, sync, serve):
+ 'serve' always requires arguments, rather than falling back on db
+ defaults.
+
+2005-07-04 Nathaniel Smith
+
+ * commands.cc (process_netsync_args, push, pull, sync, serve):
Adapt for patterns instead of regexen; slight refactoring too.
2005-07-03 Nathaniel Smith
--- commands.cc
+++ commands.cc
@@ -1987,15 +1987,13 @@
std::vector const & args,
utf8 & addr,
utf8 & include_pattern, utf8 & exclude_pattern,
+ bool use_defaults,
app_state & app)
{
- if (args.size() > 2)
- throw usage(name);
-
if (args.size() >= 1)
{
addr = idx(args, 0);
- if (!app.db.var_exists(default_server_key))
+ if (use_defaults && !app.db.var_exists(default_server_key))
{
P(F("setting default server to %s\n") % addr);
app.db.set_var(default_server_key, var_value(addr()));
@@ -2003,6 +2001,7 @@
}
else
{
+ N(use_defaults, F("no hostname given"));
N(app.db.var_exists(default_server_key),
F("no server given and no default server set"));
var_value addr_value;
@@ -2014,7 +2013,7 @@
{
std::set patterns(args.begin() + 1, args.end());
combine_and_check_globish(patterns, include_pattern);
- if (!app.db.var_exists(default_include_pattern_key))
+ if (use_defaults && !app.db.var_exists(default_include_pattern_key))
{
P(F("setting default branch pattern to %s\n") % include_pattern);
app.db.set_var(default_include_pattern_key, var_value(include_pattern()));
@@ -2022,6 +2021,7 @@
}
else
{
+ N(use_defaults, F("no branch pattern given"));
N(app.db.var_exists(default_include_pattern_key),
F("no branch pattern given and no default pattern set"));
var_value pattern_value;
@@ -2038,7 +2038,7 @@
"push branches matching REGEX to netsync server at ADDRESS", OPT_NONE)
{
utf8 addr, include_pattern, exclude_pattern;
- process_netsync_args(name, args, addr, include_pattern, exclude_pattern, app);
+ process_netsync_args(name, args, addr, include_pattern, exclude_pattern, true, app);
rsa_keypair_id key;
N(guess_default_key(key, app), F("could not guess default signing key"));
@@ -2052,7 +2052,7 @@
"pull branches matching REGEX from netsync server at ADDRESS", OPT_NONE)
{
utf8 addr, include_pattern, exclude_pattern;
- process_netsync_args(name, args, addr, include_pattern, exclude_pattern, app);
+ process_netsync_args(name, args, addr, include_pattern, exclude_pattern, true, app);
if (app.signing_key() == "")
W(F("doing anonymous pull\n"));
@@ -2065,7 +2065,7 @@
"sync branches matching REGEX with netsync server at ADDRESS", OPT_NONE)
{
utf8 addr, include_pattern, exclude_pattern;
- process_netsync_args(name, args, addr, include_pattern, exclude_pattern, app);
+ process_netsync_args(name, args, addr, include_pattern, exclude_pattern, true, app);
rsa_keypair_id key;
N(guess_default_key(key, app), F("could not guess default signing key"));
@@ -2092,7 +2092,7 @@
require_password(key, app);
utf8 addr, include_pattern, exclude_pattern;
- process_netsync_args(name, args, addr, include_pattern, exclude_pattern, app);
+ process_netsync_args(name, args, addr, include_pattern, exclude_pattern, false, app);
run_netsync_protocol(server_voice, source_and_sink_role, addr,
include_pattern, exclude_pattern, app);
}
--- monotone.1
+++ monotone.1
@@ -162,17 +162,17 @@
\fBrefresh_inodeprints\fP
Turn on inodeprints mode, and force a cache refresh.
.TP
-\fBpush\fP \fI[ []]\fP
-Push contents of \fI\fP to database on \fI\fP.
+\fBpush\fP \fI[ []]\fP
+Push contents of \fI\fP to database on \fI\fP.
.TP
-\fBpull\fP \fI[ []]\fP
-Push contents of \fI\fP from database on \fI\fP.
+\fBpull\fP \fI[ []]\fP
+Push contents of \fI\fP from database on \fI\fP.
.TP
-\fBsync\fP \fI \fP
-Sync contents of \fI\fP with database on \fI\fP.
+\fBsync\fP \fI \fP
+Sync contents of \fI\fP with database on \fI\fP.
.TP
-\fBserve\fP \fI[--pid-file=] \fP
-Serve contents of \fI\fP at network address \fI\fP. If a
+\fBserve\fP \fI[--pid-file=] \fP
+Serve contents of \fI\fP at network address \fI\fP. If a
--pid-file option is provided on the command line, monotone will store the
process id of the server in the specified file.
.TP
--- monotone.texi
+++ monotone.texi
@@ -1660,22 +1660,24 @@
@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
@code{jim-laptop.juicebot.co.jp}, serving all branches matching
address@hidden This will naturally
-include the @code{jp.co.juicebot.jb7} branch, and any sub-branches.
address@hidden This will naturally include the
address@hidden branch, and any sub-branches. The quotes
+around @code{"jp.co.juicebot.jb7*"} are there to protect the @code{*}
+from expansion by the shell; they have no meaning to monotone.
Now Abe decides he wishes to fetch Jim's code. To do this he issues
the monotone @code{sync} command:
@smallexample
@group
-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 --db=abe.db sync jim-laptop.juicebot.co.jp "jp.co.juicebot.jb7*"
+monotone: rebuilding merkle trees ...
monotone: connecting to jim-laptop.juicebot.co.jp
monotone: [bytes in: 3200] [bytes out: 673]
monotone: successful exchange with jim-laptop.juicebot.co.jp
@@ -1820,8 +1822,8 @@
@smallexample
@group
-$ monotone sync jim-laptop.juicebot.co.jp "jp.co.juicebot.jb7.*"
-monotone: rebuilding merkle trees for pattern jp.co.juicebot.jb7.*
+$ monotone sync jim-laptop.juicebot.co.jp "jp.co.juicebot.jb7*"
+monotone: rebuilding merkle trees ...
monotone: including branch jp.co.juicebot.jb7
monotone: [keys: 2] [rcerts: 8]
monotone: connecting to jim-laptop.juicebot.co.jp
@@ -1835,8 +1837,8 @@
@smallexample
@group
-$ 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 --db=beth.db sync jim-laptop.juicebot.co.jp "jp.co.juicebot.jb7*"
+monotone: rebuilding merkle trees ...
monotone: connecting to jim-laptop.juicebot.co.jp
monotone: [bytes in: 3200] [bytes out: 673]
monotone: successful exchange with jim-laptop.juicebot.co.jp
@@ -1887,8 +1889,8 @@
@smallexample
@group
-$ monotone sync jim-laptop.juicebot.co.jp "jp.co.juicebot.jb7.*"
-monotone: rebuilding merkle trees for pattern jp.co.juicebot.jb7.*
+$ monotone sync jim-laptop.juicebot.co.jp "jp.co.juicebot.jb7*"
+monotone: rebuilding merkle trees ...
monotone: including branch jp.co.juicebot.jb7
monotone: [keys: 3] [rcerts: 12]
monotone: connecting to jim-laptop.juicebot.co.jp
@@ -2641,9 +2643,9 @@
@item default-server
The default server for netsync operations to use. Automatically set
by first use of netsync.
address@hidden default-pattern
-The default regex pattern for netsync operations to use. Automatically
-set by first use of netsync.
address@hidden default-include-pattern
+The default branch glob pattern for netsync operations to use.
+Automatically set by first use of netsync.
@end table
@item known-servers
@@ -3047,7 +3049,7 @@
@tab
@smallexample
@group
-$ monotone pull www.foo.com com.foo.wobbler
+$ monotone pull www.foo.com com.foo.wobbler*
$ monotone checkout --revision=fe37 wobbler
@end group
@end smallexample
@@ -3056,7 +3058,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 regexes, and revisions are denoted by @sc{sha1} values (or
+and globs, and revisions are denoted by @sc{sha1} values (or
selectors).
There is also one deep difference: pulling revisions into your
@@ -3080,7 +3082,7 @@
@smallexample
@group
$ monotone commit --message="log message"
-$ monotone push www.foo.com com.foo.wobbler
+$ monotone push www.foo.com com.foo.wobbler*
@end group
@end smallexample
@end multitable
@@ -3102,7 +3104,7 @@
@tab
@smallexample
@group
-$ monotone pull www.foo.com com.foo.wobbler
+$ monotone pull www.foo.com com.foo.wobbler*
$ monotone merge
$ monotone update
@end group
@@ -3653,10 +3655,10 @@
@section Network
@ftable @command
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
address@hidden monotone serve @var{address}[:@var{port}] @var{glob} [...]
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
@@ -3666,25 +3668,25 @@
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{regex} parameter indicates a set of
-branches to exchange; every branch which matches @var{regex} exactly
+and a port number. The @var{glob} parameters indicate a set of
+branches to exchange; every branch which matches a @var{glob} exactly
will be indexed and made available for synchronization.
-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 branch; see the hooks
+The @command{serve} command can take multiple globs, and it will make
+available all branches matching any of them. Different permissions can
+be applied to each branch; 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}).
+and @code{get_netsync_anonymous_read_permitted} (see @ref{Hook
+Reference}).
-For example, supposing Bob and Alice wish to synchronize their
+For example, perhaps Bob and Alice wish to synchronize their
@code{net.venge.monotone.win32} and @code{net.venge.monotone.i18n}
branches. Supposing Alice's computer has hostname
@code{alice.someisp.com}, then Alice might run:
@smallexample
@group
-$ monotone serve alice.someisp.com "net.venge.monotone.*"
+$ monotone serve alice.someisp.com "net.venge.monotone*"
@end group
@end smallexample
@@ -3692,19 +3694,19 @@
@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 matching
address@hidden will be synchronized between Alice and Bob's
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{regex} the first time you
-use one of them; monotone will memorize this use and in the future
-default to the same server and regex. For instance, if Bob wants
-to @command{sync} with Alice again, he can simply run:
+require you pass @var{address} and @var{glob} the first time you use one
+of them; monotone will memorize this use and in the future default to
+the same server and glob. For instance, if Bob wants to @command{sync}
+with Alice again, he can simply run:
@smallexample
@group
@@ -3713,18 +3715,26 @@
@end smallexample
Of course, he can still @command{sync} with other people and other
-branches by passing an address or address plus regex on the command
+branches by passing an address or address plus globs 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-pattern};
-these will clear your defaults, and cause them to be reset to the next
-person you netsync with.
+default-server} or @code{monotone unset database
+default-include-pattern}; these will clear your defaults, and cause them
+to be reset to the next person you netsync with.
If a @option{--pid-file} option is specified, the command
@command{serve} will create the specified file and record the process
identifier of the server in the file. This file can then be read to
identify specific monotone server processes.
+The syntax for patterns is very simple. @code{*} matches 0 or more
+arbitrary characters. @code{?} matches exactly 1 arbitrary character.
address@hidden@{foo,bar,address@hidden matches ``foo'', or ``bar'', or ``baz''. These
+can be combined arbitrarily. A backslash, @code{\}, can be prefixed to
+any character, to match exactly that character --- this might be useful
+in case someone, for some odd reason, decides to put a ``*'' into their
+branch name.
+
@end ftable
@@ -6725,20 +6735,20 @@
@item @b{refresh_inodeprints}
Turn on inodeprints mode, and force a cache refresh.
address@hidden @b{push} @i{ }
-Push contents of branches matching @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 branches matching @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 branches matching @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 branches matching @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)}