Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set a property in SVN for a single revision of a single file

I've got a Subversion repository, and there are a number of users checking things in and out. However, I also need to frequently check in work for other people. I need to track the original author of the work.

I was considering creating a property in SVN, like "originalauthor", which could track this. In cases where it was empty, I could use the author. If it was filled in, I could attribute the changes appropriately.

However, I can't see a way to add a property that won't persist through multiple revisions. Similarly, there doesn't seem to be a way of using commit hooks to guarantee the "originalauthor" property will be removed if there's a commit which doesn't include it.

I could always rewrite the password file on the server to allow me to commit under their username and then restore the original password file, but that seems clunky (and doesn't let me track the fact that it was checked in on their behalf). Or I could create an additional user (so for every "User A" there's a "User A Proxy") which I could use to check in changes. Neither of these options seem appealing.

Any suggestions, or ideas?

like image 750
Chris B. Avatar asked Jan 24 '23 00:01

Chris B.


1 Answers

Subversion has two kinds of properties

  • Properties on a file or directory. These properties are versioned
  • Revision properties. These are specific to the reversion on which they apply.

The first type is only usefull if you want all versions of the file to be marked.

To mark a specific path the Subversion project itself adds the original author to the log message in a special format that is read by the contribulyzer script:

Patch by: Jan Jansen <[email protected]>

But if you have tooling available (and can assume subversion 1.5+) you could also use

svn commit --with-revprop "original-author=Jan Jansen <[email protected]>" 

to create a orignal-author revision property.

To retrieve the property you can then use svn log as:

svn log <...> --with-revprop original-author
like image 123
Bert Huijben Avatar answered Jan 31 '23 08:01

Bert Huijben