Find the last commit for editing a file



Using the svn command line, I would like to find the last commit that touched a file. Here it is in pseudo-code:

svn log -v --search my-file.txt --first-match

What I have tried:

svn log -v --search my-file.txt -l 1

Unfortunately, this only searches the most recent commit. It doesn't return the first match.

svn log my-file.txt -v -l 1

Subversion complains that:

svn: E155010: The node 'C:\Users\my.user\Documents\SubversionSvn\MyDir\my-file.txt' was not found.

svn log svn://

Svn complains that:

svn: E160013: File not found: revision 427, path '/svn/path/to/my-file.txt'

Just get the log of the file and limit it to the first (most recent) entry:

svn log my-file.txt -v -l 1

If the file was in your repository but was deleted, you'll need to pass a peg revision so SVN knows what file you're asking about:

svn log [email protected] -v -l 1

Here, the peg revision is 3511 which is the last revision where the file existed before it was deleted from the repository. However you've already answered your question once you've found this number.

If the file was never in the repository (it isn't now, based on your errors), then this isn't a question that SVN can answer for you.