[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Help! Branch/attic mess
RE: Help! Branch/attic mess
Thu, 3 Jun 2004 12:28:27 -0400
> I am a CVS newbie, and I'm having a very hard time with some very
> basic CVS concepts.
First of all, let me say that CVS is behaving perfectly normal and properly.
> The interaction below illustrates the sources of my confusion.
> Basically, I start a project Foo which initially consists of a single
> file foo. Afterwards, I add and commit a new file bar. Finally, I
> issue a "cvs status -v" command. (I've numbered the lines and
> inserted a few comments, preceded by ###).
> 7 ### import and check out
> 8 % cvs -d $CVSROOT im -m '' Foo trunk start
There's the root of your confusion. The "import" command is intended to
import third-party software into your repository, not to create your own
project. With the import command, the files are _automatically_ checked into
the branch specified. This is a special branch (more on that later).
> 19 % cvs ad bar
> OK, what puzzles me about this is that bar is not associated with
> *any* branch, whereas foo is. This makes absolutely no sense to me.
> What gives?
bar was not imported - it was added by you after the import. CVS recognizes
that 'bar' is *not* part of the third party source distribution, so it does
not add it to the vendor branch, and places it on the trunk.
> I tried to repeat everything above, but this time specifically
> requesting the branch called "trunk" at checkout time (line 15).
> 34 File: bar Status: Up-to-date
> 42 Existing Tags:
> 43 trunk (branch: 1.1.2)
> 46 File: foo Status: Up-to-date
> 54 Existing Tags:
> 55 start (revision: 220.127.116.11)
> 56 trunk (branch: 1.1.1)
> Now the results are even more puzzling. For starters, when bar is
> commited, its corresponding RCS file bar,v is (inexplicably) placed
> under $CVSROOT/Foo/Attic.
This is normal behaviour. You forced CVS to add the file on a branch. Only
files that exist on the trunk are in the main directory - everything else
goes in the Attic. Since there is no trunk revision for bar, the only place
it can go is into the Attic. As soon as you add a trunk revision to bar, CVS
will pull it out of the Attic and place it in the main directory.
> Moreover, and just as inexplicably, a
> second branch (1.1.2) emerges.
No, it's the same branch, as indicated by the branch name, 'trunk'. Never
assume that a numeric revision in one file will automatically have the same
number in another file. Always treat the revision numbers, especially those
associated with branches, as "black boxes" that you and I don't understand,
but CVS does.
OK, now having said that, I'll explain a little about why the numbers are
different. A "normal" branch always has an even number as its last number in
the "branch" section. An odd number indicates a vendor branch. When you
added the file bar, even though you specified the same branch name, CVS
recognized that bar was not part of the original third party source
distribution (remember, that's what "import" is for), so it assigned 'trunk'
a normal branch number, 1.1.2. 'foo', on the other hand, was imported, so
CVS assigned it a vendor branch number: 1.1.1
> So now there are two branches
> associated with the same tag "trunk", depending on which file one
> looks at.
No, there is one branch, called "trunk". Again, all you and I need to worry
about is the name of the branch. CVS knows what it's doing - just let it do
its job and all will be well.
Senior Software Designer
Leitch Technology International Inc. (http://www.leitch.com)
Columnist, C/C++ Users Journal (http://www.cuj.com/experts)
RE: Help! Branch/attic mess, Jim.Hyslop, 2004/06/03