[Top][All Lists]

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

Re: cvs add <directory>

From: Greg A. Woods
Subject: Re: cvs add <directory>
Date: Fri, 23 May 2003 16:41:37 -0400 (EDT)

[ On Thursday, May 22, 2003 at 22:10:31 (-0400), Larry Jones wrote: ]
> Subject: Re: cvs add <directory>
> Eric Siegerman writes:
> > 
> > IMO there *is* no correct way to add a top-level directory.
> No offense, but your opinion is wrong.  :-)
> How do you add any other directory?  You check out the parent directory
> (if you don't already have it checked out), change into it, create the
> new directory and add it.  The "'cvs co -l -d dir .' dance", as you so
> colorfully put it, is exactly those steps applied to the top-level
> directory.

Yes, but that is exactly the WRONG way to do it.

You should never have to check out the parent directory.

Furthermore CVS MUST _NEVER_ touch anything outside of the workspace.

There is a _safe_ way to create a new module directory without checking
out the parent directory and without importing any files, and without
having to have direct access to the repository directory on the server:

        $ cvs co CVSROOT
        $ cd CVSROOT
        $ echo "foomodule subdir/foomodule" >> modules
        $ cvs ci -m 'added foomodule in subdir' modules
        $ cd ..
        $ mkdir empty
        $ cd empty
        $ cvs import -m 'adding foomodule' subdir/foomodule foo bar
        $ cd ..
        $ rmdir empty
        $ cvs -f co foomodule

Like I said already I'm pretty sure I've submitted or posted
documentation changes reflecting this "from scratch" procedure at least
once in the past as well, along with the procedure for then populating
the new empty working with files from an exisinting project:

Creating a directory tree from scratch

   For a new project, the easiest and best thing to do is start with an
empty temporary directory and use the `import' command to create the
corresponding (empty) directory inside the repository:

     $ mkdir junk
     $ cd junk
     $ cvs import -m "new directory for DIR" yoyodyne/DIR yoyo start
     $ cd ..
     $ rmdir junk

   Check that the permissions CVS sets on the directories inside
`$CVSROOT' are reasonable.  You'll generally want the directory to be
mode 0775, and owned by the Unix group whos members are to have commit
privileges in this new directory.  In general it's irrelevant which
user owns the directories and files so long as the directories are
group-writable.  *Note File permissions:: for more detailed information.

   You can now check out the project directory into a working
directory.  Note that since you hopefully have specified `checkout -P'
in your `~/.cvsrc' file (*note ~/.cvsrc::.), you'll need to specify the
`-f' option to prevent CVS from immediately removing the new, and
empty, working directory:

     $ cd /work
     $ cvs -f checkout -d DIR yoyodyne/DIR

   If you first define a module (*Note Defining the module::) then you
can check out your new working directory using just the module name:

     $ cd /work
     $ cvs -f checkout DIR

   Now use `add' to add files (and new directories) as they are created
in your project.  Note that due to a hard-to-fix "bug" you must be in
the directory where you add new files.

     $ cd /work
     $ vi newfile.c
     $ make test-newfile
     $ cvs add newfile.c
     $ cvs commit -m 'first working version' newfile.c

Creating a directory tree for an existing project

   When you begin using CVS you may already have several existing
projects that can be put under CVS control.  If the files are your own
creation (i.e. they are not derived from changes made to files still
primarily being maintained by some third party) then it's best to
simply add them to a new project directory as if you were creating them
from scratch.

   Start by first creating an empty project as in the "From scratch"
examples.  Then after creating a new empty working directory simply
copy all of the files and directories from your existing project into
this new working directory.  You should first clean out all generated
files, of course, so that they won't be added to CVS.

     $ cd /work/oldprojectdir
     $ make maintainer-clean
     $ pax -rw . /work/DIR

   Now go to the newly populated working directory and use `add' to add
all the new files and directories to CVS as if they were all just newly
created.  If your project is large you might wish to use a little shell
script you can type on the command-line to eliminate some of the
repetitiveness (don't type the prompts):

     $ cd /work/DIR
     $ cvs add *
     $ for subdir in $(find . type d -print); do
     >> cd $subdir;
     >> cvs add *
     >> cd /work/DIR
     >> done
     $ cvs commit -m 'initial commit to CVS'

                                                                Greg A. Woods

+1 416 218-0098;            <address@hidden>;           <address@hidden>
Planix, Inc. <address@hidden>; VE3TCP; Secrets of the Weird <address@hidden>

reply via email to

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