[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: How to find out the rev number where a file was deleted?

From: Les Mikesell <lesmikesell_at_gmail.com>
Date: Mon, 29 Nov 2010 13:16:32 -0600

On 11/27/2010 2:56 PM, Edward Ned Harvey wrote:
>> From: Les Mikesell [mailto:lesmikesell_at_gmail.com]
>>
>> I think a delete doesn't appear in a file's history - the file just no
> longer
>> appears in subsequent revisions. However a delete is a change in the
>> containing
>> directory. Does 'svn log -v' on the directory above show the changes in
> the
>> way
>> they happened?
>
> Right, the age-old point, "rm isn't a file operation. It's an operation on
> the directory that contains the file." This seems to suggest the answer to
> Paul's question is ... You can't svn log a file and find the rev where the
> file was deleted. This is confirmed below ... but it still doesn't explain
> the weird behavior...
>
> Still, this should at least produce some results: (as long as foo existed
> in rev 3)
> svn log -r 0:head file://${HOME}/trash/repo/foo_at_3
> svn: File not found: revision 5, path '/foo'
> It makes no sense for svn to complain about what's in rev 5. My query
> doesn't care about rev 5.

I think the principle was covered in another response, but the only way
you can get history is to start from the highest rev and follow
backwards, and you are asking it to start from head, which is impossible.

> Important to note below ... The rev where the file was deleted is not shown.
> This confirms "rm is not a file operation." And this does work, as long as
> the file was resurrected with the same name:
>
> svn log -r 0:head file://${HOME}/trash/repo/foo_at_3
> ------------------------------------------------------------------------
> r1 | root | 2010-11-27 08:12:20 -0500 (Sat, 27 Nov 2010) | 1 line
>
> added
> ------------------------------------------------------------------------
> r2 | root | 2010-11-27 08:12:32 -0500 (Sat, 27 Nov 2010) | 1 line
>
> changed a
> ------------------------------------------------------------------------
> r3 | root | 2010-11-27 08:12:45 -0500 (Sat, 27 Nov 2010) | 1 line
>
> changed b
> ------------------------------------------------------------------------
> r5 | root | 2010-11-27 08:27:33 -0500 (Sat, 27 Nov 2010) | 1 line
>
> resurected and renamed
> ------------------------------------------------------------------------
> r6 | root | 2010-11-27 08:28:44 -0500 (Sat, 27 Nov 2010) | 1 line
>
> renamed back to original

In this case the file does exist in head, and you wouldn't have to
specify the peg revision at all. Subversion can track the 'copy-from'
backwards and knows it is that same item. But the name isn't what ties
them together. You could just as easily have copied to a different name
in head and asked for the log with the new name there and you'd get the
same history.

-- 
   Les Mikesell
     lesmikesell_at_gmail.com
Received on 2010-11-29 20:17:13 CET

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.