cvs-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Cvs-cvs] ccvs/src ChangeLog client.c subr.c subr.h


From: Derek Robert Price
Subject: [Cvs-cvs] ccvs/src ChangeLog client.c subr.c subr.h
Date: Tue, 16 Sep 2008 19:24:41 +0000

CVSROOT:        /cvsroot/cvs
Module name:    ccvs
Changes by:     Derek Robert Price <dprice>     08/09/16 19:24:41

Modified files:
        src            : ChangeLog client.c subr.c subr.h 

Log message:
        * client.c (arg_should_not_be_sent_to_server): Simplify.
        * subr.c (update_dir_name): New function.
        * subr.h (update_dir_name): Prototype for same.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/ChangeLog?cvsroot=cvs&r1=1.3585&r2=1.3586
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/client.c?cvsroot=cvs&r1=1.471&r2=1.472
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/subr.c?cvsroot=cvs&r1=1.171&r2=1.172
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/subr.h?cvsroot=cvs&r1=1.22&r2=1.23

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/ChangeLog,v
retrieving revision 1.3585
retrieving revision 1.3586
diff -u -b -r1.3585 -r1.3586
--- ChangeLog   16 Sep 2008 16:45:47 -0000      1.3585
+++ ChangeLog   16 Sep 2008 19:24:39 -0000      1.3586
@@ -1,5 +1,9 @@
 2008-09-16  Derek R. Price  <address@hidden>
 
+       * client.c (arg_should_not_be_sent_to_server): Simplify.
+       * subr.c (update_dir_name): New function.
+       * subr.h (update_dir_name): Prototype for same.
+
        * base.c (base_diff): Exit with error code 2 on real errors, like diff,
        since error code 1 means differences were found.
 

Index: client.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/client.c,v
retrieving revision 1.471
retrieving revision 1.472
diff -u -b -r1.471 -r1.472
--- client.c    16 Sep 2008 16:42:26 -0000      1.471
+++ client.c    16 Sep 2008 19:24:40 -0000      1.472
@@ -146,19 +146,19 @@
 arg_should_not_be_sent_to_server (char *arg)
 {
     /* Decide if we should send this directory name to the server.  We
-       should always send argv[i] if:
-
-       1) the list of directories sent to the server is empty (as it
-       will be for checkout, etc.).
-
-       2) the argument is "."
-
-       3) the argument is a file in the cwd and the cwd is checked out
-       from the current root
-
-       4) the argument lies within one of the paths in
-       dirs_sent_to_server.
-
+     * should always send argv[i] if:
+     *
+     * 1) the list of directories sent to the server is empty (as it
+     *    will be for checkout, etc.).
+     *
+     * 2) the argument is "."
+     *
+     * 3) the argument is, or is a parent of, one of the paths in
+     *    DIRS_SENT_TO_SERVER.
+     *
+     * 4) the argument is a file in the CWD and the CWD is checked out
+     *    from the current root
+     *
        */
 
     if (list_isempty (dirs_sent_to_server))
@@ -168,8 +168,9 @@
        return false;           /* always send it */
 
     /* We should send arg if it is one of the directories sent to the
-       server or the parent of one; this tells the server to descend
-       the hierarchy starting at this level. */
+     * server or the parent of one; this tells the server to descend
+     * the hierarchy starting at this level.
+     */
     if (isdir (arg))
     {
        if (walklist (dirs_sent_to_server, is_arg_a_parent_or_listed_dir, arg))
@@ -181,64 +182,42 @@
        return true;
     }
 
-    /* Try to decide whether we should send arg to the server by
-       checking the contents of the corresponding CVSADM directory. */
+    /* Now we either have a file or ARG does not exist locally.  Try to decide
+     * whether we should send arg to the server by checking the contents of
+     * ARGS's parent directory's CVSADM dir, if it exists.
+     */
     {
-       char *t, *root_string;
-       cvsroot_t *this_root = NULL;
+       const char *root_string;
+       char *dir = dir_name (arg);
 
-       /* Calculate "dirname arg" */
-       for (t = arg + strlen (arg) - 1; t >= arg; t--)
-       {
-           if (ISSLASH (*t))
-               break;
-       }
-
-       /* Now we're either poiting to the beginning of the
-          string, or we found a path separator. */
-       if (t >= arg)
-       {
-           /* Found a path separator.  */
-           char c = *t;
-           *t = '\0';
-           
-           /* First, check to see if we sent this directory to the
-               server, because it takes less time than actually
-               opening the stuff in the CVSADM directory.  */
-           if (walklist (dirs_sent_to_server, is_arg_a_parent_or_listed_dir,
-                         arg))
+       /* First, check to see if we already sent this directory to the server,
+        * because it takes less time than actually opening the stuff in the
+        * CVSADM directory.
+        */
+       if (findnode_fn (dirs_sent_to_server, dir))
            {
-               *t = c;         /* make sure to un-truncate the arg */
+           free (dir);
                return false;
            }
 
-           /* Since we didn't find it in the list, check the CVSADM
-               files on disk.  */
-           this_root = Name_Root (arg, NULL);
-           root_string = this_root->original;
-           *t = c;
-       }
-       else
-       {
-           /* We're at the beginning of the string.  Look at the
-               CVSADM files in cwd.  */
            if (CVSroot_cmdline)
                root_string = CVSroot_cmdline;
            else
            {
-               this_root = Name_Root (NULL, NULL);
+           const cvsroot_t *this_root;
+           char *update_dir = update_dir_name (arg);
+
+           this_root = Name_Root (dir, update_dir);
                root_string = this_root->original;
-           }
+           free (update_dir);
        }
 
        /* Now check the value for root. */
        if (root_string && current_parsed_root
            && !STREQ (root_string, original_parsed_root->original))
-       {
            /* Don't send this, since the CVSROOTs don't match. */
            return true;
        }
-    }
     
     /* OK, let's send it. */
     return false;

Index: subr.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/subr.c,v
retrieving revision 1.171
retrieving revision 1.172
diff -u -b -r1.171 -r1.172
--- subr.c      15 Sep 2008 21:48:57 -0000      1.171
+++ subr.c      16 Sep 2008 19:24:40 -0000      1.172
@@ -2481,3 +2481,16 @@
     free (adm);
     return has;
 }
+
+
+
+/* dir_name() wrapper that knows that "" is the correct value to return for
+ * "DIR", as opposed to ".".
+ */
+char *
+update_dir_name (const char *path)
+{
+    if (hasSlash (path))
+        return dir_name (path);
+    return xstrdup ("");
+}

Index: subr.h
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/subr.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -b -r1.22 -r1.23
--- subr.h      12 Sep 2008 19:55:31 -0000      1.22
+++ subr.h      16 Sep 2008 19:24:40 -0000      1.23
@@ -145,6 +145,7 @@
 char *dir_append_dirs (const char *dir, ...);
 bool hasSlash (const char *path);
 bool hasAdmin (const char *dir);
+char *update_dir_name (const char *path);
 
 
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]