info-cvs
[Top][All Lists]
Advanced

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

RE: NewBies Question: HOWTO Find/Tag old branch point


From: Bulgrien, Kevin
Subject: RE: NewBies Question: HOWTO Find/Tag old branch point
Date: Thu, 25 May 2006 09:23:24 -0500

-----Original Message-----
| From: address@hidden
[mailto:address@hidden On Behalf
Of Vikram Sachdeva
| Sent: Thursday, May 25, 2006 12:22 AM
| To: address@hidden
| Subject: NewBies Question
|
| Given any CVS branch name, does anyone know how to get the code base
| when the branch was created initially?
| If I do a checkout using the branch name, I'll get the latest code. But
| I want the initial codebase.
| 
| I don't know the tag. Also, the person who created the branch might not
| have tagged the codebase before branching. So all I know is the branch
| name.
| 
| 
| TIA
| Vikram
-----Original Message-----

This is how I used a tool like CVS Web / ViewCVS to help me do exactly
what you are asking for.  I used GNU/Linux tools to help me.  It worked
reliably on a large project.  Someone had created a branch tag but no
regular tag, so a giant merge operation was more difficult because I
needed a tag at the branch point to help verify alterations on both HEAD
and on the branch.  I used the following procedure to put down an
equivalent non-branch tag that can be used to cvs diff to the branch
point.

The following may not be elegant or the best solution because it was
developed under pressure, but it worked.

---

First, find an approximate date/time a branch tag was created by looking
at the repository with a tool like CVS Web.  If you do not have that
type of tool, find some other way to roughly approximate the date of the
branch point.  This can be a granularity of a year, or a month for this
example.  Be careful.  Make sure the approximate date/time is BEFORE the
the first commit on to that branch.

Next, checkout the branch and collect some history information about it.
Hopefully the repository was set up to take history.

cvs -d /path/to/repository co -d work_dir -r MY_BRANCH_TAG module_list
cd work_dir
cvs history -ea > raw_history_data.txt

Use grep with a crude approximation of when the branch occurred.  The
grep is used because the history on the whole project was so massive that
we needed to pare down the file to a less unreasonable size.  I did not
want to sort the whole history.

        grep "^..2004-11" raw_history_data.txt | sort --key=2
>history_2004.txt
or
        grep "^..2004" raw_history_data.txt | sort --key=2 >history_2004.txt

Find the point in the sorted file where the version numbers convert to
branch
version numbers.  See below for an example, but be aware that it is easy to
make a mistake if the search through history is not started BEFORE the
actual
date and time that the branch was instantiated.

In general, from the top of the sorted file, look for all branch version
numbers
that match the following regular expression.  Note that this example
presumes a
branch revision of x.y.a.b, but could be easily modified to be a branch at
any
revision depth x.y.a.b.c.d, etc.

        [ ][0-9]+\.[0-9]+\.[0-9]+\.

If using vi's / command,  you may need to use:

        /[ ][0-9]*\.[0-9]*\.[0-9]*\.

For each file that has a branch version number, locate the file in cvsweb.
This is somewhat tedious.  There might be a better way, but I did not try
to find one at the time.  Identify the branch tag that applies to that
revision.  If it is not the branch tag that you are working with, keep
moving down the file until you locate the first change on the branch of
interest.

Note the date and time of that change, and note the date and time of the
change
immediately preceding it.  The "beginning of the branch" must be a date and
time that is between those two dates.

Example:

A 2004-09-30 20:01 +0000 username1    1.1
readme.txt
Projects/dirs                                     ==
~/cvs/toolx/Projects/dirs
A 2004-10-11 18:54 +0000 username     1.1
test-branches.f
product/dir/mnc/unit-tests                        ==
~/cvs/fx3.top-wip/product/dir/mnc.top2/unit-tests
A 2004-10-11 18:54 +0000 username     1.1
test-branches.f
product/dir/mnc/unit-tests                        ==
~/cvs/fx3.top-wip/product/dir/mnc.top2/unit-tests
A 2004-10-11 18:54 +0000 username     1.1
test-branches.f
product/dir/mnc/unit-tests                        ==
~/cvs/fx3.top-wip/product/dir/mnc.top2/unit-tests
A 2004-11-09 13:56 +0000 lusernam     1.1.2.1
beefy-project.f
product/dir/dsp                                   == <remote>
A 2004-11-09 13:56 +0000 lusernam     1.1.2.1
beefy-project.f
product/dir/dsp                                   == <remote>
A 2004-11-09 13:56 +0000 lusernam     1.1.2.1
beefy-project.f
product/dir/dsp                                   == <remote>
A 2004-11-09 13:58 +0000 lusernam     1.1.2.1
ncp-beefy.awx

Record a date and time that falls between the last non-branch and the first
branch history entry.

        2004-11-09 13:55

Check out the approximated branch date/time:

        cvs -d /path/to/repository co -d tag_checkout_dir -D "2004-11-09
13:55:00" module_list

Create the tag

      cd tag_checkout_dir
        cvs tag MY_BRANCH_TAG_ORIGIN

I know this is a mouth full.  This is taken from notes I made at the time I
did it, so it is not necessarily organized well.

--- 
Kevin R. Bulgrien
Design and Development Engineer

General Dynamics C4 Systems
http://www.gdsatcom.com/




reply via email to

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