bug-cvs
[Top][All Lists]
Advanced

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

Re: new ForceImportKillNewFiles 'config' option.


From: cgd
Subject: Re: new ForceImportKillNewFiles 'config' option.
Date: 27 Jun 2004 00:17:43 -0700
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

At 26 Jun 2004 23:22:43 -0700, Chris G. Demetriou wrote:
> OK, here's the followup:
> 
> The patch below adds a new config option, "ForceImportKillNewFiles",
> which causes the 'cvs import -X' behaviour to be forced on on a
> repository-wide basis.  (The obvious reason to do this is so that CVS
> admins can require that imports be done in this manner.)

Actually, I forgot one little bit: a mention of what importX2 is
testing, near the list of the other import-related tests.

this fixes it.


chris
--
Addition to NEWS file entry for -X:

This option can be forced on, on a repository-wide basis, by using the
ForceImportKillNewFiles option in CVSROOT/config.

[ src/ChangeLog ]
2004-06-27  Chris Demetriou  <cgd@broadcom.com>

        * main.c (force_import_kill_new_files): New variable.
        * cvs.h (force_import_kill_new_files): Declare new variable.
        * import.c (import): Respect setting of force_import_kill_new_files.
        * mkmodules.c (config_contents): Add (commented-out)
        ForceImportKillNewFiles option to the config file.
        * parseinfo.c (parse_config): Parse ForceImportKillNewFiles option.
        * sanity.sh (importX2): New test, to test ForceImportKillNewFiles
        config file option.
        (import): Note new import-related test.

[ doc/ChangeLog ]
2004-06-27  Chris Demetriou  <cgd@broadcom.com>

        * cvs.texinfo (config): Document ForceImportKillNewFiles option.
        (import options): Mention that ForceImportKillNewFiles can force
        -X behaviour.

Index: cvs/doc/cvs.texinfo
diff -u cvs/doc/cvs.texinfo:1.4 cvs/doc/cvs.texinfo:1.5
--- cvs/doc/cvs.texinfo:1.4     Wed Jun 23 21:39:25 2004
+++ cvs/doc/cvs.texinfo Thu Jun 24 12:09:22 2004
@@ -10481,6 +10481,10 @@
 creating a new revision on the main trunk indicating that
 the new file is @code{dead}, resetting the new file's default branch,
 and placing the file in the Attic (@pxref{Attic}) directory.
+
+Use of this option can be forced on a repository-wide basis
+by setting the @samp{ForceImportKillNewFiles} option in
+CVSROOT/config (@pxref{config}).
 @end table
 
 @c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
@@ -14098,6 +14102,16 @@
 
 @emph{Note that new repositories (created with the @code{cvs init} command)
 will have this value set to @samp{yes}, but the default value is @samp{no}.}
+
+@cindex import, config admin file
+@cindex config (admin file), import
+@cindex ForceImportKillNewFiles, in CVSROOT/config
+@item ForceImportKillNewFiles=@var{value}
+Specify whether @code{cvs import} should always behave as if the
+@samp{-X} flag was specified on the command line.  
+@var{value} may be either @samp{yes} or @samp{no}.  If set to @samp{yes},
+all uses of @code{cvs import} on the repository will behave as if the
+@samp{-X} flag was set.  The default value is @samp{no}.
 @end table
 
 @c ---------------------------------------------------------------------
Index: cvs/src/cvs.h
diff -u cvs/src/cvs.h:1.3 cvs/src/cvs.h:1.4
--- cvs/src/cvs.h:1.3   Wed Jun 23 21:35:47 2004
+++ cvs/src/cvs.h       Thu Jun 24 12:09:22 2004
@@ -377,6 +377,7 @@
 #ifdef SUPPORT_OLD_INFO_FMT_STRINGS
 extern int UseNewInfoFmtStrings;
 #endif /* SUPPORT_OLD_INFO_FMT_STRINGS */
+extern int force_import_kill_new_files;
 
 
 #define LOGMSG_REREAD_NEVER 0  /* do_verify - never  reread message */
Index: cvs/src/import.c
diff -u cvs/src/import.c:1.5 cvs/src/import.c:1.6
--- cvs/src/import.c:1.5        Wed Jun 23 22:16:21 2004
+++ cvs/src/import.c    Thu Jun 24 12:09:22 2004
@@ -78,6 +78,10 @@
     if (argc == -1)
        usage (import_usage);
 
+    /* Force -X behaviour if the CVS repository configuration requested
+       that.  */
+    killnew = force_import_kill_new_files;
+
     ign_setup ();
     wrap_setup ();
 
Index: cvs/src/main.c
diff -u cvs/src/main.c:1.3 cvs/src/main.c:1.4
--- cvs/src/main.c:1.3  Wed Jun 23 21:35:48 2004
+++ cvs/src/main.c      Thu Jun 24 12:09:22 2004
@@ -52,6 +52,10 @@
 int UseNewInfoFmtStrings = 0;
 #endif /* SUPPORT_OLD_INFO_FMT_STRINGS */
 
+/* Force 'cvs import' to kill new files (the -X option).  Defaults to
+   off, for backward compatibility.  */
+int force_import_kill_new_files = 0;
+
 mode_t cvsumask = UMASK_DFLT;
 
 char *CurDir;
Index: cvs/src/mkmodules.c
diff -u cvs/src/mkmodules.c:1.4 cvs/src/mkmodules.c:1.5
--- cvs/src/mkmodules.c:1.4     Wed Jun 23 21:39:25 2004
+++ cvs/src/mkmodules.c Thu Jun 24 12:09:22 2004
@@ -349,6 +349,10 @@
     "# Be warned that these strings could be disabled in any new version of 
CVS.\n",
     "UseNewInfoFmtStrings=yes\n",
 #endif /* SUPPORT_OLD_INFO_FMT_STRINGS */
+    "\n",
+    "# Set `ForceImportKillNewFiles' to `yes' if you wish to force every\n",
+    "# `cvs import' command to behave as if the `-X' flag was specified.\n",
+    "#ForceImportKillNewfiles=no\n",
     NULL
 };
 
Index: cvs/src/parseinfo.c
diff -u cvs/src/parseinfo.c:1.3 cvs/src/parseinfo.c:1.4
--- cvs/src/parseinfo.c:1.3     Wed Jun 23 21:35:49 2004
+++ cvs/src/parseinfo.c Thu Jun 24 12:09:22 2004
@@ -432,6 +432,18 @@
            }
        }
 #endif /* SUPPORT_OLD_INFO_FMT_STRINGS */
+       else if (strcmp (line, "ForceImportKillNewFiles") == 0)
+       {
+           if (strcmp (p, "no") == 0)
+               force_import_kill_new_files = 0;
+           else if (strcmp (p, "yes") == 0)
+               force_import_kill_new_files = 1;
+           else
+           {
+               error (0, 0, "unrecognized value '%s' for 
ForceImportKillNewFiles", p);
+               goto error_return;
+           }
+       }
        else
        {
            /* We may be dealing with a keyword which was added in a
Index: cvs/src/sanity.sh
diff -u cvs/src/sanity.sh:1.4.2.1 cvs/src/sanity.sh:1.7
--- cvs/src/sanity.sh:1.4.2.1   Thu Jun 24 22:35:46 2004
+++ cvs/src/sanity.sh   Sun Jun 27 00:06:52 2004
@@ -1062,7 +1062,7 @@
        tests="${tests} dirs dirs2 branches branches2 branches3"
        tests="${tests} branches4 tagc tagf"
        tests="${tests} rcslib multibranch import importb importc importX"
-       tests="${tests} import-CVS"
+       tests="${tests} importX2 import-CVS"
        tests="${tests} update-p import-after-initial branch-after-import"
        tests="${tests} join join2 join3 join4 join5 join6"
        tests="${tests} join-readonly-conflict join-admin join-admin-2"
@@ -7888,6 +7888,7 @@
                # importb  -- -b option.
                # importc -- bunch o' files in bunch o' directories
                # importX  -- -X option.
+               # importX2 -- CVSROOT/config ForceImportKillNewFiles flag
                # modules3
                # mflag -- various -m messages
                # ignore  -- import and cvsignore
@@ -8479,6 +8480,94 @@
 
          cd ../..
          rm -r 1
+         rm -rf ${CVSROOT_DIRNAME}/first-dir
+         ;;
+
+
+
+       importX2)
+         # Test ForceImportKillNewFiles config file option.
+
+         # On Windows, we can't check out CVSROOT, because the case
+         # insensitivity means that this conflicts with cvsroot.
+         mkdir wnt
+         cd wnt
+
+         dotest importX2-1 "${testcvs} -q co CVSROOT" "[UP] CVSROOT${DOTSTAR}"
+         cd CVSROOT
+          echo "ForceImportKillNewFiles=yes" >> config
+
+         dotest importX2-2 "$testcvs -q ci -m force-killnew" \
+"$TESTDIR/cvsroot/CVSROOT/config,v  <--  config
+new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
+$SPROG commit: Rebuilding administrative file database"
+
+         cd ../..
+
+         # Import a sources file, but do NOT specify -X.  The new file
+         # should be killed, anyway (because of the config option).
+         mkdir imp-dir
+         cd imp-dir
+         echo 'source' >file1
+         dotest_sort importX2-3 \
+"${testcvs} import -m add first-dir source source-1_0" \
+"
+
+
+ ${CPROG} checkout -j<prev_rel_tag> -jsource-1_0 first-dir
+N first-dir/file1
+No conflicts created by this import.
+Use the following command to help the merge:"
+         cd ..
+         rm -r imp-dir
+
+         mkdir 1
+         cd 1
+         # **nothing** should be checked out**
+         dotest importX2-4 "${testcvs} -q co first-dir" ""
+
+         cd first-dir
+         dotest importX2-5 "${testcvs} -q log file1" "
+RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file1,v
+Working file: file1
+head: 1\.2
+branch:
+locks: strict
+access list:
+symbolic names:
+       source-1_0: 1\.1\.1\.1
+       source: 1\.1\.1
+keyword substitution: kv
+total revisions: 3;    selected revisions: 3
+description:
+----------------------------
+revision 1\.2
+date: ${ISO8601DATE};  author: ${username};  state: dead;  lines: ${PLUS}0 -0
+Revision 1\.1 was added on the vendor branch\.
+----------------------------
+revision 1\.1
+date: ${ISO8601DATE};  author: ${username};  state: Exp;
+branches:  1\.1\.1;
+Initial revision
+----------------------------
+revision 1\.1\.1\.1
+date: ${ISO8601DATE};  author: ${username};  state: Exp;  lines: ${PLUS}0 -0
+add
+============================================================================="
+
+         cd ../..
+
+         # Restore initial config state.
+         cd wnt/CVSROOT
+         dotest importX2-cleanup-1 "${testcvs} -q up -pr1.1 config >config" ""
+         dotest importX2-cleanup-2 "${testcvs} -q ci -m check-in-admin-files" \
+"${TESTDIR}/cvsroot/CVSROOT/config,v  <--  config
+new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
+${SPROG} commit: Rebuilding administrative file database"
+         cd ../..
+
+         rm -r 1
+         rm -r wnt
          rm -rf ${CVSROOT_DIRNAME}/first-dir
          ;;
 





reply via email to

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