views:

48

answers:

3

I would like to obtain all the versions of a given file in my SVN repository. For instance, let's say that the file ThirdPartyAssembly.dll was checked 3 times, is there a command that will get me all the version on my HD (e.g. ThirdPartyAssembly.dll.v1, ThirdPartyAssembly.dll.v2, ThirdPartyAssembly.dll.v3, etc.)?

Thanks!

+2  A: 

there is no command out of the box but you can build simple script that uses log -q command output.

zerkms@honeypot /var/www/cv $ svn log -q index.html
------------------------------------------------------------------------
r17 | zerkms | 2010-04-21 21:47:16 +1100 (Wed, 21 Apr 2010)
------------------------------------------------------------------------
r16 | zerkms | 2010-04-21 21:37:03 +1100 (Wed, 21 Apr 2010)
------------------------------------------------------------------------
r15 | zerkms | 2010-04-21 21:36:46 +1100 (Wed, 21 Apr 2010)
------------------------------------------------------------------------
r14 | zerkms | 2010-04-21 21:32:37 +1100 (Wed, 21 Apr 2010)
... etc

so you just need to parse first column in your favorite scripting language

after this just do:

svn copy http://server/full/path/to/file@14 file.rev.14

etc, for each revision and you will get bunch of file.rev.XX

zerkms
+2  A: 
  1. Right click with mouse on the selected file ThirdPartyAssembly.dll in your working copy on your HD, and a popup menu appears.

  2. From the popup menu choose on TortoiseSVN > Show log, and a window appears

  3. The window contains the list of ALL the checked in versions of your file

  4. RIGHT click mouse on the one that you want, a pop up menu appears.

  5. Form the popup menu choose "Save revision to..." and you can save it on your HD wherever you like.

Marco Demajo
I have 98 revisions of that file, is there a way to have a batch file doing that?
Martin
Thanks Marco! It's a good solution, but the "Save revision to..." isn't available when I select more than one revision.
Martin
@Martin: "I have 98 revisions..." I didn't know that, you were talking about 3/4 revisions in your question. I don't know then.
Marco Demajo
@Marco: I still like your solution! :) I will try to script it, otherwise I might do that one by one... :S
Martin
@Martin: isn't it more simple to script the CLI instead of GUI? :-S
zerkms
@zerkms: if it's not a long script could you write it out, I'm interested too. How do I call that script than from normal command Windows' shell? Thanks!
Marco Demajo
@Marco: i told about any scripting language that you have on the host system that you use: bash, bat, python, php, perl... i propose to use anything you OP has and anything he know how to program, but basing on CLI out (`svn log -q file`)
zerkms
@zerkms: sorry, i'm very ignorant in this subject. But is this command to be called on my local PC or it ha s to be called on the server hosting the repository? I downloaded TortoiseSVN, but I cant' find any svn.exe command on my machine.
Marco Demajo
tortoisesvn is exclusively GUI tool. it's sexy, but it's GUI. so you need to download SVN which contains command line tool svn.exe. in my answer i put sample output
zerkms
@zerkms: thanks I +1 your answer.
Marco Demajo
A: 

You could just run a diff command on each version to get CVS to generate copies of the old files. You could probably even script this if there are a lot of old revisions.

But that said, what exactly are you really trying to do here? Maybe there is a better way?

Justin Ethier
I am exactly trying to do what I said in the question. I need to get all the versions of a file (binary) on my machine. Thanks! :)
Martin