Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you get the history of a file/folder property in SVN?

Tags:

What's the easiest way to determine when a property was set on a file or folder? Basically, I'm looking for an equivalent of "svn blame" that works on properties.

The log subcommand enables one to get the complete history of a file or folder, including when the properties have been modified. However, it doesn't distinguish between a property modification and other types of modification, which of course also means that it won't tell you anything about the history of a particular property.

The status command differentiates between properties and other types of modifications, but only works on the working copy.

Blame, itself, only supports files, not directories, and it works on the content, not the properties.

Ideas?

like image 510
mr. w Avatar asked Aug 04 '09 23:08

mr. w


People also ask

How do I find previous versions in svn?

Using the latest versions of Subclipse, you can actually view them without using the cmd prompt. On the file, simply right-click => Team => Switch to another branch/tag/revision.

How do I view svn logs?

Examples. You can see the log messages for all the paths that changed in your working copy by running svn log from the top: $ svn log ------------------------------------------------------------------------ r20 | harry | 2003-01-17 22:56:19 -0600 (Fri, 17 Jan 2003) | 1 line Tweak.


2 Answers

The best I can think of is to write a little script or app that uses the svn propget command to dump the current property value to a text file, and then walks back through the revisions dumping the property to another text file and comparing the two. As soon as it detects a change, it prints out the revision number (actually the later revision number that made the change) along with the user who committed it.

Here's an example command to dump the svn:ignore property for the dictionary directory at revision 80:

svn propget -r 80 svn:ignore dictionary 
like image 87
Don Kirkby Avatar answered Oct 05 '22 23:10

Don Kirkby


One way to get a list of when properties for a given folder has changed is:

svn log -v . |grep "   M /trunk/datacenter$" -B2 

Which gives the following output:

r963 | someuser | 2013-08-26 20:32:37 +0200 (Mon, 26 Aug 2013) | 4 lines Changed paths:    M /trunk/datacenter -- r908 | someotheruser | 2013-08-15 12:15:03 +0200 (Thu, 15 Aug 2013) | 1 line Changed paths:    M /trunk/datacenter -- r413 | someuser | 2013-04-26 09:02:08 +0200 (Fri, 26 Apr 2013) | 1 line Changed paths:    M /trunk/datacenter 

Then you can look at each revision to see what changed:

$ svn diff -c963 

at the bottom:

...  Property changes on: . ___________________________________________________________________ Modified: svn:ignore ## -22,3 +22,5 ##   .idea  .classpath + +dev-config.groovy 

Cons:

  • No way to specify which property you're interested in
  • Tedious

Note: not sure -B2 is sufficient in all cases, as the line " M /trunk/datacenter" might not be the first line

like image 26
rlovtang Avatar answered Oct 06 '22 01:10

rlovtang