Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SVN: How to get the first revision of a file?

Tags:

svn

revision

When working with a subdirectory in a repository, how to find the revision when that specific directory has been added to the repository? By using "svn info http://.." I can find out when it was modified for the last time ("Last Changed Rev"), but I also need to find out the revision number of the commit when that directory (or file) was added for the first time (it's "first" revision).

I have been searching for that at the "SVN book", googling, but, obviously, I got no results.

Note: I need this for making a PHP script which downloads logs and stores them locally, just to make it clear and avoid "use tortoise/svnx/versions/you_name_it application" ;)

like image 837
Oliver Maksimovic Avatar asked Oct 27 '09 16:10

Oliver Maksimovic


People also ask

How do I find my svn revision history?

To find information about the history of a file or directory, use the svn log command. svn log will provide you with a record of who made changes to a file or directory, at what revision it changed, the time and date of that revision, and, if it was provided, the log message that accompanied the commit.

How do I checkout a specific revision in svn?

Click the revision button at top-right and change it to the revision you want. Then right-click your file in the browser and use 'Copy to working copy...' but change the filename it will check out, to avoid a clash.

How do I compare to previous version in svn?

If you want to see the difference between the last committed revision and your working copy, assuming that the working copy hasn't been modified, just right click on the file. Then select TortoiseSVN → Diff with previous version.

How do you find the difference between two svn revisions?

Display the differences between two paths. The ways you can use svn diff are: Use just svn diff'to display local modifications in a working copy. Display the changes made to TARGET s as they are seen in REV between two revisions.


1 Answers

You could use svn log, with a reverse revision range:

svn log -r 1:HEAD --limit 1 <REPO_URL> 
like image 129
Christian C. Salvadó Avatar answered Sep 27 '22 21:09

Christian C. Salvadó