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: 16 Jul 2004 14:32:04 -0700
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

At 09 Jul 2004 22:19:02 -0700, Chris G. Demetriou wrote:
> Anyway, I'll wait a few days for more comments, i guess, then regen w/
> "ImportToVendorBranchOnly" unless people scream for something else.

nobody said anything more, but i really prefer with "NewFiles"
included in the name.

here's the patch.  (against 1.12.9 + the -X patch.)

If you want just ImportToVendorBranchOnly, I believe a simple
        s/ImportNewFilesToVendorBranchOnly/ImportToVendorBranchOnly/g
should work.



chris
--
[ NEWS file entry, add after -X text ]
 
  This option may be made the default on a repository-wide basis
  using the new ImportNewFilesToVendorBranchOnly=yes option in
  CVSROOT/config.

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

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

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

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

Index: cvs/doc/cvs.texinfo
diff -u cvs/doc/cvs.texinfo:1.4 cvs/doc/cvs.texinfo:1.7
--- cvs/doc/cvs.texinfo:1.4     Wed Jun 23 21:39:25 2004
+++ cvs/doc/cvs.texinfo Wed Jul 14 12:42:53 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{ImportNewFilesToVendorBranchOnly} 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 ImportNewFilesToVendorBranchOnly, in CVSROOT/config
+@item ImportNewFilesToVendorBranchOnly=@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.5
--- cvs/src/cvs.h:1.3   Wed Jun 23 21:35:47 2004
+++ cvs/src/cvs.h       Wed Jul 14 12:42:53 2004
@@ -377,6 +377,7 @@
 #ifdef SUPPORT_OLD_INFO_FMT_STRINGS
 extern int UseNewInfoFmtStrings;
 #endif /* SUPPORT_OLD_INFO_FMT_STRINGS */
+extern int ImportNewFilesToVendorBranchOnly;
 
 
 #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.7
--- cvs/src/import.c:1.5        Wed Jun 23 22:16:21 2004
+++ cvs/src/import.c    Wed Jul 14 12:42:53 2004
@@ -78,6 +78,10 @@
     if (argc == -1)
        usage (import_usage);
 
+    /* Force -X behaviour if the CVS repository configuration requested
+       that.  */
+    killnew = ImportNewFilesToVendorBranchOnly;
+
     ign_setup ();
     wrap_setup ();
 
Index: cvs/src/main.c
diff -u cvs/src/main.c:1.3 cvs/src/main.c:1.5
--- cvs/src/main.c:1.3  Wed Jun 23 21:35:48 2004
+++ cvs/src/main.c      Wed Jul 14 12:42:53 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 ImportNewFilesToVendorBranchOnly = 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.7
--- cvs/src/mkmodules.c:1.4     Wed Jun 23 21:39:25 2004
+++ cvs/src/mkmodules.c Wed Jul 14 12:42:53 2004
@@ -349,6 +349,11 @@
     "# 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 `ImportNewFilesToVendorBranchOnly' to `yes' if you wish to force\n",
+    "# every `cvs import' command to behave as if the `-X' flag was\n",
+    "# specified.\n",
+    "#ImportNewFilesToVendorBranchOnly=no\n",
     NULL
 };
 
Index: cvs/src/parseinfo.c
diff -u cvs/src/parseinfo.c:1.3 cvs/src/parseinfo.c:1.6
--- cvs/src/parseinfo.c:1.3     Wed Jun 23 21:35:49 2004
+++ cvs/src/parseinfo.c Wed Jul 14 12:42:53 2004
@@ -432,6 +432,18 @@
            }
        }
 #endif /* SUPPORT_OLD_INFO_FMT_STRINGS */
+       else if (strcmp (line, "ImportNewFilesToVendorBranchOnly") == 0)
+       {
+           if (strcmp (p, "no") == 0)
+               ImportNewFilesToVendorBranchOnly = 0;
+           else if (strcmp (p, "yes") == 0)
+               ImportNewFilesToVendorBranchOnly = 1;
+           else
+           {
+               error (0, 0, "unrecognized value '%s' for 
ImportNewFilesToVendorBranchOnly", 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.9
--- cvs/src/sanity.sh:1.4.2.1   Thu Jun 24 22:35:46 2004
+++ cvs/src/sanity.sh   Wed Jul 14 12:42:53 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,8 @@
                # importb  -- -b option.
                # importc -- bunch o' files in bunch o' directories
                # importX  -- -X option.
+               # importX2 -- CVSROOT/config ImportNewFilesToVendorBranchOnly
+               #             flag
                # modules3
                # mflag -- various -m messages
                # ignore  -- import and cvsignore
@@ -8484,6 +8486,94 @@
 
 
 
+       importX2)
+         # Test ImportNewFilesToVendorBranchOnly 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 "ImportNewFilesToVendorBranchOnly=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
+         ;;
+
+
+
        import-CVS)
          mkdir import-CVS
          cd import-CVS





reply via email to

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