[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Get tag (not revision) into C & perl programs

From: Talden <talden_at_gmail.com>
Date: 2006-12-14 21:29:10 CET

On 12/15/06, Andy Levy <andy.levy@gmail.com> wrote:
> On 12/13/06, j.j.green <j.j.green@shef.ac.uk> wrote:
> >
> > Hi
> >
> > I'm a recent refugee from PRCS and am kind of stuck on a problem.
> > PRCS has major/minor version keywords which I can get into my
> > programs easily:
> >
> > /* $Format: "#define PROJECT_VER_MAJ $ProjectMajorVersion$" $ */
> > #define PROJECT_VER_MAJ 5
> > /* $Format: "#define PROJECT_VER_MIN $ProjectMinorVersion$" $ */
> > #define PROJECT_VER_MIN 39
> >
> > and then I have my programs print
> >
> > This is program (version 5.39)
> >
> > when they operate verbosely. I get that for subversion I need to use
> > tags to hold the human-readable release-version, and these are
> > disconnected from the revision. I guess that I will need to do some
> > scripting in order to get a release version into my C & perl programs.
> > Im thinking a script that
> > - pulls a release-version.txt file from the repository
> > - read and increments the version in that file to "5.30"
> > - checks the file back in
> > - checks out a C header and writes the release-version as a #define RELVER
> > 5.30
> > - checks the file back in
> > - creates the tagged release as tags/program-5.30
> >
> > This is OK for C. But I have around 60 perl programs which use the same
> > PCRS mechanism:
> >
> > # The version: $Format: my "\$version = \"$ProjectVersion$\";"$
> > my $version = "5.39";
> >
> > So this is going to get cumbersome. I've searched around but can't find
> > a slick way to do this. I've seen the FAQ on getting the revision into C,
> > but I'm after insertng the *tag*
> >
> > I'd be most grateful for suggestions
>
> Unlike CVS and some other version control systems, tags in Subversion
> are nothing more than copies. The "difference" is in the significance
> that the user applies to the contents/names in the tags directory.
>
> So, if you want to do this, I think you're looking at doing some
> path-reading and parsing to update the file contents.

For any folder intended solely to be a container for tags or branches
you could set a property indicating it's role.

A script could then walk up to find if it's in a tag or branch...
otherwise it's in the trunk

EG "folder_type" and values "tags_container" or "branches_container"

so in

.../
  tags/
     releases/
     milestones/

releases and milestones would have the property "folder_type" set and
interrogating it would show if it's a tag or a branch. Of course to
populate the file with this information you do still need to write a
script to walk the path interrogating SVN and do token replacement in
the file.

Using this mechanism, identifying if it's a release or a milestone is
equally simple.

--
Talden
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Thu Dec 14 21:29:58 2006

This is an archived mail posted to the Subversion Users mailing list.