Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 611743
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:49:02+00:00 2026-05-13T17:49:02+00:00

I have a number of modules in CVS with different tags. How would I

  • 0

I have a number of modules in CVS with different tags. How would I go about getting the name of the branch these tagged files exist on? I’ve tried checking out a file from the module using cvs co -r TAG and then doing cvs log but it appears to give me a list of all of the branches that the file exists on, rather than just a single branch name.

Also this needs to be an automated process, so I can’t use web based tools like viewvc to gather this info.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T17:49:03+00:00Added an answer on May 13, 2026 at 5:49 pm

    I have the following Korn functions that you might be able to adjust to run in bash. It should be apparent what it’s doing.

    Use get_ver() to determine the version number for a file path and given tag. Then pass the file path and version number to get_branch_name(). The get_branch_name() function relies on a few other helpers to fetch information and slice up the version numbers.

    get_ver()
    {
        typeset FILE_PATH=$1
        typeset TAG=$2
        TEMPINFO=/tmp/cvsinfo$$
    
        /usr/local/bin/cvs rlog -r$TAG $FILE_PATH 1>$TEMPINFO 2>/dev/null
    
        VER_LINE=`grep "^revision" $TEMPINFO | awk '{print $2}'`
        echo ${VER_LINE:-NONE}
        rm -Rf $TEMPINFO 2>/dev/null 1>&2
    }
    
    
    get_branch_name()
    {
        typeset FILE=$1
        typeset VER=$2
    
        BRANCH_TYPE=`is_branch $VER`
    
        if [[ $BRANCH_TYPE = "BRANCH" ]]
        then
            BRANCH_ID=`get_branch_id $VER`
            BRANCH_NAME=`get_tags $FILE $BRANCH_ID`
            echo $BRANCH_NAME
        else
            echo $BRANCH_TYPE
        fi
    }
    
    
    
    get_minor_ver()
    {
        typeset VER=$1
    
        END=`echo $VER | sed 's/.*\.\([0-9]*\)/\1/g'`
        echo $END
    }
    
    get_major_ver()
    {
        typeset VER=$1
    
        START=`echo $VER | sed 's/\(.*\.\)[0-9]*/\1/g'`
        echo $START
    }
    
    is_branch()
    {
        typeset VER=$1
        # We can work out if something is branched by looking at the version number.
        # If it has only two parts (i.e. 1.123) then it's on the trunk
        # If it has more parts (i.e. 1.2.2.4) then it's on the branch
        # We can error detect if it has an odd number of parts
    
        POINTS=`echo $VER | tr -dc "." | wc -c | awk '{print $1}'`
        PARTS=$(($POINTS + 1))
    
        if [[ $PARTS -eq 2 ]]
        then
            print "TRUNK"
        elif [[ $(($PARTS % 2)) -eq 0 ]]
        then
            print "BRANCH"
        else
            print "ERROR"
        fi
    }
    
    get_branch_id()
    {
        typeset VER=$1
    
        MAJOR_VER=`get_major_ver $VER`
        MAJOR_VER=${MAJOR_VER%.}
    
        BRANCH_NUMBER=`get_minor_ver $MAJOR_VER`
    
        BRANCH_POINT=`get_major_ver $MAJOR_VER`
    
        echo ${BRANCH_POINT}0.${BRANCH_NUMBER}
    }
    
    get_tags()
    {
        typeset FILE_PATH=$1
        typeset VER=$2
    
        TEMP_TAGS_INFO=/tmp/cvsinfo$$
    
        cvs rlog -r$VER $FILE_PATH 1>${TEMP_TAGS_INFO} 2>/dev/null
    
        TEMPTAGS=`sed -n '/symbolic names:/,/keyword substitution:/p' ${TEMP_TAGS_INFO} | grep ": ${VER}$" | cut -d: -f1 | awk '{print $1}'`
        TAGS=`echo $TEMPTAGS | tr ' ' '/'`
        echo ${TAGS:-NONE}
        rm -Rf $TEMP_TAGS_INFO 2>/dev/null 1>&2
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a number of modules that I would like to store in my
In our company, we have a number different modules constructed as separate wars. Each
I'm going to have to write a number of vba modules for a project
I have a Python script that uses built-in modules but also imports a number
I have a traditional maven setup with parent project and a number of modules
I have a number of tests failing in the following JUnit Task. <target name=test-main
I want to have a number of files imported in a general python file
I have a variable number of modules linked to another module via a signal
I have some directories with a number of hidden files. One example of this
I have a class that has a number of modules that are mixed in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.