bug-cvs
[Top][All Lists]
Advanced

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

Bug/Feature patch: stopping CVS from going into subpackages (redux)


From: Seth Robertson
Subject: Bug/Feature patch: stopping CVS from going into subpackages (redux)
Date: Sun, 07 Jan 2001 19:36:18 -0500

OK, I'll try this again.  My patch was good, but not really done in
the right way, but more importantly, does not work in client/server
mode (I did test it, but alas only on the same machine as the
repository which allowed it to work).  So here is my new revised patch
which actually looks at the CVS Root/Repository files to check to see
if we changed packages.

----------------------------------------------------------------------
One of the sometimes cool and sometimes incredibly annoying features
of CVS is that if you have a checked-out package, with other packages
checked out under the top level, the working copy of the top level CVS
will inherit the sub-packages.  Specifically, commands like `cvs
update` in the top level will recurse down into another package if it
is "below" in the directory tree.

This is sometimes what you want, but there are many circumstances in
which this is *not* what you want.  A few examples:

* You wish to apply the CVS command (update/tag/diff/etc) to only the
  top level package

* You have the following tree:

                            <metaproduct>
               /bin   <os-subset>   <bind>   <product>
                      /sys /lib     /[...]   /src /lib /etc

Specifically, there is a metaproduct package with one subdirectory
/bin.  Then there are two non-product-specific packages: os-subset
and bind.  os-subset is a module which takes a subset of the os
package.  Product is the main product package.

Currently, if you do `cvs checkout -d . metaproduct` in metaproduct
this will do the normal thing in metaproduct.  However, it will
recurse down into os-subset and start checking out parts of os which
are *not* in os-subset.  This is bad and probably a bug in and of its
own right, but my hack will allow people to work around it.

Specifically what it does is creates another global all-commands flag
"-R" which will modify how the directory list is built--non-same
packages are ignore.

                                        -Seth Robertson
                                         address@hidden

--- ../../cvs-1.11/src/find_names.c     Sun Nov 22 10:14:53 1998
+++ ./find_names.c      Sun Jan  7 12:28:06 2001
@@ -175,7 +175,7 @@
     dirlist = getlist ();
 
     /* find the local ones */
-    if (which & W_LOCAL)
+    if ((which & W_LOCAL) && !(special_flags & W_DIRFROMREPOS))
     {
        List *tmpentries;
        struct stickydirtag *sdtp;
@@ -229,7 +229,7 @@
     }
 
     /* look for sub-dirs in the repository */
-    if ((which & W_REPOS) && repository)
+    if (((which & W_REPOS) || (special_flags & W_DIRFROMREPOS)) && repository)
     {
        /* search the repository */
        if (find_dirs (repository, dirlist, 0, entries) != 0)
--- ../../cvs-1.11/src/cvs.h    Sat Jul  8 15:57:21 2000
+++ ./cvs.h     Sun Jan  7 12:28:06 2001
@@ -364,6 +364,9 @@
 extern int cvswrite;
 extern mode_t cvsumask;
 
+extern int special_flags;
+#define W_DIRFROMREPOS         0x01    /* look for directories from repository 
*/
+
 /* Access method specified in CVSroot. */
 typedef enum {
   local_method, server_method, pserver_method, kserver_method, gserver_method,
--- ../../cvs-1.11/src/recurse.c        Wed Jun 21 18:28:37 2000
+++ ./recurse.c Sun Jan  7 12:28:07 2001
@@ -98,7 +98,10 @@
        directory *or* it exists in the repository.  If a directory
        does not exist in the working directory, the direntproc must
        either tell us to skip it (R_SKIP_ALL), or must create it (I
-       think those are the only two cases).  */
+       think those are the only two cases).
+
+       3.  W_DIRFROMREPOS (special flags) modifies W_LOCAL so that the 
directory
+       list is obtained from the repository. */
     int which;
 
     int aflag;
--- ../../cvs-1.11/src/main.c   Wed Sep  6 19:35:04 2000
+++ ./main.c    Sun Jan  7 12:32:10 2001
@@ -34,6 +34,7 @@
 
 char hostname[MAXHOSTNAMELEN];
 
+int special_flags = 0;
 int use_editor = 1;
 int use_cvsrc = 1;
 int cvswrite = !CVSREAD_DFLT;
@@ -236,6 +237,7 @@
     "    -Q           Cause CVS to be really quiet.\n",
     "    -q           Cause CVS to be somewhat quiet.\n",
     "    -r           Make checked-out files read-only.\n",
+    "    -R           Use directory list from repository.\n",
     "    -w           Make checked-out files read-write (default).\n",
     "    -l           Turn history logging off.\n",
     "    -n           Do not execute anything that will change the disk.\n",
@@ -432,7 +434,7 @@
     int help = 0;              /* Has the user asked for help?  This
                                   lets us support the `cvs -H cmd'
                                   convention to give help for cmd. */
-    static const char short_options[] = "+Qqrwtnlvb:T:e:d:Hfz:s:xa";
+    static const char short_options[] = "+RQqrwtnlvb:T:e:d:Hfz:s:xa";
     static struct option long_options[] =
     {
         {"help", 0, NULL, 'H'},
@@ -551,6 +553,9 @@
            case 'q':
                quiet = 1;
                break;
+           case 'R':
+              special_flags = W_DIRFROMREPOS;
+              break;
            case 'r':
                cvswrite = 0;
                break;



reply via email to

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