[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Cvs-cvs] Changes to ccvs/src/watch.c
From: |
Jim Hyslop |
Subject: |
[Cvs-cvs] Changes to ccvs/src/watch.c |
Date: |
Wed, 03 Aug 2005 21:04:38 -0400 |
Index: ccvs/src/watch.c
diff -u ccvs/src/watch.c:1.43 ccvs/src/watch.c:1.44
--- ccvs/src/watch.c:1.43 Fri Aug 20 21:02:31 2004
+++ ccvs/src/watch.c Thu Aug 4 01:04:34 2005
@@ -54,6 +54,8 @@
int add_tunedit_pending;
int add_tcommit_pending;
+ TRACE( TRACE_FUNCTION, "modify_watchers ( %s )", file );
+
who = getcaller ();
who_len = strlen (who);
@@ -222,30 +224,57 @@
return 0;
}
+static int addremove_filesdoneproc (void * callerdat, int err, const char *
repository,
+ const char *update_dir, List *
entries)
+{
+ int set_default = the_args.setting_default;
+ int dir_check = 0;
+
+ while ( !set_default && dir_check < the_args.num_dirs )
+ {
+ /* If we are recursing, then just see if the first part of update_dir
+ matches any of the specified directories. Otherwise, it must be an
exact
+ match. */
+ if ( the_args.local )
+ set_default = strcmp( update_dir, the_args.dirs[ dir_check ] )==0;
+ else
+ set_default = strncmp( update_dir, the_args.dirs[ dir_check ],
strlen( the_args.dirs[ dir_check ] ) ) == 0;
+ dir_check++;
+ }
+
+ if (set_default)
+ watch_modify_watchers (NULL, &the_args);
+ return err;
+}
static int
watch_addremove (int argc, char **argv)
{
int c;
- int local = 0;
int err;
int a_omitted;
+ int arg_index;
+ int max_dirs;
a_omitted = 1;
the_args.commit = 0;
the_args.edit = 0;
the_args.unedit = 0;
+ the_args.num_dirs = 0;
+ the_args.dirs = NULL;
+ the_args.local = 0;
+
optind = 0;
while ((c = getopt (argc, argv, "+lRa:")) != -1)
{
switch (c)
{
case 'l':
- local = 1;
+ the_args.local = 1;
break;
case 'R':
- local = 0;
+ the_args.local = 0;
break;
case 'a':
a_omitted = 0;
@@ -279,6 +308,25 @@
argc -= optind;
argv += optind;
+ the_args.num_dirs = 0;
+ max_dirs = 4; /* Arbitrary choice. */
+ the_args.dirs = xmalloc( sizeof( const char * ) * max_dirs );
+
+ TRACE (TRACE_FUNCTION, "watch_addremove (%d)", argc);
+ for ( arg_index=0; arg_index<argc; ++arg_index )
+ {
+ TRACE( TRACE_FUNCTION, "\t%s", argv[ arg_index ]);
+ if ( isdir( argv[ arg_index ] ) )
+ {
+ if ( the_args.num_dirs >= max_dirs )
+ {
+ max_dirs *= 2;
+ the_args.dirs = (const char ** )xrealloc( (void
*)the_args.dirs, max_dirs );
+ }
+ the_args.dirs[ the_args.num_dirs++ ] = argv[ arg_index ];
+ }
+ }
+
if (a_omitted)
{
the_args.edit = 1;
@@ -292,7 +340,7 @@
start_server ();
ign_setup ();
- if (local)
+ if (the_args.local)
send_arg ("-l");
/* FIXME: copes poorly with "all" if server is extended to have
new watch types and client is still running an old version. */
@@ -305,7 +353,7 @@
if (!the_args.edit && !the_args.unedit && !the_args.commit)
option_with_arg ("-a", "none");
send_arg ("--");
- send_files (argc, argv, local, 0, SEND_NO_CONTENTS);
+ send_files (argc, argv, the_args.local, 0, SEND_NO_CONTENTS);
send_file_names (argc, argv, SEND_EXPAND_WILD);
send_to_server (the_args.adding ?
"watch-add\012" : "watch-remove\012",
@@ -316,14 +364,17 @@
the_args.setting_default = (argc <= 0);
- lock_tree_promotably (argc, argv, local, W_LOCAL, 0);
+ lock_tree_promotably (argc, argv, the_args.local, W_LOCAL, 0);
err = start_recursion
- (addremove_fileproc, NULL, NULL, NULL, NULL,
- argc, argv, local, W_LOCAL, 0, CVS_LOCK_WRITE,
+ (addremove_fileproc, addremove_filesdoneproc, NULL, NULL, NULL,
+ argc, argv, the_args.local, W_LOCAL, 0, CVS_LOCK_WRITE,
NULL, 1, NULL);
Lock_Cleanup ();
+ free( (void *)the_args.dirs );
+ the_args.dirs = NULL;
+
return err;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Cvs-cvs] Changes to ccvs/src/watch.c,
Jim Hyslop <=