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

Add subversion rev number in committed file

From: CAVAILLES Philippe <Philippe.CAVAILLES_at_egis.fr>
Date: Tue, 5 Aug 2008 14:09:17 +0200

Hello,
Does someone know if it is possible to add the subversion revision
number in committed files?

I have tried to use a pre-commit hook script. I succeed to extract the
revision number (by using svnlook) and the list of updated/added files,
but I don't knows how to modify the "committed" files with the extracted
revision number before termination of the commit action.

Here is the (pre-commit) script I have written:
------------------------------------------------------------------------

---
#!/bin/sh
REPOS="$1"
TXN="$2"
SVNLOOK=/usr/bin/svnlook
commit_list=`$SVNLOOK changed  -t $2 $1`
prev_word=""
new_commit_list=""
for word in $commit_list
do
 # only Added and Updated files are taken into account
  if [ "$prev_word" = "A" ] || [ "$prev_word" = "U" ]
 then
   # only .c and .h should be processed
    if [ ${word#*.} = "c" ] || [ ${word#*.} = "h" ]  
    then
      new_commit_list="$new_commit_list $repos/$word"
    fi
  fi
  prev_word=$word
done
for word in $new_commit_list
do
  cp $word /tmp
 /bin/sed "s/^-- VERSION:.*/-- VERSION: $vers/" /tmp/`basename $word` >
$word
done
------------------------------------------------------------------------
---
Kind regards,


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: users-help_at_subversion.tigris.org

Received on 2008-08-05 17:55:11 CEST

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.