1

I'am new to SVN, and I can't find a solution to make "after commit" update a specific txt file. I have a php project, within changelog.txt inside the root folder (at the same level where index.php is located). What I want is that after each svn commit, my changelog.txt will be updated with some information by looking like this:

*** YYYY-MM-DD HH:MM by SVN_USERNAME
SVN_COMMIT_MESSAGE
-------------------------------------------------
*** 2010-09-22 18:31 by marco.belinni
- eshop category navigation - fixed issue with navigation, due overcaching with previous version of seo tool
-------------------------------------------------
*** 2010-09-20 01:03 by jean.laroche
- plg_c16n - fixed canonicalization with SEO Plugin which redirects non www urls to www urls
- mod_login - fixed ie and ff login, hidded input type "remember me" with checked paramater
- the whole frontpage have bolded text because of bolded "READ MORE" button - need to clean it before posting any article
- eshop browse - 10products per page FIXED by clearing cache and purged ALL urls
- eshop orderby - removed useless "SELECT" option in selection field for sorting out the items on page
-------------------------------------------------

I tried to find some info but there was a plenty websites showing the exemples with C++ programming. Is there any other solution to use only SVN and PHP ? As I'am not even a newbie in C++.

UPDATED

Here is a visual to show you where my changelog.txt is:

- web
 |- framework
 |  + engine
 |  + framework
 - web
   + css
   + images
   | index.php
-->| changelog.txt

Thanks

aspirinemaga
  • 3,753
  • 10
  • 52
  • 95

1 Answers1

1

I'm going to assume your changelog is stored in SVN itself. In which case, stop right there. You cannot update a file that's stored in SVN after committing, because it will then need committing, which will trigger the update that makes it need committing... you get the idea.

You can happily write data to a new file and use that however, simply create a file called post_commit in the hooks directory and put some script in it (and script language you like) to call svn log, pipe the output to your changelog file.

gbjbaanb
  • 51,617
  • 12
  • 104
  • 148
  • No no, i need to change `changelog.txt` in another location. I've updated the question to show you my folder structure where that changelog file is located... concerning script language - can I use **PHP** ? – aspirinemaga Aug 31 '12 at 12:35
  • @aspirinemaga - The problem is that your Subversion hook runs on the Subversion repository server, so it can't update files the server has no access to. Unless your `changelog.txt` file happens to be located on your Subversion server (or you can use `ftp` to move it there), you're going to have problems. If this is part of your build, you're better off generating the `changelog.txt` as part of your _build process_. – David W. Aug 31 '12 at 14:21
  • @aspirinemaga : if the changelog is part of the commit, you still cannot do it even if its on the client, for the same reasons. David W has the right approach - use svn log to build/append the log to a file that is not art of the commit. Yes, you can use php (most people use perl so their hooks are .pl files in the hooks directory) if php won't run .php script files automatically, just put "php myphpscript.php" in the post-commit hook. – gbjbaanb Sep 02 '12 at 21:30
  • Thank you so much guys! I'am already working on it, and things get clearer and clearer. Thanks again for your tips. – aspirinemaga Sep 03 '12 at 07:06