bug-cvs
[Top][All Lists]
Advanced

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

[Fwd: Re: co -d, modules -d, & Emptydir]


From: Derek Robert Price
Subject: [Fwd: Re: co -d, modules -d, & Emptydir]
Date: Sun, 15 Feb 2004 14:06:23 -0500
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624 Netscape/7.1

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Whoops.  Used the wrong address for the bug-cvs list.

- -------- Original Message --------
Message-ID:     <address@hidden>
Date:     Sun, 15 Feb 2004 12:54:39 -0500
From:     Derek Robert Price <address@hidden>
Organization:     Ximbiot <http://ximbiot.com>
User-Agent:     Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4)
Gecko/20030624 Netscape/7.1
X-Accept-Language:     en-us, en
MIME-Version:     1.0
To:     Larry Jones <address@hidden>, "Mark D. Baushke"
<address@hidden>, address@hidden
Subject:     Re: co -d, modules -d, & Emptydir
References:     <address@hidden>
<address@hidden>
In-Reply-To:     <address@hidden>
X-Enigmail-Version:     0.76.8.0
X-Enigmail-Supports:     pgp-inline, pgp-mime
Content-Type:     text/plain; charset=ISO-8859-1
Content-Transfer-Encoding:     7bit



Hey all,

Larry and I were having this discussion last week about making CVS
behave the same way in respect to an argument to `checkout -d' as it
does to an argument to a `-d' option specified in the modules file.
Larry was arguing the previous thinking, that `cvs co -d a/b/c' should
no more create directories than `touch a/b/c' does, whereas I am arguing
that some people also like `mkdir -p', a typo in `cvs co -d a/b/c' will
be very easy to undo using a single `rm -rf a', or whatever, and a
module `-d' already does it, so what's the darn difference?.

In side benefits, this patch consolidates and simplifies some code since
co -d can be treated the same way as a module's -d.  It also ends up
making client/server CVS behave more like local CVS more often and in
the end should make it easier for me to add a later patch so that `co
- -d' with an absolute path will work in client/server mode (`cvs co -d
/a/b/c').

I've attached a patch under my sig in case anyone wants a look.  The
patch is against stable, but I'll probably commit the final version into
feature since this looks more like a behavior change/new feature than a
bug fix.

Original dialogue w/Larry attached as well.

Comments?

Derek Robert Price wrote:

> Larry Jones wrote:
>
> Derek Robert Price writes:
>
> >>I still don't see or understand any necessary or desirable difference
> >>between `-d' in the modules file and `co -d' on the command line.
> >
> >Despite their common appearance, they really are quite different.  In
> >the command line case, you can only checkout one thing and -d says where
> >to put it.  In the modules file case, a module can have multiple pieces
> >and -d lets you specify how to arrange those pieces (underneath the
> >top-level module directory).  You *can* use -d in the modules file to
> >confuse the user by putting the module someplace other than where it
> >would naturally go, but that isn't how it's intended to be used.
>
> But if we are going to say that `-d' in the modules file to only to be
> useful for organizational purposes, shouldn't it refuse to create any
> directory but the ultimate one too?  Then if a user wanted to create
> several levels of directories, nested modules might be required, where
> the first one create the first directory via -d, the next creates the
> second directory, etc.  This would make it harder to abuse in such a way
> as to simply confuse the user, the functionality the "emptydir" tests
> appears to test.  :)
>
> >>Anyhow, I still think it should be creating the dirs like modules or
> >>modules shouldn't be.  I think I prefer the created case.  I could still
> >>live with existing directories through the penultimate not being given
> >>administration files, in fact this would make life easier if I end up
> >>writing code to allow absolute paths to be passed on the command line,
> >
> >Indeed, that's the reductio ad absurdum that proves the point; you
> >wouldn't want to get admin files in / just because you used an absolute
> >path on the command line.
>
> Yes.  I was actually thinking that if I fixed the absolute path stuff, I
> would make it an exception case that didn't touch any existing
> directories, but it would be nice if we came up with a workable solution
> that was useful (and the code reusable) in both cases.
>
> >>but I think the behavior should be consistent between the modules file
> >>and the command line.
> >
> >As far as creating directories, it's a trade-off between consistency and
> >robustness.  Do you really want CVS creating a bunch of unwanted
> >directories when you make a typo instead of just telling you that you
> >made a typo?  As I recall, the vast majority of the code *doesn't*
> >distinguish between the two cases and behaves identically reguardless.
> >Which is what lead me to make the unwarranted assertion (or at least
> >implication) that none of the behavior differs.
>
> Hrm.  Yeah.  I can see both sides of this one, but I still think I'd
> most like to err on the side of consistency AND robustness.  Perhaps the
> best solution would be to allow CVS to always create the directories.
> That would fix the old "-d with multiple levels of subdirectory doesn't
> work in client/server mode" problem in such a way as to fix it for and
> be backwards compatible with old clients.  Then new clients could be
> modified to send something like "UpdateDir" to the server and only send
> the portions of `-d' which don't exist on the local system.  This would
> pave the way nicely for the absolute path fix.
>
> `rm -rf' seems a fairly quick and effective way of undoing a typo passed
> as an argument to `co -d'.
>
> I've updated the "co-d" tests to reflect the behavior I am suggesting in
> local mode.  The client/server mode will need to create administration
> files in all named directories until the client fix goes in and for old
> clients.
>
> Derek


Derek
- --
                *8^)

Email: address@hidden

Get CVS support at <http://ximbiot.com>!


Index: ChangeLog
===================================================================
RCS file: /cvs/ccvs/ChangeLog,v
retrieving revision 1.692.2.126
diff -u -p -r1.692.2.126 ChangeLog
- --- ChangeLog    12 Feb 2004 23:53:37 -0000    1.692.2.126
+++ ChangeLog    15 Feb 2004 17:37:30 -0000
@@ -1,3 +1,7 @@
+2004-02-15  Derek Price  <address@hidden>
+
+    * NEWS: Note `checkout -d' behavior change.
+
 2004-02-12  Derek Price  <address@hidden>
 
     * NEWS: Note Mark D. Baushke's recent memory leak plugs.
Index: NEWS
===================================================================
RCS file: /cvs/ccvs/NEWS,v
retrieving revision 1.116.2.66
diff -u -p -r1.116.2.66 NEWS
- --- NEWS    13 Feb 2004 16:39:08 -0000    1.116.2.66
+++ NEWS    15 Feb 2004 17:37:31 -0000
@@ -1,6 +1,11 @@
 Changes since 1.11.13:
 **********************
 
+* Directories specified to `checkout -d' are no longer required to
exist.  This
+  consolidates some behavior between `-d' options specified in the
modules file
+  and `checkout -d' as well as removing some prior differences between
local
+  and client/server mode operation.
+
 Changes from 1.11.12 to 1.11.13:
 ********************************
 
Index: src/ChangeLog
===================================================================
RCS file: /cvs/ccvs/src/ChangeLog,v
retrieving revision 1.2336.2.191
diff -u -p -r1.2336.2.191 ChangeLog
- --- src/ChangeLog    13 Feb 2004 22:02:12 -0000    1.2336.2.191
+++ src/ChangeLog    15 Feb 2004 17:37:38 -0000
@@ -1,3 +1,17 @@
+2004-02-15  Derek Price  <address@hidden>
+
+    No longer require directories specified to `checkout -d' to exist.
+
+    * checkout.c (safe_location): Only confirm that destination is a safe
+    location for directories that already exist since we can assume that
+    creating directories under such a safe directory is acceptable.
+    (dir_to_build): Remove just_chdir member.
+    (checkout_proc): Add trace.  No longer set dir_to_build->just_chdir.
+    Minor reformatting.
+    (build_dirs_and_chdir): Don't create or register directories that are
+    not created.
+    * sanity.sh (*): Update tests to account for new behavior.
+
 2004-02-13  Larry Jones  <address@hidden>
 
     * rcs.c (locate_rcs): Remove unused variables.
Index: src/checkout.c
===================================================================
RCS file: /cvs/ccvs/src/checkout.c,v
retrieving revision 1.107.4.7
diff -u -p -r1.107.4.7 checkout.c
- --- src/checkout.c    11 Feb 2004 15:18:05 -0000    1.107.4.7
+++ src/checkout.c    15 Feb 2004 17:37:39 -0000
@@ -418,7 +418,6 @@ safe_location (where)
     char *where;
 {
     char *current;
- -    char *where_location;
     char *hardpath;
     size_t hardpath_len;
     int retval;
@@ -443,59 +442,55 @@ safe_location (where)
     /* if where is set, set current to where, where - last_component(
where ),
      * or fail, depending on whether the directories exist or not.
      */
- -    if( where != NULL )
+    if (where != NULL)
     {
- -    if( chdir( where ) != -1 )
+    char *where_this_pass = xstrdup (where);
+    while (1)
     {
- -        /* where */
- -        where_location = xgetwd();
- -        if( where_location == NULL )
- -        error( 1, errno, "could not get working directory" );
- -
- -        if( chdir( current ) == -1 )
- -        error( 1, errno, "could not change directory to `%s'", current );
- -
- -        free( current );
- -        current = where_location;
- -        }
- -    else if( errno == ENOENT )
- -    {
- -        if ( last_component( where ) != where )
+        if (chdir (where_this_pass) != -1)
         {
- -        /* where - last_component( where ) */
+        /* where */
+        free (where_this_pass);
+        where_this_pass = xgetwd();
+        if (where_this_pass == NULL)
+            error (1, errno, "could not get working directory");
+
+        if (chdir (current) == -1)
+            error (1, errno,
+               "could not restore directory to `%s'", current);
+
+        free (current);
+        current = where_this_pass;
+        break;
+        }
+        else if (errno == ENOENT)
+        {
+        /* where_this_pass - last_component (where_this_pass) */
         char *parent;
 
- -        /* strip the last_component */
- -        where_location = xstrdup( where );
- -        parent = last_component( where_location );
- -        parent[-1] = '\0';
- -
- -        if( chdir( where_location ) != -1 )
+        if ((parent = last_component (where_this_pass))
+                != where_this_pass)
         {
- -            free( where_location );
- -            where_location = xgetwd();
- -            if( where_location == NULL )
- -            error( 1, errno, "could not get working directory
(nominally `%s')", where_location );
- -
- -            if( chdir( current ) == -1 )
- -            error( 1, errno, "could not change directory to `%s'",
current );
- -
- -            free( current );
- -            current = where_location;
+            /* strip the last_component */
+            parent[-1] = '\0';
+            /* continue */
         }
         else
- -            /* fail */
- -            error( 1, errno, "could not change directory to requested
checkout directory `%s'", where_location );
+            /* ERRNO == ENOENT
+             *   && last_component (where_this_pass) == where_this_pass
+             * means we've tried all the parent diretories and not one
+             * exists, so there is no need to test any portion of where
+             * - it is all being created.
+             */
+            break;
         }
- -        /* else: ERRNO == ENOENT & last_component(where) == where
- -         * for example, 'cvs co -d newdir module', where newdir hasn't
- -         * been created yet, so leave current set to '.' and check that
- -         */
- -    }
- -    else
- -        /* fail */
- -        error( 1, errno, "could not change directory to requested
checkout directory `%s'", where );
- -    }
+        else
+        /* fail */
+        error (1, errno, "\
+could not change directory to requested checkout directory `%s'",
+               where_this_pass);
+    } /* while (1) */
+    } /* where != NULL */
 
     hardpath_len = strlen (hardpath);
     if (strlen (current) >= hardpath_len
@@ -526,10 +521,6 @@ struct dir_to_build
     /* The path to the directory.  */
     char *dirpath;
 
- -    /* If set, don't build the directory, just change to it.
- -       The caller will also want to set REPOSITORY to NULL.  */
- -    int just_chdir;
- -
     struct dir_to_build *next;
 };
 
@@ -608,6 +599,18 @@ checkout_proc (argc, argv, where_orig, m
     char *oldupdate = NULL;
     char *where;
 
+    if (trace)
+    (void) fprintf (stderr,
+                    "%s-> checkout_proc (%s, %s, %s, %d, %d, %s, %s)\n",
+            CLIENT_SERVER_STR,
+            where_orig ? where_orig : "(null)",
+            mwhere ? mwhere : "(null)",
+            mfile ? mfile : "(null)",
+                    shorten, local_specified,
+            omodule ? omodule : "(null)",
+            msg ? msg : "(null)"
+                   );
+
     /*
      * OK, so we're doing the checkout! Our args are as follows:
      *  argc,argv contain either dir or dir followed by a list of files
@@ -625,7 +628,8 @@ checkout_proc (argc, argv, where_orig, m
               + strlen (argv[0])
               + (mfile == NULL ? 0 : strlen (mfile))
               + 10);
- -    (void) sprintf (repository, "%s/%s",
current_parsed_root->directory, argv[0]);
+    (void) sprintf (repository, "%s/%s",
+                    current_parsed_root->directory, argv[0]);
     Sanitize_Repository_Name (repository);
 
 
@@ -815,8 +819,6 @@ internal error: %s doesn't start with %s
     head->repository = NULL;
     head->dirpath = xstrdup (where);
     head->next = NULL;
- -    head->just_chdir = 0;
- -
 
     /* Make a copy of the repository name to play with. */
     reposcopy = xstrdup (repository);
@@ -856,23 +858,6 @@ internal error: %s doesn't start with %s
         new->next = head;
         head = new;
 
- -        /* If where consists of multiple pathname components,
- -           then we want to just cd into it, without creating
- -           directories or modifying CVS directories as we go.
- -           In CVS 1.9 and earlier, the code actually does a
- -           CVS_CHDIR up-front; I'm not going to try to go back
- -           to that exact code but this is somewhat similar
- -           in spirit.  */
- -        if (where_orig != NULL
- -        && cp - where < strlen (where_orig))
- -        {
- -        new->repository = NULL;
- -        new->just_chdir = 1;
- -        continue;
- -        }
- -
- -        new->just_chdir = 0;
- -
         /* Now figure out what repository directory to generate.
                The most complete case would be something like this:
 
@@ -1214,12 +1199,10 @@ build_dirs_and_chdir (dirs, sticky)
     while (dirs != NULL)
     {
     char *dir = last_component (dirs->dirpath);
+    int made_dir = 0;
 
- -    if (!dirs->just_chdir)
- -    {
- -        mkdir_if_needed (dir);
- -        Subdir_Register (NULL, NULL, dir);
- -    }
+    made_dir = !mkdir_if_needed (dir);
+    if (made_dir) Subdir_Register (NULL, NULL, dir);
 
     if (CVS_CHDIR (dir) < 0)
     {
@@ -1227,7 +1210,7 @@ build_dirs_and_chdir (dirs, sticky)
         retval = 1;
         goto out;
     }
- -    if (dirs->repository != NULL)
+    if (made_dir && dirs->repository != NULL)
     {
         build_one_dir (dirs->repository, dirs->dirpath, sticky);
         free (dirs->repository);
Index: src/sanity.sh
===================================================================
RCS file: /cvs/ccvs/src/sanity.sh,v
retrieving revision 1.752.2.82
diff -u -p -r1.752.2.82 sanity.sh
- --- src/sanity.sh    9 Feb 2004 22:58:43 -0000    1.752.2.82
+++ src/sanity.sh    15 Feb 2004 17:38:01 -0000
@@ -11732,15 +11732,18 @@ done"
 U dir/file2"
       dotest co-d-1.2 "cat dir/CVS/Repository" "$module"
 
- -      # FIXCVS: This should work.  Correct expected result:
- -      #
- -      #"U dir2/sdir/file1
- -      #U dir2/sdir/file2"
- -      dotest_fail co-d-2 "$testcvs -q co -d dir2/sdir $module" \
- -"$PROG \[checkout aborted\]: could not change directory to requested
checkout directory \`dir2': No such file or directory"
- -      # FIXCVS:
- -      # dotest co-d-2.2 "cat dir4/CVS/Repository" "CVSROOT/Emptydir"
- -      # dotest co-d-2.3 "cat dir5/CVS/Repository" "$module"
+      dotest co-d-2 "$testcvs -q co -d dir2/sdir $module" \
+"U dir2/sdir/file1
+U dir2/sdir/file2"
+      dotest co-d-2.2 "cat dir2/CVS/Repository" "."
+      dotest co-d-2.3 "cat dir2/sdir/CVS/Repository" "$module"
+
+      dotest co-d-2.4 "$testcvs -q co -d dir2.4/sdir/sdir2 $module" \
+"U dir2.4/sdir/sdir2/file1
+U dir2.4/sdir/sdir2/file2"
+      dotest co-d-2.4.2 "cat dir2.4/CVS/Repository" "CVSROOT/Emptydir"
+      dotest co-d-2.4.3 "cat dir2.4/sdir/CVS/Repository" "."
+      dotest co-d-2.4.3 "cat dir2.4/sdir/sdir2/CVS/Repository" "$module"
 
       mkdir dir3
       dotest co-d-3 "$testcvs -q co -d dir3 $module" \
@@ -11748,40 +11751,41 @@ U dir/file2"
 U dir3/file2"
       dotest co-d-3.2 "cat dir3/CVS/Repository" "$module"
 
- -      if $remote; then
- -        # FIXCVS: As for co-d-2.
- -        mkdir dir4
- -        dotest_fail co-d-4r "$testcvs -q co -d dir4/sdir $module" \
- -"$PROG \[checkout aborted\]: could not change directory to requested
checkout directory \`dir4': No such file or directory"
- -
- -        # FIXCVS: As for co-d-2.
- -        mkdir dir5
- -        mkdir dir5/sdir
- -        dotest_fail co-d-5r "$testcvs -q co -d dir5/sdir $module" \
- -"$PROG \[checkout aborted\]: could not change directory to requested
checkout directory \`dir5': No such file or directory"
- -      else
- -        mkdir dir4
- -        dotest co-d-4 "$testcvs -q co -d dir4/sdir $module" \
+      mkdir dir4
+      dotest co-d-4 "$testcvs -q co -d dir4/sdir $module" \
 "U dir4/sdir/file1
 U dir4/sdir/file2"
- -        # CVS only creates administration directories for directories it
- -        # creates, and the last portion of the path passed to -d
- -        # regardless.
+
+      # CVS is only supposed to create administration directories in
+      # directories it also creates, and in the directory specified by
+      # the last portion of the path passed to -d regardless.  This is
+      #
+      # FIXCVS:
+      # This is broken in client/server mode because the server does not
+      # know the client's directory structure and has to create
+      # everything.
+      if $remote; then
+        dotest co-d-4.2r "cat dir4/CVS/Repository" "."
+      else
         dotest_fail co-d-4.2 "test -d dir4/CVS"
- -        dotest co-d-4.3 "cat dir4/sdir/CVS/Repository" "$module"
+      fi
 
- -        mkdir dir5
- -        mkdir dir5/sdir
- -        dotest co-d-5 "$testcvs -q co -d dir5/sdir $module" \
+      dotest co-d-4.3 "cat dir4/sdir/CVS/Repository" "$module"
+
+      mkdir dir5
+      mkdir dir5/sdir
+      dotest co-d-5 "$testcvs -q co -d dir5/sdir $module" \
 "U dir5/sdir/file1
 U dir5/sdir/file2"
- -        # CVS only creates administration directories for directories it
- -        # creates, and the last portion of the path passed to -d
- -        # regardless.
+        # FIXCVS as for co-d-4.2r.
+      if $remote; then
+        dotest co-d-5.2 "cat dir5/CVS/Repository" "."
+      else
         dotest_fail co-d-5.2 "test -d dir5/CVS"
- -        dotest co-d-5.3 "cat dir5/sdir/CVS/Repository" "$module"
       fi
 
+      dotest co-d-5.3 "cat dir5/sdir/CVS/Repository" "$module"
+
       # clean up
       if $keep; then
         echo Keeping ${TESTDIR} and exiting due to --keep
@@ -12702,225 +12706,219 @@ U dir/dir2d2-2/sub2d2-2/file2-2"
       ## on the command line, but use a longer path.
       ##################################################
 
- -      dotest_fail cvsadm-2d3-1 "${testcvs} co -d dir/dir2 1mod" \
- -"${PROG} \[checkout aborted\]: could not change directory to requested
checkout directory .dir.: No such file or directory"
- -
- -      if $remote; then :; else
- -        # Remote can't handle this, even with the "mkdir dir".
- -        # This was also true of CVS 1.9.
- -
- -        mkdir dir
- -        dotest cvsadm-2d3 "${testcvs} co -d dir/dir2 1mod" \
- -"${PROG} checkout: Updating dir/dir2
+      dotest cvsadm-2d3-1 "${testcvs} co -d dir/dir2 1mod" \
+"$PROG checkout: Updating dir/dir2
 U dir/dir2/file1"
- -        dotest cvsadm-2d3b "cat CVS/Repository" "\."
- -        dotest_fail cvsadm-2d3d "test -f dir/CVS/Repository" ""
- -        dotest cvsadm-2d3f "cat dir/dir2/CVS/Repository" "mod1"
- -        rm -rf CVS dir
 
- -        mkdir dir
- -        dotest cvsadm-2d4 "${testcvs} co -d dir/dir2 2mod" \
+      # Remote couldn't handle this, even with the "mkdir dir", before
+      # CVS 1.11.14.
+      dotest cvsadm-2d3b "cat CVS/Repository" "\."
+      dotest cvsadm-2d3d "cat dir/CVS/Repository" "."
+      dotest cvsadm-2d3f "cat dir/dir2/CVS/Repository" "mod1"
+      rm -rf CVS dir
+
+      mkdir dir
+      dotest cvsadm-2d4 "${testcvs} co -d dir/dir2 2mod" \
 "${PROG} checkout: Updating dir/dir2
 U dir/dir2/file2"
- -        dotest cvsadm-2d4b "cat CVS/Repository" "\."
- -        dotest cvsadm-2d4f "cat dir/dir2/CVS/Repository" "mod2/sub2"
- -        rm -rf CVS dir
+      dotest cvsadm-2d4b "cat CVS/Repository" "\."
+      dotest cvsadm-2d4f "cat dir/dir2/CVS/Repository" "mod2/sub2"
+      rm -rf CVS dir
 
- -        mkdir dir
- -        dotest cvsadm-2d5 "${testcvs} co -d dir/dir2 1d1mod" \
+      mkdir dir
+      dotest cvsadm-2d5 "${testcvs} co -d dir/dir2 1d1mod" \
 "${PROG} checkout: Updating dir/dir2
 U dir/dir2/file1"
- -        dotest cvsadm-2d5b "cat CVS/Repository" "\."
- -        dotest cvsadm-2d5f "cat dir/dir2/CVS/Repository" "mod1"
- -        rm -rf CVS dir
+      dotest cvsadm-2d5b "cat CVS/Repository" "\."
+      dotest cvsadm-2d5f "cat dir/dir2/CVS/Repository" "mod1"
+      rm -rf CVS dir
 
- -        mkdir dir
- -        dotest cvsadm-2d6 "${testcvs} co -d dir/dir2 1d2mod" \
+      mkdir dir
+      dotest cvsadm-2d6 "${testcvs} co -d dir/dir2 1d2mod" \
 "${PROG} checkout: Updating dir/dir2
 U dir/dir2/file2"
- -        dotest cvsadm-2d6b "cat CVS/Repository" "\."
- -        dotest cvsadm-2d6f "cat dir/dir2/CVS/Repository" "mod2/sub2"
- -        rm -rf CVS dir
+      dotest cvsadm-2d6b "cat CVS/Repository" "\."
+      dotest cvsadm-2d6f "cat dir/dir2/CVS/Repository" "mod2/sub2"
+      rm -rf CVS dir
 
- -        mkdir dir
- -        dotest cvsadm-2d7 "${testcvs} co -d dir/dir2 2d1mod" \
+      mkdir dir
+      dotest cvsadm-2d7 "${testcvs} co -d dir/dir2 2d1mod" \
 "${PROG} checkout: Updating dir/dir2
 U dir/dir2/file1"
- -        dotest cvsadm-2d7b "cat CVS/Repository" "\."
- -        dotest cvsadm-2d7f "cat dir/dir2/CVS/Repository" "mod1"
- -        rm -rf CVS dir
+      dotest cvsadm-2d7b "cat CVS/Repository" "\."
+      dotest cvsadm-2d7f "cat dir/dir2/CVS/Repository" "mod1"
+      rm -rf CVS dir
 
- -        mkdir dir
- -        dotest cvsadm-2d8 "${testcvs} co -d dir/dir2 2d2mod" \
+      mkdir dir
+      dotest cvsadm-2d8 "${testcvs} co -d dir/dir2 2d2mod" \
 "${PROG} checkout: Updating dir/dir2
 U dir/dir2/file2"
- -        dotest cvsadm-2d8b "cat CVS/Repository" "\."
- -        dotest cvsadm-2d8f "cat dir/dir2/CVS/Repository" "mod2/sub2"
- -        rm -rf CVS dir
- -
- -        ##################################################
- -        ## And now, a few of those tests revisited to
- -        ## test the behavior of the -N flag.
- -        ##################################################
+      dotest cvsadm-2d8b "cat CVS/Repository" "\."
+      dotest cvsadm-2d8f "cat dir/dir2/CVS/Repository" "mod2/sub2"
+      rm -rf CVS dir
+
+      ##################################################
+      ## And now, a few of those tests revisited to
+      ## test the behavior of the -N flag.
+      ##################################################
 
- -        dotest cvsadm-N3 "${testcvs} co -N 1mod" \
+      dotest cvsadm-N3 "${testcvs} co -N 1mod" \
 "${PROG} checkout: Updating 1mod
 U 1mod/file1"
- -        dotest cvsadm-N3b "cat CVS/Repository" "\."
- -        dotest cvsadm-N3d "cat 1mod/CVS/Repository" "mod1"
- -        rm -rf CVS 1mod
+      dotest cvsadm-N3b "cat CVS/Repository" "\."
+      dotest cvsadm-N3d "cat 1mod/CVS/Repository" "mod1"
+      rm -rf CVS 1mod
 
- -        dotest cvsadm-N4 "${testcvs} co -N 2mod" \
+      dotest cvsadm-N4 "${testcvs} co -N 2mod" \
 "${PROG} checkout: Updating 2mod
 U 2mod/file2"
- -        dotest cvsadm-N4b "cat CVS/Repository" "\."
- -        dotest cvsadm-N4d "cat 2mod/CVS/Repository" "mod2/sub2"
- -        rm -rf CVS 2mod
+      dotest cvsadm-N4b "cat CVS/Repository" "\."
+      dotest cvsadm-N4d "cat 2mod/CVS/Repository" "mod2/sub2"
+      rm -rf CVS 2mod
 
- -        dotest cvsadm-N5 "${testcvs} co -N 1d1mod" \
+      dotest cvsadm-N5 "${testcvs} co -N 1d1mod" \
 "${PROG} checkout: Updating dir1d1
 U dir1d1/file1"
- -        dotest cvsadm-N5b "cat CVS/Repository" "\."
- -        dotest cvsadm-N5d "cat dir1d1/CVS/Repository" "mod1"
- -        rm -rf CVS dir1d1
+      dotest cvsadm-N5b "cat CVS/Repository" "\."
+      dotest cvsadm-N5d "cat dir1d1/CVS/Repository" "mod1"
+      rm -rf CVS dir1d1
 
- -        dotest cvsadm-N6 "${testcvs} co -N 1d2mod" \
+      dotest cvsadm-N6 "${testcvs} co -N 1d2mod" \
 "${PROG} checkout: Updating dir1d2
 U dir1d2/file2"
- -        dotest cvsadm-N6b "cat CVS/Repository" "\."
- -        dotest cvsadm-N6d "cat dir1d2/CVS/Repository" "mod2/sub2"
- -        rm -rf CVS dir1d2
+      dotest cvsadm-N6b "cat CVS/Repository" "\."
+      dotest cvsadm-N6d "cat dir1d2/CVS/Repository" "mod2/sub2"
+      rm -rf CVS dir1d2
 
- -        dotest cvsadm-N7 "${testcvs} co -N 2d1mod" \
+      dotest cvsadm-N7 "${testcvs} co -N 2d1mod" \
 "${PROG} checkout: Updating dir2d1/sub2d1
 U dir2d1/sub2d1/file1"
- -        dotest cvsadm-N7b "cat CVS/Repository" "\."
- -        dotest cvsadm-N7d "cat dir2d1/CVS/Repository" "\."
- -        dotest cvsadm-N7f "cat dir2d1/sub2d1/CVS/Repository" "mod1"
- -        rm -rf CVS dir2d1
+      dotest cvsadm-N7b "cat CVS/Repository" "\."
+      dotest cvsadm-N7d "cat dir2d1/CVS/Repository" "\."
+      dotest cvsadm-N7f "cat dir2d1/sub2d1/CVS/Repository" "mod1"
+      rm -rf CVS dir2d1
 
- -        dotest cvsadm-N8 "${testcvs} co -N 2d2mod" \
+      dotest cvsadm-N8 "${testcvs} co -N 2d2mod" \
 "${PROG} checkout: Updating dir2d2/sub2d2
 U dir2d2/sub2d2/file2"
- -        dotest cvsadm-N8b "cat CVS/Repository" "\."
- -        dotest cvsadm-N8d "cat dir2d2/CVS/Repository" "mod2"
- -        dotest cvsadm-N8f "cat dir2d2/sub2d2/CVS/Repository" "mod2/sub2"
- -        rm -rf CVS dir2d2
+      dotest cvsadm-N8b "cat CVS/Repository" "\."
+      dotest cvsadm-N8d "cat dir2d2/CVS/Repository" "mod2"
+      dotest cvsadm-N8f "cat dir2d2/sub2d2/CVS/Repository" "mod2/sub2"
+      rm -rf CVS dir2d2
 
- -        ## the ones in one-deep directories
+      ## the ones in one-deep directories
 
- -        dotest cvsadm-N1d3 "${testcvs} co -N -d dir 1mod" \
+      dotest cvsadm-N1d3 "${testcvs} co -N -d dir 1mod" \
 "${PROG} checkout: Updating dir/1mod
 U dir/1mod/file1"
- -        dotest cvsadm-N1d3b "cat CVS/Repository" "\."
- -        dotest cvsadm-N1d3d "cat dir/CVS/Repository" "\."
- -        dotest cvsadm-N1d3f "cat dir/1mod/CVS/Repository" "mod1"
- -        rm -rf CVS dir
+      dotest cvsadm-N1d3b "cat CVS/Repository" "\."
+      dotest cvsadm-N1d3d "cat dir/CVS/Repository" "\."
+      dotest cvsadm-N1d3f "cat dir/1mod/CVS/Repository" "mod1"
+      rm -rf CVS dir
 
- -        dotest cvsadm-N1d4 "${testcvs} co -N -d dir 2mod" \
+      dotest cvsadm-N1d4 "${testcvs} co -N -d dir 2mod" \
 "${PROG} checkout: Updating dir/2mod
 U dir/2mod/file2"
- -        dotest cvsadm-N1d4b "cat CVS/Repository" "\."
- -        dotest cvsadm-N1d4d "cat dir/CVS/Repository" "mod2"
- -        dotest cvsadm-N1d4f "cat dir/2mod/CVS/Repository" "mod2/sub2"
- -        rm -rf CVS dir
+      dotest cvsadm-N1d4b "cat CVS/Repository" "\."
+      dotest cvsadm-N1d4d "cat dir/CVS/Repository" "mod2"
+      dotest cvsadm-N1d4f "cat dir/2mod/CVS/Repository" "mod2/sub2"
+      rm -rf CVS dir
 
- -        dotest cvsadm-N1d5 "${testcvs} co -N -d dir 1d1mod" \
+      dotest cvsadm-N1d5 "${testcvs} co -N -d dir 1d1mod" \
 "${PROG} checkout: Updating dir/dir1d1
 U dir/dir1d1/file1"
- -        dotest cvsadm-N1d5b "cat CVS/Repository" "\."
- -        dotest cvsadm-N1d5d "cat dir/CVS/Repository" "\."
- -        dotest cvsadm-N1d5d "cat dir/dir1d1/CVS/Repository" "mod1"
- -        rm -rf CVS dir
+      dotest cvsadm-N1d5b "cat CVS/Repository" "\."
+      dotest cvsadm-N1d5d "cat dir/CVS/Repository" "\."
+      dotest cvsadm-N1d5d "cat dir/dir1d1/CVS/Repository" "mod1"
+      rm -rf CVS dir
 
- -        dotest cvsadm-N1d6 "${testcvs} co -N -d dir 1d2mod" \
+      dotest cvsadm-N1d6 "${testcvs} co -N -d dir 1d2mod" \
 "${PROG} checkout: Updating dir/dir1d2
 U dir/dir1d2/file2"
- -        dotest cvsadm-N1d6b "cat CVS/Repository" "\."
- -        dotest cvsadm-N1d6d "cat dir/CVS/Repository" "mod2"
- -        dotest cvsadm-N1d6f "cat dir/dir1d2/CVS/Repository" "mod2/sub2"
- -        rm -rf CVS dir
+      dotest cvsadm-N1d6b "cat CVS/Repository" "\."
+      dotest cvsadm-N1d6d "cat dir/CVS/Repository" "mod2"
+      dotest cvsadm-N1d6f "cat dir/dir1d2/CVS/Repository" "mod2/sub2"
+      rm -rf CVS dir
 
- -        dotest cvsadm-N1d7 "${testcvs} co -N -d dir 2d1mod" \
+      dotest cvsadm-N1d7 "${testcvs} co -N -d dir 2d1mod" \
 "${PROG} checkout: Updating dir/dir2d1/sub2d1
 U dir/dir2d1/sub2d1/file1"
- -        dotest cvsadm-N1d7b "cat CVS/Repository" "\."
- -        dotest cvsadm-N1d7d "cat dir/CVS/Repository" "CVSROOT/Emptydir"
- -        dotest cvsadm-N1d7f "cat dir/dir2d1/CVS/Repository" "\."
- -        dotest cvsadm-N1d7h "cat dir/dir2d1/sub2d1/CVS/Repository" "mod1"
- -        rm -rf CVS dir
+      dotest cvsadm-N1d7b "cat CVS/Repository" "\."
+      dotest cvsadm-N1d7d "cat dir/CVS/Repository" "CVSROOT/Emptydir"
+      dotest cvsadm-N1d7f "cat dir/dir2d1/CVS/Repository" "\."
+      dotest cvsadm-N1d7h "cat dir/dir2d1/sub2d1/CVS/Repository" "mod1"
+      rm -rf CVS dir
 
- -        dotest cvsadm-N1d8 "${testcvs} co -N -d dir 2d2mod" \
+      dotest cvsadm-N1d8 "${testcvs} co -N -d dir 2d2mod" \
 "${PROG} checkout: Updating dir/dir2d2/sub2d2
 U dir/dir2d2/sub2d2/file2"
- -        dotest cvsadm-N1d8b "cat CVS/Repository" "\."
- -        dotest cvsadm-N1d8d "cat dir/CVS/Repository" "\."
- -        dotest cvsadm-N1d8d "cat dir/dir2d2/CVS/Repository" "mod2"
- -        dotest cvsadm-N1d8d "cat dir/dir2d2/sub2d2/CVS/Repository" \
+      dotest cvsadm-N1d8b "cat CVS/Repository" "\."
+      dotest cvsadm-N1d8d "cat dir/CVS/Repository" "\."
+      dotest cvsadm-N1d8d "cat dir/dir2d2/CVS/Repository" "mod2"
+      dotest cvsadm-N1d8d "cat dir/dir2d2/sub2d2/CVS/Repository" \
 "mod2/sub2"
- -        rm -rf CVS dir
+      rm -rf CVS dir
 
- -        ## the ones in two-deep directories
+      ## the ones in two-deep directories
 
- -        mkdir dir
- -        dotest cvsadm-N2d3 "${testcvs} co -N -d dir/dir2 1mod" \
+      mkdir dir
+      dotest cvsadm-N2d3 "${testcvs} co -N -d dir/dir2 1mod" \
 "${PROG} checkout: Updating dir/dir2/1mod
 U dir/dir2/1mod/file1"
- -        dotest cvsadm-N2d3b "cat CVS/Repository" "\."
- -        dotest cvsadm-N2d3f "cat dir/dir2/CVS/Repository" "\."
- -        dotest cvsadm-N2d3h "cat dir/dir2/1mod/CVS/Repository" "mod1"
- -        rm -rf CVS dir
+      dotest cvsadm-N2d3b "cat CVS/Repository" "\."
+      dotest cvsadm-N2d3f "cat dir/dir2/CVS/Repository" "\."
+      dotest cvsadm-N2d3h "cat dir/dir2/1mod/CVS/Repository" "mod1"
+      rm -rf CVS dir
 
- -        mkdir dir
- -        dotest cvsadm-N2d4 "${testcvs} co -N -d dir/dir2 2mod" \
+      mkdir dir
+      dotest cvsadm-N2d4 "${testcvs} co -N -d dir/dir2 2mod" \
 "${PROG} checkout: Updating dir/dir2/2mod
 U dir/dir2/2mod/file2"
- -        dotest cvsadm-N2d4b "cat CVS/Repository" "\."
- -        dotest cvsadm-N2d4f "cat dir/dir2/CVS/Repository" "mod2"
- -        dotest cvsadm-N2d4h "cat dir/dir2/2mod/CVS/Repository"
"mod2/sub2"
- -        rm -rf CVS dir
+      dotest cvsadm-N2d4b "cat CVS/Repository" "\."
+      dotest cvsadm-N2d4f "cat dir/dir2/CVS/Repository" "mod2"
+      dotest cvsadm-N2d4h "cat dir/dir2/2mod/CVS/Repository" "mod2/sub2"
+      rm -rf CVS dir
 
- -        mkdir dir
- -        dotest cvsadm-N2d5 "${testcvs} co -N -d dir/dir2 1d1mod" \
+      mkdir dir
+      dotest cvsadm-N2d5 "${testcvs} co -N -d dir/dir2 1d1mod" \
 "${PROG} checkout: Updating dir/dir2/dir1d1
 U dir/dir2/dir1d1/file1"
- -        dotest cvsadm-N2d5b "cat CVS/Repository" "\."
- -        dotest cvsadm-N2d5f "cat dir/dir2/CVS/Repository" "\."
- -        dotest cvsadm-N2d5h "cat dir/dir2/dir1d1/CVS/Repository" "mod1"
- -        rm -rf CVS dir
+      dotest cvsadm-N2d5b "cat CVS/Repository" "\."
+      dotest cvsadm-N2d5f "cat dir/dir2/CVS/Repository" "\."
+      dotest cvsadm-N2d5h "cat dir/dir2/dir1d1/CVS/Repository" "mod1"
+      rm -rf CVS dir
 
- -        mkdir dir
- -        dotest cvsadm-N2d6 "${testcvs} co -N -d dir/dir2 1d2mod" \
+      mkdir dir
+      dotest cvsadm-N2d6 "${testcvs} co -N -d dir/dir2 1d2mod" \
 "${PROG} checkout: Updating dir/dir2/dir1d2
 U dir/dir2/dir1d2/file2"
- -        dotest cvsadm-N2d6b "cat CVS/Repository" "\."
- -        dotest cvsadm-N2d6f "cat dir/dir2/CVS/Repository" "mod2"
- -        dotest cvsadm-N2d6h "cat dir/dir2/dir1d2/CVS/Repository"
"mod2/sub2"
- -        rm -rf CVS dir
+      dotest cvsadm-N2d6b "cat CVS/Repository" "\."
+      dotest cvsadm-N2d6f "cat dir/dir2/CVS/Repository" "mod2"
+      dotest cvsadm-N2d6h "cat dir/dir2/dir1d2/CVS/Repository" "mod2/sub2"
+      rm -rf CVS dir
 
- -        mkdir dir
- -        dotest cvsadm-N2d7 "${testcvs} co -N -d dir/dir2 2d1mod" \
+      mkdir dir
+      dotest cvsadm-N2d7 "${testcvs} co -N -d dir/dir2 2d1mod" \
 "${PROG} checkout: Updating dir/dir2/dir2d1/sub2d1
 U dir/dir2/dir2d1/sub2d1/file1"
- -        dotest cvsadm-N2d7b "cat CVS/Repository" "\."
- -        dotest cvsadm-N2d7f "cat dir/dir2/CVS/Repository"
"CVSROOT/Emptydir"
- -        dotest cvsadm-N2d7g "cat dir/dir2/dir2d1/CVS/Repository" "\."
- -        dotest cvsadm-N2d7h "cat dir/dir2/dir2d1/sub2d1/CVS/Repository" \
+      dotest cvsadm-N2d7b "cat CVS/Repository" "\."
+      dotest cvsadm-N2d7f "cat dir/dir2/CVS/Repository" "CVSROOT/Emptydir"
+      dotest cvsadm-N2d7g "cat dir/dir2/dir2d1/CVS/Repository" "\."
+      dotest cvsadm-N2d7h "cat dir/dir2/dir2d1/sub2d1/CVS/Repository" \
 "mod1"
- -        rm -rf CVS dir
+      rm -rf CVS dir
 
- -        mkdir dir
- -        dotest cvsadm-N2d8 "${testcvs} co -N -d dir/dir2 2d2mod" \
+      mkdir dir
+      dotest cvsadm-N2d8 "${testcvs} co -N -d dir/dir2 2d2mod" \
 "${PROG} checkout: Updating dir/dir2/dir2d2/sub2d2
 U dir/dir2/dir2d2/sub2d2/file2"
- -        dotest cvsadm-N2d8b "cat CVS/Repository" "\."
- -        dotest cvsadm-N2d8f "cat dir/dir2/CVS/Repository" "\."
- -        dotest cvsadm-N2d8h "cat dir/dir2/dir2d2/CVS/Repository" "mod2"
- -        dotest cvsadm-N2d8j "cat dir/dir2/dir2d2/sub2d2/CVS/Repository" \
+      dotest cvsadm-N2d8b "cat CVS/Repository" "\."
+      dotest cvsadm-N2d8f "cat dir/dir2/CVS/Repository" "\."
+      dotest cvsadm-N2d8h "cat dir/dir2/dir2d2/CVS/Repository" "mod2"
+      dotest cvsadm-N2d8j "cat dir/dir2/dir2d2/sub2d2/CVS/Repository" \
 "mod2/sub2"
- -        rm -rf CVS dir
- -
- -      fi # end of tests to be skipped for remote
+      rm -rf CVS dir
+      # End of test that didn't work for remote prior to CVS 1.11.14.
 
       ##################################################
       ## That's enough of that, thank you very much.
@@ -13060,7 +13058,12 @@ ${PROG} checkout: Updating dir2d1/suba"
       dotest emptydir-16 "${testcvs} co 2d1mod" \
 "${PROG} checkout: Updating dir2d1/sub/sub2d1
 U dir2d1/sub/sub2d1/file1"
- -      dotest emptydir-17 "test -d dir2d1/CVS"
+
+      if $remote; then
+        dotest emptydir-17 "cat dir2d1/CVS/Repository" "CVSROOT/Emptydir"
+      else
+        dotest_fail emptydir-17 "test -d dir2d1/CVS"
+      fi
 
       # clean up
       if $keep; then
@@ -13139,50 +13142,45 @@ U ${TESTDIR}/1/file1"
       dotest abspath-2b "cat ${TESTDIR}/1/CVS/Repository" "mod1"
 
       # Done.  Clean up.
- -      rm -rf ${TESTDIR}/1
+      rm -r ${TESTDIR}/1
 
 
       # Now try in a subdirectory.  We're not covering any more
       # code here, but we might catch a future error if someone
       # changes the checkout code.
 
- -      # Note that for the same reason that the shell command
- -      # "touch 1/2/3" requires directories 1 and 1/2 to already
- -      # exist, we expect ${TESTDIR}/1 to already exist.  I believe
- -      # this is the behavior of CVS 1.9 and earlier.
+      # Since CVS 1.11.14, CVS will create leading directories specified
+      # via co -d.
+      # I am unsure that this wasn't the behavior prior to CVS 1.9, but the
+      # comment that used to be here leads me to believe it was not.
       if $remote; then :; else
- -        dotest_fail abspath-3.1 "${testcvs} co -d ${TESTDIR}/1/2 mod1" \
- -"${PROG} \[checkout aborted\]: could not change directory to requested
checkout directory .${TESTDIR}/1.: No such file or directory"
+        dotest abspath-3.1 "${testcvs} -q co -d ${TESTDIR}/1/2 mod1" \
+"U $TESTDIR/1/2/file1"
+        rm -r $TESTDIR/1
       fi
- -      dotest_fail abspath-3.2 "${testcvs} co -d 1/2 mod1" \
- -"${PROG} \[checkout aborted\]: could not change directory to requested
checkout directory .1.: No such file or directory"
+      dotest abspath-3.2 "${testcvs} -q co -d 1/2 mod1" \
+"U 1/2/file1"
+      rm -r 1
 
+      # We don't to mess with an existing directory just to traverse it,
+      # for example by creating a CVS directory, but currently we can't
+      # avoid this in client/server mode.
       mkdir 1
- -
       if $remote; then
- -        # The server wants the directory to exist, but that is
- -        # a bug, it should only need to exist on the client side.
- -        # See also cvsadm-2d3.
- -        dotest_fail abspath-3a "${testcvs} co -d 1/2 mod1" \
- -"${PROG} \[checkout aborted\]: could not change directory to requested
checkout directory .1.: No such file or directory"
- -        cd 1
- -        dotest abspath-3a-try2 "${testcvs} co -d 2 mod1" \
- -"${PROG} checkout: Updating 2
- -U 2/file1"
- -        cd ..
- -        rm -rf 1/CVS
+        dotest abspath-3ar "${testcvs} co -d 1/2 mod1" \
+"${PROG} checkout: Updating 1/2
+U 1/2/file1"
+        dotest abspath-3br "cat 1/CVS/Repository" .
       else
- -      dotest abspath-3a "${testcvs} co -d ${TESTDIR}/1/2 mod1" \
+        dotest abspath-3a "${testcvs} co -d ${TESTDIR}/1/2 mod1" \
 "${PROG} checkout: Updating ${TESTDIR}/1/2
 U ${TESTDIR}/1/2/file1"
- -      fi # remote workaround
- -      dotest abspath-3b "cat ${TESTDIR}/1/2/CVS/Repository" "mod1"
+        dotest_fail abspath-3b "test -d ${TESTDIR}/1/CVS"
+      fi
+
+      dotest abspath-3c "cat ${TESTDIR}/1/2/CVS/Repository" mod1
 
- -      # For all the same reasons that we want "1" to already
- -      # exist, we don't to mess with it to traverse it, for
- -      # example by creating a CVS directory.
 
- -      dotest_fail abspath-3c "test -d ${TESTDIR}/1/CVS" ''
       # Done.  Clean up.
       rm -rf ${TESTDIR}/1
 
@@ -13272,10 +13270,10 @@ ${PROG} \[checkout aborted\]: than the 0
 "U 3/file2"
         cd 1/mod1
       else
- -      dotest abspath-7d "${testcvs} -q co -d ${TESTDIR}/3 mod2" \
+        dotest abspath-7d "${testcvs} -q co -d ${TESTDIR}/3 mod2" \
 "U ${TESTDIR}/3/file2"
       fi # remote workaround
- -      dotest abspath-7e "${testcvs} -q update -d" ""
+      dotest abspath-7e "${testcvs} -q update -d"
       cd ../..
       rm -r 1 2 3
 
@@ -25652,14 +25650,14 @@ ${PLUS}change him too"
       mkdir dir2
 
       # OK, the problem is that CVS/Entries doesn't look quite right,
- -      # I suppose because of the "rm -r".
- -      # For local this fixes it up.
- -      dotest multiroot3-6 "${testcvs} -d ${CVSROOT1} -q co dir1" ""
- -      if $remote; then
- -        # For remote that doesn't do it.  Use the quick and dirty fix.
- -        echo "D/dir1////" >CVS/Entries
- -        echo "D/dir2////" >>CVS/Entries
- -      fi
+      # I suppose because of the "rm -r".  Then again, why *should* it
+      # look right?  CVS/Root can only point to a single location, but
+      # we expect CVS/Entries to hold entries for two repositories?  It
+      # just plain isn't part of the filespec yet.
+      #
+      # Use the quick and dirty fix.
+      echo "D/dir1////" >CVS/Entries
+      echo "D/dir2////" >>CVS/Entries
 
       dotest multiroot3-7 "${testcvs} add dir2" \
 "Directory ${TESTDIR}/root2/dir2 added to the repository"




- --
                *8^)

Email: address@hidden

Get CVS support at <http://ximbiot.com>!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
Comment: Using GnuPG with Netscape - http://enigmail.mozdev.org

iD8DBQFAL8MrLD1OTBfyMaQRAnQMAKDlUItCKdbD2jGs9+3O97EJgUr4JQCgzZCY
PU4V5FQGpjeFCLE+Vgz3VY4=
=wDns
-----END PGP SIGNATURE-----






reply via email to

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