questions on development(7)

Stefan Sperling stsp at
Fri Nov 9 05:52:58 PST 2007

On Fri, Nov 09, 2007 at 04:56:24AM +0000, Aryeh M. Friedman wrote:
> 1. If I am modifing code and such should I have a local branch?

You can either maintain a local branch or keep backing up your
diffs against the main source tree. Which one is better depends
on the size of your changes and your workflow.

I've used both. Maintaining your own local branch means much
more cvs-related overhead but may be worth it if you need
your changes versioned properly.

> 2. If yes to #1 how do I setup keeping everything except my modified
> code in sync (and if possible to retro activally apply patchs from the
> local branch unto the main source tree [/usr/src2])

Just run cvsup to update your copy of the cvs repository as usual,
it should not delete your branch.

The development(7) man page says that it can in some cases delete
your branch though, so you should regularly back up your branch as
a diff against the upstream branch you are based on, and possibly
back up your copy of the cvs repository before updating.

> 3. The documentation said very little about how to generate patchs
> between my local code and the main branch
>     a. Ideally I want to set it up where when I am done with a
> modification it automatically creates a patch (I have never used CVS
> for anything except through csup and cvsup so I am totally lost here)

I don't think this list is appropriate for basic CVS questions,
but I give you a few hints anyway because development(7) does
not mention them:

You need to tag the point you are branching from in CVS,
otherwise you cannot create meaningful diffs between your
own branch and the upstream branch.

So to create a branch you can actually use, you need to run
the rtag command TWICE. For example, to branch RELENG_7, use:

	export CVS_LOCAL_BRANCH_NUM=424242
	cvs -d $CVSROOT rtag -r RELENG_7 MY_BRANCH_BP
	cvs -d $CVSROOT rtag -r RELENG_7 -b MY_BRANCH

You should also create descriptive tags on both branches
before and after doing a merge, to make it easier to track
what has been merged where and when. Otherwise continuously
syncing your branch with upstream becomes a pain quickly.

You can maintain several custom branches in a single
repository by switching CVS_LOCAL_BRANCH_NUM. Just
don't end up confusing your branches. Always use the same
CVS_LOCAL_BRANCH_NUM setting for all tag and rtag commands
operating on the same branch.

Warning: Branching and merging in CVS is hard! Not because
branching and merging in general is hard, but simply because
CVS is brain damaged. You will very likely mess it up the
first time. You should practise on a test repo until you
feel confident that you understand it properly.

For more information see
and especially

stefan                                         PGP Key: 0xF59D25F0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url :

More information about the freebsd-hackers mailing list