In Subversion, there are two types of properties:
- File Properties: These are properties associated with a file. They are revisioned as if they are part of the file itself.
- Revision Properties: These are properties associated with individual revisions. There can only be one of each type of property per revision. They are not versioned, so changing a revision property will lose the historic information about the old information. As a safety precaution, you cannot change a revision property without first creating a pre-revprop-change hook that allows you to do it.
On top of that, are three special revision properties associated with each revision that are rather important:
svn:log
: This is the commit message
svn:date
: This is the date and time the commit was done.
svn:author
: This is the user who did the commit.
So, the question is what are you trying to do. If you want to add a comment to a file, you can add a file property to that file. However, that's considered a file change, so you will have to do a checkout, svn pset
and then a commit which creates a new revision on that file.
If you want to add a new comment to a particular revision in your repository, you don't have to create a new revision to do it. However, you'll have to create a pre-revprop-commit
hook file that allows you to make these modifications. You have two ways of doing this:
- Modify
svn:log
with your comment This is probably the easiest way. However, changes in the commit messages aren't logged, so you lose the original commit message in the process. The advantage is that this comment will display automatically with the svn:log
command.
For example:
$ old_comment=$(svn pget -r 100 -revprop svn:log http://myhost/svn/repos)
$ new_comment="$old_comment
> ================ COMMENT ON REVISION ================
> This was a change needed for a particular customer"
$ svn pset -r 100 --revprop svn:log "$new_comment"
- You can also create a new revision property that contains you comments. For example
corp:comment
(I use corp
to signify special properties related to my company). You can display these comments in the svn log
message, but only in xml format.
For example:
$ svn pset --revprop -r 100 foo:comment "This was a change needed for a particular customer" http://host/svn/repos
Now, when you do your log, you can see that comment:
$ svn log --with-revprop foo:comment --xml -r 100 http://host/svn/repos
<?xml version="1.0"?>
<log>
<logentry
revision="100">
<revprops>
<property
name="foo:comment">This was a change needed for a particular customer</property>
</revprops>
</logentry>
</log>