[Techtalk] cvs tags and branches

Hamster hamster at hamsternet.org
Tue Nov 11 21:13:15 EST 2003


On Tue, 11 Nov 2003 13:19:05 -0500
Emma Jane Hogbin <emmajane at xtrinsic.com> wrote:

> It looks like I can't create a new branch without having named the first
> batch of programming. Somehow I've managed to get a sticky tag on the new
> programming and now when I try to commit files in the new directory it
> says, "cvs commit: sticky tag `mimic' for file `templates/light.php' is
> not a branch".

Hi, I'm about to try an outline a procedure for you, hope it makes some
sense.

In the beginning, there was your original source code. Let's put it in a
directory called mycode. 

[mycode]$ ls
main.c  main.h
[mycode]$

In my example, this directory exists in my cvs repository as the module
mycode.

I've checked out a sandbox using cvs -d /home/cvsroot checkout mycode

$ cvs -d /home/cvsroot/ checkout mycode
cvs checkout: Updating mycode
U mycode/main.c
U mycode/main.h
$

Now. This is the code that I want to freeze before branching off. In your
case, this is the original code that you want to branch off from. So what
I'm going to do is mark this code with a tag that identifies it as
"original".

[mycode]$ cvs tag original *
cvs tag: warning: directory CVS specified in argument
cvs tag: but CVS uses CVS for its own purposes; skipping CVS directory
T main.c
T main.h
[mycode]$

What this means:

If at any stage in the future you wish to go back and look at your original
code, all you need to do is create a sandbox using the command:
`cvs -d /home/cvsroot checkout -r original mycode`
and you'll create a sandbox with a copy of your original code.

Please note: Its NOT necessary to tag files before branching. Its just
something that can be a good idea to do, especially when there is more than
one person working on the code. You CAN completely leave out this whole
tagging process. 

Right. What we want to do now is branch off your original code.

The command to do this is as follows, I'll explain what it does at the end.

[mycode]$ cvs tag -r original -b NewClient *
cvs tag: warning: directory CVS specified in argument
cvs tag: but CVS uses CVS for its own purposes; skipping CVS directory
T main.c
T main.h
[mycode]$

If you havent tagged your original code with "original" then just leave out
the "-r original".

cvs tag is obvious
the -r means I want to tag all the files that are marked as part of the
original code. This probably isnt necessary in your case, but it doesnt
hurt to do it. 
the -b means "I want to create a branch off this code called NewClient"


Now, in order to do some work on the code for the new client, you have to
create a new sandbox, called a branch sandbox. You have to checkout your
NewClient branch into that sandbox.

What I do is this:
[test]$ mkdir NewClient
[test]$ cvs -d /home/cvsroot/ checkout -d NewClient/ -r NewClient mycode
cvs checkout: Updating NewClient
U NewClient/main.c
U NewClient/main.h
[test]$

To explain:
I have created a new directory called NewClient. I have told cvs to checkout
the sandbox into that directory (thats the -d NewClient). I told it to
checkout the NewClient branch of the mycode module.

What you have now is a sandbox that contains the NewClient branch. If you cd
into that directory and edit away at those files, you'll be adding stuff to
the NewClient branch only.

Has this made any sense??

Its been more example than explanation, but I hope you can follow it
through.

Hamster







More information about the Techtalk mailing list