0

Is there any provision to parse svn comments along with date in source file...thank you in advance for your ideas

4
  • 5
    I don't understand what you mean Commented Dec 12, 2011 at 9:28
  • Actually i need to parse the svn comments or log message along with datewhen any cpp files are modified, to that particular cpp file itself during commit ,any ideas? Commented Dec 12, 2011 at 9:36
  • It sounds like you want to read each of the "commit" actions done in Subversion, and read from them the names of the files committed, and the datetime when it the commit was done. Is that correct? Commented Dec 12, 2011 at 9:48
  • sorry exactly i would like to Append SVN comments with following details in changed area of file (Comments entered,Date & Time,SVN ID) Commented Dec 12, 2011 at 10:01

2 Answers 2

1

Reading the other answers here and your comments, it reads like your trying to modify the source file during commit. This is actively discouraged; see http://svnbook.red-bean.com/en/1.5/svn.reposadmin.create.html#svn.reposadmin.create.hooks which has a big red warning box that states:

While hook scripts can do almost anything, there is one dimension in which hook script authors should show restraint: do not modify a commit transaction using hook scripts. While it might be tempting to use hook scripts to automatically correct errors, shortcomings, or policy violations present in the files being committed, doing so can cause problems. Subversion keeps client-side caches of certain bits of repository data, and if you change a commit transaction in this way, those caches become indetectably stale. This inconsistency can lead to surprising and unexpected behavior. Instead of modifying the transaction, you should simply validate the transaction in the pre-commit hook and reject the commit if it does not meet the desired requirements. As a bonus, your users will learn the value of careful, compliance-minded work habits.

However it sounds like what you really want to look at is svn:keywords. These allow you to embed metadata into the file at commit time. The only thing you can't do is embed the commit log message.

Effectively, this means you'd drop a line that contains this:

$Id$

into your source file, then set the property svn:keywords with a value of Id against that file, and SVN will auto-expand it on commit. There's a number of other special keywords as well; see http://svnbook.red-bean.com/en/1.5/svn.advanced.props.special.keywords.html for all the details on how to use these.

Sign up to request clarification or add additional context in comments.

8 Comments

i would like to append svn comments,id,date,author name in modified area of the file ,is this scenario possible?
Yes: see the discussion about svn:keywords in my answer, and that should answer that question. If it doesn't, and you've checked out the SVN manual that I've linked to, let me know what it is you don't understand.
yup i can understand, but this things should be automatically tracked into the file when it is modified and committed every time at the server side and should display them in client side (at that modified area of the file)
That's exactly what it does. On commit, SVN auto-expands the keywords so $Id$ turns into $Id: calc.c 148 2006-07-28 21:30:43Z sally $ within the source file (typically these are placed the header of the file). No, you can't prepend every modification within a file automatically with these. But users can use svn log or svn diff to see what the changes actually are. SVN provides you with all the tools, so I'm failing to see where the problem is. You need to explain why you're trying to achieve what you asking: unless we know the full picture, you're not going to get a better answer.
actually this is my project work.exactly i should track them in changed area of modified file...helps are appreciated
|
0

You have different options (awk, xml parser) to parse svn log: see "Ever need to parse the svn log for files committed by a particular user since a certain date?"

You have here an example of a Perl script using the --xml option (with svn info but you can apply the same idea to svn log), and the XML::Twig library.

1 Comment

Actually i need to parse the svn comments or log message along with date ,author name , svn id ,when any cpp files are modified, to that particular cpp file (near to that modified line) itself during commit ,any ideas?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.