You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Kylo Ginsberg <ky...@gmail.com> on 2008/05/22 15:08:51 UTC

How to identify revision where a file was deleted?

If I know a file existed at some revision in the past, R, and know it
was subsequently deleted, what is the best practice for identifying
the revision in which it was deleted?

I'm aware that I can run "svn log -r<R>:HEAD" on a directory above the
level of the deleted file and parse the log output to answer the
question.  But this is a bit cumbersome.  Is there another way?

Thanks
Kylo

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

RE: RE: RE: How to identify revision where a file was deleted?

Posted by Brian Erickson <er...@BAUERCONTROLS.com>.
This came up for me several months ago.  I'm currently using 1.4.6 on a
Windows XP box.

I came to that conclusion that, without scripting, there is no another
way.  Furthermore, if the file no longer exists because the folder was
deleted, parsing the log can be very tedious and error prone.

Here is the script I came up with...Windows batch file.  Not very speedy
but it got me the answer I needed.
Can't guarentee that it's bug free but it worked enough for me...and
handles both cases where a file was deleted or a folder.

Brian


@echo off
if .%1 equ . goto usage
if .%2 equ . goto usage
if .%3 equ . goto usage

for /f "tokens=1,2*" %%I in ('svn info %2') do (
   if /I .%%I equ .revision: set revision=%%J
)

echo/
echo Searching for revision where %1 was deleted...
echo    Check starts at revsion %3 and may go as high as %revision%
set lastgoodrev=

for /L %%I in (%3, 1, %revision% ) do (
   for /f "tokens=1,2* delims=:" %%K in ('svn info --revision %%I
%2/%1@%%I 2^>^&1' ) do (
      if /I "%%K" equ "http" (
         goto done
      ) else (
         set lastgoodrev=%%I
      )
   )
)

Echo %1 was not deleted!
goto exit

:not_found
echo/
echo %1 doesn't exist at revision %3
goto exit

:Usage
echo %0 - [file] [url] [start rev]
echo Where:
echo    file = qualified file to search for (no leading slash or drive
letter )
echo/
echo    url  = url to Check
echo/
echo    start rev = Starting revision number.
echo/
echo Ex: %0 mydir/include/thisfile.h http://server/repo/trunk 653
echo/
echo        Repetitively executes:
echo            svn info --revision x
http://server/repo/trunk/mydir/include/thisfile.h@x
echo        where x is the revision being checked.
goto exit

:done
if "%lastgoodrev%" equ "" goto not_found

set /A delrev=%lastgoodrev% + 1
echo ...%1 was deleted in revision %delrev%
echo/

:exit  

-----Original Message-----
From: Reedick, Andrew [mailto:jr9445@ATT.COM] 
Sent: Thursday, May 22, 2008 4:22 PM
To: Kylo Ginsberg; users@subversion.tigris.org
Subject: RE: RE: How to identify revision where a file was deleted?

> -----Original Message-----
> From: Reedick, Andrew
> Sent: Thursday, May 22, 2008 4:13 PM
> To: Kylo Ginsberg; users@subversion.tigris.org
> Subject: RE: How to identify revision where a file was deleted?
> 
> > -----Original Message-----
> > From: Kylo Ginsberg [mailto:kylo.ginsberg@gmail.com]
> > Sent: Thursday, May 22, 2008 11:09 AM
> > To: users@subversion.tigris.org
> > Subject: How to identify revision where a file was deleted?
> >
> > If I know a file existed at some revision in the past, R, and know
it
> > was subsequently deleted, what is the best practice for identifying 
> > the revision in which it was deleted?
> >
> > I'm aware that I can run "svn log -r<R>:HEAD" on a directory above
> the
> > level of the deleted file and parse the log output to answer the 
> > question.  But this is a bit cumbersome.  Is there another way?
> >
> 
> Peg revisions.  If you know the file existed in Rev 1234, then:
> svn log --limit 1 -r HEAD:1234 svn://server/repos/a/b/c/foo.java@1234
> 
> This worked for me in 1.4.5.
> 


I used the wrong filename for my test.  It doesn't work.  Sorry for the
spreading of false hope and the corresponding spurious spike in the
world happiness coefficient.  =/




*****

The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential, proprietary, and/or
privileged material. Any review, retransmission, dissemination or other
use of, or taking of any action in reliance upon this information by
persons or entities other than the intended recipient is prohibited. If
you received this in error, please contact the sender and delete the
material from all computers. GA625



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org


RE: RE: How to identify revision where a file was deleted?

Posted by "Reedick, Andrew" <jr...@ATT.COM>.
> -----Original Message-----
> From: Reedick, Andrew
> Sent: Thursday, May 22, 2008 4:13 PM
> To: Kylo Ginsberg; users@subversion.tigris.org
> Subject: RE: How to identify revision where a file was deleted?
> 
> > -----Original Message-----
> > From: Kylo Ginsberg [mailto:kylo.ginsberg@gmail.com]
> > Sent: Thursday, May 22, 2008 11:09 AM
> > To: users@subversion.tigris.org
> > Subject: How to identify revision where a file was deleted?
> >
> > If I know a file existed at some revision in the past, R, and know
it
> > was subsequently deleted, what is the best practice for identifying
> > the revision in which it was deleted?
> >
> > I'm aware that I can run "svn log -r<R>:HEAD" on a directory above
> the
> > level of the deleted file and parse the log output to answer the
> > question.  But this is a bit cumbersome.  Is there another way?
> >
> 
> Peg revisions.  If you know the file existed in Rev 1234, then:
> svn log --limit 1 -r HEAD:1234 svn://server/repos/a/b/c/foo.java@1234
> 
> This worked for me in 1.4.5.
> 


I used the wrong filename for my test.  It doesn't work.  Sorry for the
spreading of false hope and the corresponding spurious spike in the
world happiness coefficient.  =/




*****

The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential, proprietary, and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from all computers. GA625



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org


RE: How to identify revision where a file was deleted?

Posted by "Reedick, Andrew" <jr...@ATT.COM>.
> -----Original Message-----
> From: Kylo Ginsberg [mailto:kylo.ginsberg@gmail.com]
> Sent: Thursday, May 22, 2008 11:09 AM
> To: users@subversion.tigris.org
> Subject: How to identify revision where a file was deleted?
> 
> If I know a file existed at some revision in the past, R, and know it
> was subsequently deleted, what is the best practice for identifying
> the revision in which it was deleted?
> 
> I'm aware that I can run "svn log -r<R>:HEAD" on a directory above the
> level of the deleted file and parse the log output to answer the
> question.  But this is a bit cumbersome.  Is there another way?
> 

Peg revisions.  If you know the file existed in Rev 1234, then:
svn log --limit 1 -r HEAD:1234 svn://server/repos/a/b/c/foo.java@1234

This worked for me in 1.4.5.



*****

The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential, proprietary, and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from all computers. GA625



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org