info-cvs
[Top][All Lists]
Advanced

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

Re: cvs add `find ./`


From: Derek R. Price
Subject: Re: cvs add `find ./`
Date: Mon, 09 Oct 2000 18:37:21 -0400

Rob wrote:

> Is there any way to tell CVS that I want to
> add only new files to the repository? Perhaps if
> I "cvs diff $file" and check the error level for
> each file?

I just checked in a change to allow '-q' to suppress those warnings.
CVS will still exit with an error code, however.  Not sure if this is
optimal.  Let me know.

The patch against the dev version is attached in case you want it
early.  I expect it should work against 1.11.

Derek

--
Derek Price                      CVS Solutions Architect ( http://CVSHome.org )
mailto:address@hidden     OpenAvenue ( http://OpenAvenue.com )
--
"You use a Windows machine and the golden rule is: Save, and save often.
It's scary how people have grown used to the idea that computers are
unreliable when it is not the computer at all - it's the operating system
that just doesn't cut it."
                                -- Linus Torvalds


Index: ccvs.quiet-add/src/ChangeLog
===================================================================
RCS file: /home2/cvsroot/ccvs/src/ChangeLog,v
retrieving revision 1.1966
diff -u -r1.1966 ChangeLog
--- ccvs.quiet-add/src/ChangeLog        2000/10/05 17:45:25     1.1966
+++ ccvs.quiet-add/src/ChangeLog        2000/10/09 21:39:51
@@ -1,3 +1,20 @@
+2000-10-06  Derek Price  <address@hidden>
+
+       * add.c (add): Made quiet mode affect some warning messages as seemed
+       appropriate.  Specifically, some of the messages which a user might
+       want to ignore so they don't have to be quite so specific on the
+       command line: files added twice, files already in the repository and
+       check out properly (i.e. but picked up by 'cvs add *'), & files which
+       are readded in place of a dead revision or onto a branch.  '-q' will
+       not change the non-zero exit code for the cases where at least one
+       passed in file name was already in the Entries file.  There seems to
+       be a precedent in remove.c.
+       * remove.c (cvsremove): switched the "use cvs ci to make these changes
+       permanent message" to only print w/o '-Q' to match the new behavior of
+       add.  This seems appropriate as '-Q' is defined to restrict messages
+       to critical errors.
+       * sanity.sh (adderrmsg): Added some tests for the above behavior.
+
 2000-10-05  Larry Jones  <address@hidden>
 
        * client.c (call_in_directory): Create CVSADM directory if it doesn't
Index: ccvs.quiet-add/src/add.c
===================================================================
RCS file: /home2/cvsroot/ccvs/src/add.c,v
retrieving revision 1.75
diff -u -r1.75 add.c
--- ccvs.quiet-add/src/add.c    2000/06/28 04:15:47     1.75
+++ ccvs.quiet-add/src/add.c    2000/10/09 21:39:52
@@ -111,7 +111,8 @@
            || strcmp (argv[i], "..") == 0
            || fncmp (argv[i], CVSADM) == 0)
        {
-           error (0, 0, "cannot add special file `%s'; skipping", argv[i]);
+           if (!quiet)
+               error (0, 0, "cannot add special file `%s'; skipping", argv[i]);
            skip_file = 1;
        }
        else
@@ -448,8 +449,8 @@
                    if (vers->nonbranch)
                    {
                        error (0, 0,
-                              "cannot add file on non-branch tag %s",
-                              vers->tag);
+                               "cannot add file on non-branch tag %s",
+                               vers->tag);
                        ++err;
                    }
                    else
@@ -505,18 +506,21 @@
                    }
                    else
                    {
-                       if (vers->tag)
-                           error (0, 0, "\
+                       if (!quiet)
+                       {
+                           if (vers->tag)
+                               error (0, 0, "\
 file `%s' will be added on branch `%s' from version %s",
-                                  finfo.fullname, vers->tag, vers->vn_rcs);
-                       else
-                           /* I'm not sure that mentioning
-                              vers->vn_rcs makes any sense here; I
-                              can't think of a way to word the
-                              message which is not confusing.  */
-                           error (0, 0, "\
+                                       finfo.fullname, vers->tag, 
vers->vn_rcs);
+                           else
+                               /* I'm not sure that mentioning
+                                  vers->vn_rcs makes any sense here; I
+                                  can't think of a way to word the
+                                  message which is not confusing.  */
+                               error (0, 0, "\
 re-adding file %s (in place of dead revision %s)",
-                                  finfo.fullname, vers->vn_rcs);
+                                       finfo.fullname, vers->vn_rcs);
+                       }
                        Register (entries, finfo.file, "0", vers->ts_user,
                                  vers->options,
                                  vers->tag, NULL, NULL);
@@ -542,7 +546,8 @@
             * An entry for a new-born file, ts_rcs is dummy, but that is
             * inappropriate here
             */
-           error (0, 0, "%s has already been entered", finfo.fullname);
+           if (!quiet)
+               error (0, 0, "%s has already been entered", finfo.fullname);
            err++;
        }
        else if (vers->vn_user[0] == '-')
@@ -607,9 +612,10 @@
        else
        {
            /* A normal entry, ts_rcs is valid, so it must already be there */
-           error (0, 0, "%s already exists, with version number %s",
-                  finfo.fullname,
-                  vers->vn_user);
+           if (!quiet)
+               error (0, 0, "%s already exists, with version number %s",
+                       finfo.fullname,
+                       vers->vn_user);
            err++;
        }
        freevers_ts (&vers);
@@ -641,7 +647,7 @@
            free (found_name);
 #endif
     }
-    if (added_files)
+    if (added_files && !really_quiet)
        error (0, 0, "use '%s commit' to add %s permanently",
               program_name,
               (added_files == 1) ? "this file" : "these files");
Index: ccvs.quiet-add/src/remove.c
===================================================================
RCS file: /home2/cvsroot/ccvs/src/remove.c,v
retrieving revision 1.46
diff -u -r1.46 remove.c
--- ccvs.quiet-add/src/remove.c 2000/06/21 22:28:37     1.46
+++ ccvs.quiet-add/src/remove.c 2000/10/09 21:39:52
@@ -115,7 +115,7 @@
                           argc, argv,
                            local, W_LOCAL, 0, 1, (char *) NULL, 1);
 
-    if (removed_files)
+    if (removed_files && !really_quiet)
        error (0, 0, "use '%s commit' to remove %s permanently", program_name,
               (removed_files == 1) ? "this file" : "these files");
 
Index: ccvs.quiet-add/src/sanity.sh
===================================================================
RCS file: /home2/cvsroot/ccvs/src/sanity.sh,v
retrieving revision 1.625
diff -u -r1.625 sanity.sh
--- ccvs.quiet-add/src/sanity.sh        2000/10/05 17:45:25     1.625
+++ ccvs.quiet-add/src/sanity.sh        2000/10/09 21:40:01
@@ -644,7 +644,7 @@
        tests="${tests} mkmodules-temp-file-removal"
        tests="${tests} cvsadm emptydir abspath toplevel toplevel2"
        # Log messages, error messages.
-       tests="${tests} mflag editor errmsg1 errmsg2"
+       tests="${tests} mflag editor errmsg1 errmsg2 adderrmsg"
        # Watches, binary files, history browsing, &c.
        tests="${tests} devcom devcom2 devcom3 watch4 watch5"
        tests="${tests} unedit-without-baserev"
@@ -5308,8 +5308,7 @@
          dotest import-after-initial-2 "$testcvs -Q co $module" ''
          cd $module
          echo original > $file
-         dotest import-after-initial-3 "${testcvs} -Q add $file" \
-"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
+         dotest import-after-initial-3 "${testcvs} -Q add $file" ""
          dotest import-after-initial-4 "${testcvs} -Q ci -m. $file" \
 "RCS file: ${TESTDIR}/cvsroot/$module/$file,v
 done
@@ -10524,6 +10523,56 @@
          cd ..
          rm -r 1
          rm -rf ${TESTDIR}/cvsroot/first-dir
+         ;;
+
+       adderrmsg)
+         # Test some of the error messages the 'add' command can return and
+         # their reactions to '-q'.
+
+         # First the usual setup; create a directory first-dir.
+         mkdir 1; cd 1
+         dotest adderrmsg-init1 "${testcvs} -q co -l ." ''
+         mkdir adderrmsg-dir
+         dotest adderrmsg-init2 "${testcvs} add adderrmsg-dir" \
+"Directory ${TESTDIR}/cvsroot/adderrmsg-dir added to the repository"
+          cd adderrmsg-dir
+
+         # try to add the admin dir
+         dotest_fail adderrmsg-1 "${testcvs} add CVS" \
+"${PROG} [a-z]*: cannot add special file .CVS.; skipping"
+         # might not want to see this message when you 'cvs add *'
+         dotest_fail adderrmsg-2 "${testcvs} -q add CVS" ""
+
+         # to test some other messages
+         touch file1
+         dotest adderrmsg-3 "${testcvs} add file1" \
+"${PROG} [a-z]*: scheduling file .file1. for addition
+${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
+
+         # add it twice
+         dotest_fail adderrmsg-4 "${testcvs} add file1" \
+"${PROG} [a-z]*: file1 has already been entered"
+         dotest_fail adderrmsg-5 "${testcvs} -q add file1" ""
+
+         dotest adderrmsg-6 "${testcvs} -q ci -madd" \
+"RCS file: ${CVSROOT_DIRNAME}/adderrmsg-dir/file1,v
+done
+Checking in file1;
+${CVSROOT_DIRNAME}/adderrmsg-dir/file1,v  <--  file1
+initial revision: 1\.1
+done"
+
+         # file in Entries & repository
+         dotest_fail adderrmsg-7 "${testcvs} add file1" \
+"${PROG} [a-z]*: file1 already exists, with version number 1\.1"
+         dotest_fail adderrmsg-8 "${testcvs} -q add file1" ""
+
+         # clean up
+         cd ../..
+         if test "$keep" = no; then
+             rm -r 1
+             rm -rf ${TESTDIR}/cvsroot/adderrmsg-dir
+         fi
          ;;
 
        devcom)

reply via email to

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