Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

GIT source code variables question?

by lwicks (Friar)
on Apr 14, 2008 at 13:37 UTC ( [id://680277]=perlquestion: print w/replies, xml ) Need Help??

lwicks has asked for the wisdom of the Perl Monks concerning the following question:

Dear monks,
I have been using Git and PerlCritic on recent projects. Which brought me around to this question, in PBP there is a recommendation to use a Revision Control System, specifically that seems to suggest putting RCS variables into your source like:
 $Id$
So far I have not managed to find good simple guidance on how best to do this and make it work properly/usefully. Can any of the brotherhood of monks assist?

Kia Kaha, Kia Toa, Kia Manawanui!
Be Strong, Be Brave, Be perservering!

Replies are listed 'Best First'.
Re: GIT source code variables question?
by rjbs (Pilgrim) on Apr 14, 2008 at 14:47 UTC
    Basically, there is no automated way to do this. Git revisions are not guaranteed to increment, so you'd end up with the SHA1 identifier of the commit rather than a number. Further, unlike in Subversion, your git checkout is identical to the content in the repo. There is no munging of the content on checkout like there is with Subversion, which is what allows keyword expansion.

    I suggest disabling the policy. I use Perl::Version's perl-reversion script to keep track of my actual released versions. It's not as exact as a git identifier, but it's good.
    rjbs
Re: GIT source code variables question?
by kyle (Abbot) on Apr 14, 2008 at 13:56 UTC
Re: GIT source code variables question?
by tachyon-II (Chaplain) on Apr 14, 2008 at 13:48 UTC
    RCS CVS Subversion

    RCS et al can put special strings for identification into your source code. When you place the marker $Id$ into your code (for instance inside a comment) RCS will replace this marker with a string of the form:

    $Id: filename revision date time author state $

    When you use RCS/CVS/Subversion you check out files from a repository, work on them, and check them back in. Each time you check the files back in the $Id$ string is automatically updated. If you introduce a bug you can roll back the changes to an earlier version or do a diff between the old working version and the new buggy version. The concept is called source control and RCS/CVS/Subversion are implementations of this.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://680277]
Approved by Old_Gray_Bear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2024-03-28 23:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found