Doug Lee wrote:
> I have often wished for an automatic way to check out all existing
> branches of a given module with one command.  Example:  If I have
> module mymod with HEAD and branches named rel1 and rel2:
> 
> mkdir cvs_co
> cd cvs_co
> cvs co -b mymod
> cd mymod
> ls  # would list HEAD (or head), rel1, and rel2, and probably CVS)
> 
> The -b option is of course ficticious.
You'd want to be careful with this, if the module has a lot of branches.

There is a minor problem: how do you determine which branches a module has?
Branches are not stored per-module, but per-file. I guess the easiest way is
to use one file which is most likely to have all the pertinent branches, and
pull all the branch tags out of that file. The most likely candidate would
be a file that's been around since project inception, such as makefile.

Something like this should do what you want:

cvs rlog -h module/makefile | grep -E '\.0\.[[:digit:]]+' | sed 's/:.*//' |
while read tag; do cvs co -d $tag -r $tag module; done

The rlog command gets the log for the file; -h gets only header info.
The grep command cuts that down to just the tags which have '.0.' followed
by a sequence of digits (these will be branch tags - see note below)
The sed command chops the : and the revision number, leaving only a
space-separated list of tags, which the 'while read' loop gobbles up and
issues a 'cvs co' command for each tag, placing it in a directory named
after the tag.

Note that this will not handle vendor branches (from a cvs import) - the
revision number is a different format (an odd count of numbers, e.g. x.y.z
or u.v.w.x.y, as opposed to a non-vendor branch which ends in .0.x). You'd
have to rewrite the regex for grep to handle this. I'm not good enough at
regex to do that :=)

-- 
Jim Hyslop
Senior Software Designer
Leitch Technology International Inc. ( http://www.leitch.com )
Columnist, C/C++ Users Journal ( http://www.cuj.com/experts )


_______________________________________________
Info-cvs mailing list
Info-cvs@gnu.org
http://lists.gnu.org/mailman/listinfo/info-cvs

Reply via email to