bug-cvs
[Top][All Lists]
Advanced

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

Re: new ForceImportKillNewFiles 'config' option.


From: Mark D. Baushke
Subject: Re: new ForceImportKillNewFiles 'config' option.
Date: Sat, 17 Jul 2004 01:53:01 -0700

Hi Chris,

I have no objections to ImportToVendorBranchOnly
and only minor reservations concerning the longer
ImportNewFilesToVendorBranchOnly version of the
name.

Does anyone else have any comment on the name?

btw: I have modified the commentary lines of your
patch slightly. The revised suggested patch is
included below.

        Enjoy!
        -- Mark

Index: NEWS
===================================================================
RCS file: /cvs/ccvs/NEWS,v
retrieving revision 1.258
diff -u -p -r1.258 NEWS
--- NEWS        17 Jul 2004 02:41:20 -0000      1.258
+++ NEWS        17 Jul 2004 08:42:10 -0000
@@ -20,6 +20,14 @@ NEW FEATURES
   support it.  This saves a very small amount of bandwidth but may enable some
   future functionality.
 
+* "cvs import" now has a new option, `-X', which causes new files to be
+  imported in a way that they appear only on the vendor branch, and do not
+  automatically appear on the main trunk.
+
+  This option may be made the default on a repository-wide basis
+  using the new ImportNewFilesToVendorBranchOnly=yes option in
+  CVSROOT/config.
+
 BUG FIXES
 
 * Thanks to Conrad Pino <conrad@pino.com>, the Windows build works once again.
Index: doc/ChangeLog
===================================================================
RCS file: /cvs/ccvs/doc/ChangeLog,v
retrieving revision 1.856
diff -u -p -r1.856 ChangeLog
--- doc/ChangeLog       29 Jun 2004 19:27:08 -0000      1.856
+++ doc/ChangeLog       17 Jul 2004 08:42:10 -0000
@@ -1,3 +1,11 @@
+2004-07-17  Mark D. Baushke  <mdb@cvshome.org>
+
+       * cvs.texinfo (config): Document ImportNewFilesToVendorBranchOnly
+       option.
+       (import options): Mention that ImportNewFilesToVendorBranchOnly
+       can force 'cvs import -X' behaviour for all imports.
+       (New feature from Chris Demetriou <cgd@broadcom.com>.)
+
 2004-06-29  Derek Price  <derek@ximbiot.com>
 
        * cvsclient.texi (Requests): Note new `Relative-directory request' as
Index: doc/cvs.texinfo
===================================================================
RCS file: /cvs/ccvs/doc/cvs.texinfo,v
retrieving revision 1.611
diff -u -p -r1.611 cvs.texinfo
--- doc/cvs.texinfo     26 Jun 2004 17:43:47 -0000      1.611
+++ doc/cvs.texinfo     17 Jul 2004 08:42:11 -0000
@@ -10481,6 +10481,10 @@ steps for each file in addition to those
 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 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
@@ -14095,6 +14099,16 @@ please see @ref{Updating Commit Files}.
 
 @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: src/ChangeLog
===================================================================
RCS file: /cvs/ccvs/src/ChangeLog,v
retrieving revision 1.2841
diff -u -p -r1.2841 ChangeLog
--- src/ChangeLog       15 Jul 2004 14:49:13 -0000      1.2841
+++ src/ChangeLog       17 Jul 2004 08:42:11 -0000
@@ -1,3 +1,16 @@
+2004-07-17  Mark D. Baushke  <mdb@cvshome.org>
+
+       * main.c (import_kill_new_files): New variable.
+       * cvs.h (import_kill_new_files): Declare new variable.
+       * import.c (import): Respect setting of import_kill_new_files.
+       * mkmodules.c (config_contents): Document the default
+       ImportKillNewFiles=no option in newly generated config files.
+       * parseinfo.c (parse_config): Parse ImportKillNewFiles option.
+       * sanity.sh (importX2): New test, to test ImportKillNewFiles
+       config file option.
+       (import): Note new import-related test.
+       (New feature from Chris Demetriou <cgd@broadcom.com>.)
+
 2004-07-15  Derek Price  <derek@ximbiot.com>
 
        * sanity.sh (run_filter): New function to allow for filtering of cruft
Index: src/cvs.h
===================================================================
RCS file: /cvs/ccvs/src/cvs.h,v
retrieving revision 1.296
diff -u -p -r1.296 cvs.h
--- src/cvs.h   9 Jun 2004 14:47:39 -0000       1.296
+++ src/cvs.h   17 Jul 2004 08:42:11 -0000
@@ -377,6 +377,7 @@ extern int top_level_admin;
 #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: src/import.c
===================================================================
RCS file: /cvs/ccvs/src/import.c,v
retrieving revision 1.148
diff -u -p -r1.148 import.c
--- src/import.c        26 Jun 2004 17:43:48 -0000      1.148
+++ src/import.c        17 Jul 2004 08:42:11 -0000
@@ -78,6 +78,10 @@ import (int argc, char **argv)
     if (argc == -1)
        usage (import_usage);
 
+    /* Force -X behaviour or not based on the CVS repository
+       CVSROOT/config setting.  */
+    killnew = ImportNewFilesToVendorBranchOnly;
+
     ign_setup ();
     wrap_setup ();
 
Index: src/main.c
===================================================================
RCS file: /cvs/ccvs/src/main.c,v
retrieving revision 1.213
diff -u -p -r1.213 main.c
--- src/main.c  12 Jul 2004 23:10:42 -0000      1.213
+++ src/main.c  17 Jul 2004 08:42:11 -0000
@@ -52,6 +52,10 @@ int top_level_admin = 0;
 int UseNewInfoFmtStrings = 0;
 #endif /* SUPPORT_OLD_INFO_FMT_STRINGS */
 
+/* Control default behavior of 'cvs import' (-X option on or off) in
+   CVSROOT/config.  Defaults to off, for backward compatibility. */
+int ImportNewFilesToVendorBranchOnly = 0;
+
 mode_t cvsumask = UMASK_DFLT;
 
 char *CurDir;
Index: src/mkmodules.c
===================================================================
RCS file: /cvs/ccvs/src/mkmodules.c,v
retrieving revision 1.80
diff -u -p -r1.80 mkmodules.c
--- src/mkmodules.c     26 Jun 2004 17:43:48 -0000      1.80
+++ src/mkmodules.c     17 Jul 2004 08:42:11 -0000
@@ -349,6 +349,11 @@ static const char *const config_contents
     "# 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: src/parseinfo.c
===================================================================
RCS file: /cvs/ccvs/src/parseinfo.c,v
retrieving revision 1.52
diff -u -p -r1.52 parseinfo.c
--- src/parseinfo.c     22 Mar 2004 15:37:34 -0000      1.52
+++ src/parseinfo.c     17 Jul 2004 08:42:11 -0000
@@ -432,6 +432,18 @@ warning: this CVS does not support Prese
            }
        }
 #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: src/sanity.sh
===================================================================
RCS file: /cvs/ccvs/src/sanity.sh,v
retrieving revision 1.933
diff -u -p -r1.933 sanity.sh
--- src/sanity.sh       15 Jul 2004 14:49:13 -0000      1.933
+++ src/sanity.sh       17 Jul 2004 08:42:12 -0000
@@ -1082,7 +1082,7 @@ if test x"$*" = x; then
        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"
@@ -7908,6 +7908,8 @@ modify-on-br1
                # 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
@@ -8504,6 +8506,94 @@ add
 
 
 
+       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-cvs-import-X" \
+"$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]