# # patch "ChangeLog" # from [16a82ae86e06b90b5d4062f935e5168dc88df446] # to [0b1a203e49ede47e06e124574f5a236f2908ccba] # # patch "app_state.cc" # from [9c37128fc8af7ad8bb4f5327dee434b430af4323] # to [c56e3daaebf31fe76aa4697264e32a100ba9276c] # # patch "app_state.hh" # from [2e07ee9fa9f8a9b3e25c4956cc998e63fd346dbd] # to [6d1a41d722b961c2d6806a07fea7819f230f1975] # # patch "commands.cc" # from [2fcb423053b7dfe19cb23d9386e0454b3e57fec9] # to [c0d603e1a6bac242916b5fd4410578d29434af94] # # patch "monotone.cc" # from [edc6e4d96379486380caa5fe383a857378b2be4e] # to [f346dce0c6ad304dc9300a1d2b3ce25ac705ad13] # # patch "monotone.texi" # from [4db03f3933d2e52204d9cce07c336465d0823506] # to [6f5d43f75aeed98ee3502403ebbd5fac88f4c9b5] # # patch "options.hh" # from [8c52cb173884c36f1427b428f26817806be57a26] # to [2d21f8009f424d24e5513c3894c0ff321e79feb0] # --- ChangeLog +++ ChangeLog @@ -1,5 +1,14 @@ 2005-07-11 Timothy Brownawell + * options.hh, app_state.{hh,cc}, monotone.cc: New command specific + option, "--exclude=x", puts arg into a vector app.excludes . + Used by the netsync commands. + * commands.cc (netsync commands): accept said option + (process_netsync_args): Handle excludes. + * monotone.texi: document it + +2005-07-11 Timothy Brownawell + * interner.hh: make slightly faster 2005-07-10 Nathaniel Smith --- app_state.cc +++ app_state.cc @@ -344,6 +344,12 @@ } void +app_state::add_exclude(utf8 const & pattern) +{ + excludes.push_back(pattern); +} + +void app_state::set_stdhooks(bool b) { stdhooks = b; --- app_state.hh +++ app_state.hh @@ -42,6 +42,7 @@ utf8 author; utf8 search_root; std::vector revision_selectors; + std::vector excludes; std::vector extra_rcfiles; path_set restrictions; file_path relative_directory; @@ -80,6 +81,7 @@ void set_last(long last); void set_pidfile(utf8 const & pidfile); void add_revision(utf8 const & selector); + void add_exclude(utf8 const & pattern); void set_stdhooks(bool b); void set_rcfiles(bool b); --- commands.cc +++ commands.cc @@ -2031,13 +2031,33 @@ include_pattern = utf8(pattern_value()); L(F("using default branch pattern: %s\n") % include_pattern); } - - // For now, don't handle excludes. - exclude_pattern = utf8(""); + if (app.excludes.size()) + { + std::set patterns(app.excludes.begin(), app.excludes.end()); + combine_and_check_globish(patterns, exclude_pattern); + if (use_defaults && + (!app.db.var_exists(default_exclude_pattern_key) || app.set_default)) + { + P(F("setting default exclude pattern to %s\n") % exclude_pattern); + app.db.set_var(default_exclude_pattern_key, var_value(exclude_pattern())); + } + } + else + { + if (app.db.var_exists(default_exclude_pattern_key)) + { + var_value pattern_value; + app.db.get_var(default_exclude_pattern_key, pattern_value); + exclude_pattern = utf8(pattern_value()); + L(F("using default exclude pattern: %s\n") % exclude_pattern); + } + else + exclude_pattern = utf8(""); + } } CMD(push, "network", "[ADDRESS[:PORTNUMBER] [PATTERN]]", - "push branches matching PATTERN to netsync server at ADDRESS", OPT_SET_DEFAULT) + "push branches matching PATTERN to netsync server at ADDRESS", OPT_SET_DEFAULT % OPT_EXCLUDE) { utf8 addr, include_pattern, exclude_pattern; process_netsync_args(name, args, addr, include_pattern, exclude_pattern, true, app); @@ -2051,7 +2071,7 @@ } CMD(pull, "network", "[ADDRESS[:PORTNUMBER] [PATTERN]]", - "pull branches matching PATTERN from netsync server at ADDRESS", OPT_SET_DEFAULT) + "pull branches matching PATTERN from netsync server at ADDRESS", OPT_SET_DEFAULT % OPT_EXCLUDE) { utf8 addr, include_pattern, exclude_pattern; process_netsync_args(name, args, addr, include_pattern, exclude_pattern, true, app); @@ -2064,7 +2084,7 @@ } CMD(sync, "network", "[ADDRESS[:PORTNUMBER] [PATTERN]]", - "sync branches matching PATTERN with netsync server at ADDRESS", OPT_SET_DEFAULT) + "sync branches matching PATTERN with netsync server at ADDRESS", OPT_SET_DEFAULT % OPT_EXCLUDE) { utf8 addr, include_pattern, exclude_pattern; process_netsync_args(name, args, addr, include_pattern, exclude_pattern, true, app); @@ -2078,7 +2098,7 @@ } CMD(serve, "network", "ADDRESS[:PORTNUMBER] PATTERN ...", - "listen on ADDRESS and serve the specified branches to connecting clients", OPT_PIDFILE) + "listen on ADDRESS and serve the specified branches to connecting clients", OPT_PIDFILE % OPT_EXCLUDE) { if (args.size() < 2) throw usage(name); --- monotone.cc +++ monotone.cc @@ -58,6 +58,7 @@ {"diffs", 0, POPT_ARG_NONE, NULL, OPT_DIFFS, "print diffs along with logs", NULL}, {"no-merges", 0, POPT_ARG_NONE, NULL, OPT_NO_MERGES, "skip merges when printing logs", NULL}, {"set-default", 0, POPT_ARG_NONE, NULL, OPT_SET_DEFAULT, "use the current arguments as the future default", NULL}, + {"exclude", 'e', POPT_ARG_STRING, &argstr, OPT_EXCLUDE, "exclude pattern", NULL}, { NULL, 0, 0, NULL, 0, NULL, NULL } }; @@ -350,6 +351,10 @@ app.add_revision(string(argstr)); break; + case OPT_EXCLUDE: + app.add_exclude(string(argstr)); + break; + case OPT_MESSAGE: app.set_message(string(argstr)); break; --- monotone.texi +++ monotone.texi @@ -3657,9 +3657,9 @@ @ftable @command @item monotone serve @var{address}[:@var{port}] @var{glob} [...] address@hidden monotone pull [--set-default] address@hidden:@var{port}] address@hidden [...]]] address@hidden monotone push [--set-default] address@hidden:@var{port}] address@hidden [...]]] address@hidden monotone sync [--set-default] address@hidden:@var{port}] address@hidden [...]]] address@hidden monotone pull [--set-default] address@hidden:@var{port}] address@hidden [...] address@hidden address@hidden monotone push [--set-default] address@hidden:@var{port}] address@hidden [...] address@hidden address@hidden monotone sync [--set-default] address@hidden:@var{port}] address@hidden [...] address@hidden These commands operate the ``netsync'' protocol built into monotone. This is a custom protocol for rapidly synchronizing two @@ -3671,8 +3671,8 @@ host name to listen on, or connect to, optionally followed by a colon and a port number. The default port number is 5253. 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. +matches a @var{glob} exactly, and does not match an @var{exclude-glob}, +will be indexed and made available for synchronization. The @command{serve} command can take multiple globs, and it will make available all branches matching any of them. Different permissions can --- options.hh +++ options.hh @@ -36,3 +36,4 @@ #define OPT_LAST 27 #define OPT_VERBOSE 28 #define OPT_SET_DEFAULT 29 +#define OPT_EXCLUDE 30