info-cvs
[Top][All Lists]
Advanced

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

RE: Info-cvs Digest, Vol 8, Issue 6


From: Matthew Herrmann
Subject: RE: Info-cvs Digest, Vol 8, Issue 6
Date: Sun, 6 Jul 2003 06:28:12 +1000

Hi Jeff,

(...my input into the debate)

The best way IMHO to do such code sharing is to mimic the behaviour of the
'modules' command by including the following in your build script:

cvs co utils

-- this variant means that this code is designed to run on the absolute
latest version of utils.

cvs co -rUTILS_13 utils

-- this means that this code is designed to run with a particular version of
the utils project.

The nice thing about this setup is that:

- you can explicitly toggle between 'bleeding-edge' and precise version
control, where-as shared files leave the difference between these two
concepts hazy indeed.

If multiple people are working on the shared project, you can have a
controlled process where you 'move' from version 13 to 14 of the utilities,
and test for incompatibilities.

The only caveat to this approach is that "cvs tag" should not be used, only
"cvs rtag" since you risk polluting your utils project with TAGS from
multiple projects otherwise. This caveat is not a drawback for me since I
consider "cvs tag" a dangerous option.

Cheers,

Matthew Herrmann
--------------------------------------
VB6/SQL/Java/CVS Consultancy
Far Edge Technology
http://www.faredge.com.au/

-----Original Message-----

Date: Fri, 4 Jul 2003 11:00:56 +0800
From: Jeff Pitman <address@hidden>
To: address@hidden
Subject: Sharing files across directories - Redux
Message-ID: <address@hidden>
Content-Type: text/plain;
  charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Precedence: list
Message: 1

A bit of a delayed response, I know...

At 02:33 PM 9/25/2002, Matt Lyon wrote:

> Is there a way to share a single source file across multiple
> directories in CVS, so that if it gets committed/merged in one
> directory the update registers in both locations? I know that VSS has
> this concept, and was wondering if CVS offers any sort of similar
> functionality. I was thinking that perhaps this could be achieved with
> some symlink trickery on the server-side?

On Wed, 25 Sep 2002 17:26:09 -0400, Frederic Brehm wrote:
> Actually, Ampersand modules share whole directories, not single files.
> CVS has no built-in way to share a single file across multiple
> directories.

I was able to successfully share a single file by using some hackery in
the CVSROOT/modules and Ampersand modules.  But, it doesn't scale very
well, so I recommend it only if you need to share a couple of files.
The scaling problem comes when you have to begin using a complex
mneumonic/keyword system to cross-merge similar files across different
directories from different projects.

Some more disadvantages:

        * You cannot use branching to coax a different set of files to come out
        * You cannot re-check out the repository into your working copy and
have clean output.  You will always get conflicts (even though it isn't
real.)

Use this only when absolutely necessary.  Otherwise, follow Frederic's
recommendation about changing the build system to accomodate your
needs. (Eg. KDE does a symlink in the Working copies of their many
projects to the admin/ directory to share the autoconf stuff around.)

Steps to share one file (all by editing CVSROOT/modules):

1. Add your project module and point to an Ampersand module:

# '-d' added for completeness, although optional
# Alias Working dir.    Repos. Module           Files or & Modules
foobar  -d foobar               foobar                  &shared-admin 
&shared-init

2. Select the files and location where you want to put this.  It will
have to be a sub-directory off of the Working copy's root.

shared-admin -d admin   baseline/admin          ltmain.sh missing
shared-init    -d src           baseline/src            main.c init.c

Note: CVS admin directories for autoconf probably could just as well be
shared as a whole, instead of individual files.  Therefore, the second
"shared-init" provides a more interesting example where it can
cross-mix different files between a set of baseline files and a set of
project specific files.  Of course, branching and merging is left as an
exercise for the reader!!

Definitions:

Alias   - Used to link modules together, used only under the scope of
CVSROOT/modules.
Working dir. - The name of the directory that is output starting at the
base of your checkout.
Repos. Module - The repository module or its subdirectory
Ampersand (&) Modules - a link to another Alias found in CVSROOT/modules
Files - files that are found under the listed Repos. Module

I hope this has been an informative piece. Let the debate begin!

take care,
jeff





reply via email to

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