tags:

views:

148

answers:

4

This is a follow on question to "How do I delete 1 file from a revision in SVN?" but because it probably has a very different answer and I believe that others would benefit from knowing the answer. (I don't know the answer yet.)

The previous question was answered and I discovered that that it is not possible to remove a revision from SVN. The second best solution was to remove the file from SVN, commit and then add the file back and commit again.

I now want to make sure that the original file's revision history has gone. So I am hoping that the answer to the question "How can I find the revision history of the file that was deleted and then resubmitted to SVN?" is that you can't.

+1  A: 

I would have said you can't - you have created a new file and thus revision tree in the eyes of SVN.

It may be possible to recover the old tree independently (not sure if you managed an actual delete or just SVN Delete) but there is no link between the old revision tree and the new one.

Graphain
+2  A: 

With a simple

svn log -v [folder]

you can browse quickly the adding and deletion.

------------------------------------------------------------------------
r14 | kame | 2008-08-29 04:23:43 +0200 (ven., 29 aoû2008) | 1 line
Chemins modifié :
   A /a.txt

Readded a
------------------------------------------------------------------------
r13 | kame | 2008-08-29 04:23:24 +0200 (ven., 29 aoû2008) | 1 line
Chemins modifié :
   D /a.txt

Delete a
------------------------------------------------------------------------
r12 | kame | 2008-08-29 04:23:06 +0200 (ven., 29 aoû2008) | 1 line
Chemins modifié :
   A /a.txt

svn log won't show the file, svn diff will pretend that the old revision does not exist, but a svn checkout targeting the old revision will happily give you the old file.

Damien B
+3  A: 

What makes you think that it is not possible to remove a revision from Subversion? The solution given to your other question (svndumpfilter) does exactly that (see the parameters --drop-empty-revs and --renumber-revs)! And when the revision is gone, there's obviously no way to get at the revision history, because it was never there in the first place.

Jörg W Mittag
+2  A: 

Short answer: you can

Long answer:

Unfortunately (for you but perhaps not for most folks) , the revision history for a deleted file is still there - it's just a little harder to get at.

Here's an example:

$ touch one
$ svn add one
$ svn ci -m "Added file one"
$ date >> one 
$ svn ci -m "Updated file one"
$ date >> one
$ svn ci -m "Updated file one again"
$ svn log file:///repos/one

------------------------------------------------------------------------
r3 | andrewr | 2008-08-29 12:27:10 +1000 (Fri, 29 Aug 2008) | 1 line

Updated file one again
------------------------------------------------------------------------
r2 | andrewr | 2008-08-29 12:26:50 +1000 (Fri, 29 Aug 2008) | 1 line

Updated file one
------------------------------------------------------------------------
r1 | andrewr | 2008-08-29 12:25:07 +1000 (Fri, 29 Aug 2008) | 1 line

Added file one
------------------------------------------------------------------------

$ svn delete one
$ svn ci -m "Deleted file one"
$ svn up
$ touch one
$ svn add one
$ svn ci -m "Adding file one back in"
$ svn log file:///repos/one

------------------------------------------------------------------------
r5 | andrewr | 2008-08-29 12:29:13 +1000 (Fri, 29 Aug 2008) | 1 line

add one back
------------------------------------------------------------------------

It looks like it works (the old history is gone), but if you request the file at older revisions you get the history of the deleted file.

$ svn log -r 3:1 file:///repos/one

------------------------------------------------------------------------
r3 | andrewr | 2008-08-29 12:27:10 +1000 (Fri, 29 Aug 2008) | 1 line

Updated file one again
------------------------------------------------------------------------
r2 | andrewr | 2008-08-29 12:26:50 +1000 (Fri, 29 Aug 2008) | 1 line

Updated file one
------------------------------------------------------------------------
r1 | andrewr | 2008-08-29 12:25:07 +1000 (Fri, 29 Aug 2008) | 1 line

Added file one
------------------------------------------------------------------------
AndrewR