How do I identify what branches exist in CVS?

Olle Hallin picture Olle Hallin · Feb 19, 2009 · Viewed 34.7k times · Source

I have a legacy CVS repository which shall be migrated to Perforce.

For each module, I need to identify what branches exist in that module.

I just want a list of branch names, no tags. It must be a command line tool, for scripting reasons.

For example (assuming there is a cvs-list-branches.sh script):

$ ./cvs-list-branches.sh module1
HEAD
dev_foobar
Release_1_2
Release_1_3
$

Answer

user332325 picture user332325 · May 4, 2010

As a quick hack:) The same stands true for rlog.

cvs log -h | awk -F"[.:]" '/^\t/&&$(NF-1)==0{print $1}' | sort -u

Improved version as per bdevay, hiding irrelevant output and left-aligning the result:

cvs log -h 2>&1 | awk -F"[.:]" '/^\t/&&$(NF-1)==0{print $1}' | awk '{print $1}' | sort -u