CVS checkout - exclude dirs from module

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
User avatar
Heavy
Forum Contributor
Posts: 478
Joined: Sun Sep 22, 2002 7:36 am
Location: Viksjöfors, Hälsingland, Sweden
Contact:

CVS checkout - exclude dirs from module

Post by Heavy »

Alright. Please don't RTM me, because I was working 13 hours yesterday and 12 hours the day before and now I almost don't see the words I read.

I want to know if there is a simple way to exclude certain dirs that are in a CVS module so that they are excluded from checkout by default.

module contains:

Code: Select all

app_foo/file1
app_foo/dir1
app_foo/dir2
app_foo/dir3
app_foo/dir4
app_foo/dir_foo/file1
app_foo/dir_foo/file2
app_foo/dir_foo/file3
app_foo/dir_bar/file1
app_foo/dir_bar/file2
app_foo/dir_bar/file3
And I want an exclude constraint on dir_foo and dir_bar so if I just "cvs co app_foo" the directory checked out would list:

Code: Select all

app_foo/file1
app_foo/dir1
app_foo/dir2
app_foo/dir3
app_foo/dir4
...unless I explicilty check out those directories dir_foo and dir_bar.

Anyone? any way?
User avatar
Heavy
Forum Contributor
Posts: 478
Joined: Sun Sep 22, 2002 7:36 am
Location: Viksjöfors, Hälsingland, Sweden
Contact:

Post by Heavy »

FINALLY! I don't like the Cederqvist manual. Only examples, and bad ones they are!

This is how it can be done at least under linux:

Code: Select all

bash-2.05b$ mkdir -p app/dir1
bash-2.05b$ mkdir -p app/dir2
bash-2.05b$ mkdir -p app/dir3
bash-2.05b$ mkdir -p app/foo
bash-2.05b$ mkdir -p app/bar
bash-2.05b$ echo "bahsha" > app/dir1/file.txt
bash-2.05b$ echo "bahsha" > app/dir2/file.txt
bash-2.05b$ echo "bahsha" > app/dir3/file.txt
bash-2.05b$ echo "bahsha" > app/foo/file.txt
bash-2.05b$ echo "bahsha" > app/bar/file.txt
bash-2.05b$ echo "bahsha" > app/file.txt
...gives us a nice tree of files.
Import them into the CVS repository:

Code: Select all

cd app;cvs import app jonas start;cd ..
Edit the CVSROOT/modules file

Code: Select all

bash-2.05b$ cvs co CVSROOT/modules
U CVSROOT/modules
bash-2.05b$ nano CVSROOT/modules
Add this line to make a module alias where foo and bar are suppressed at checkout:

Code: Select all

application -a !app/foo !app/bar app
commit the CVSROOT/modules file

Code: Select all

bash-2.05b$ cvs commit -m "" CVSROOT/modules
Checking in CVSROOT/modules;
/var/cvsroot/CVSROOT/modules,v  <--  modules
new revision: 1.11; previous revision: 1.10
done
cvs commit: Rebuilding administrative file database
Now, if we just checkout the directory as is, we get it all:

Code: Select all

drwxr-xr-x    3 jonas    jonas          96 Dec  1 15:55 CVSROOT
bash-2.05b$ cvs co app
U app/file.txt
U app/bar/file.txt
U app/dir1/file.txt
U app/dir2/file.txt
U app/dir3/file.txt
U app/foo/file.txt
Didn't want that... Delete:

Code: Select all

bash-2.05b$ rm -rf app/
Instead, checkout the alias module instead:

Code: Select all

bash-2.05b$ cvs co application
U app/file.txt
U app/dir1/file.txt
U app/dir2/file.txt
U app/dir3/file.txt
Voila!
foo and bar excluded. I we want them we just check them out individually:

Code: Select all

bash-2.05b$ cvs co app/bar
U app/bar/file.txt
bash-2.05b$
That's exactly what I wanted.
Thank you everybody! :twisted:
User avatar
Heavy
Forum Contributor
Posts: 478
Joined: Sun Sep 22, 2002 7:36 am
Location: Viksjöfors, Hälsingland, Sweden
Contact:

Post by Heavy »

Too bad cvs update doesn't remember this...
anytime one issues "cvs up" from within the working directory, any subdir is included.
According to the manual it is because the default behaviour ov update is "update -dP" where -d means "update any missing directories".
We'll see if it gets any funnier than this.
Post Reply