Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to checkout a specific Subversion revision from the command line?

People also ask

How do I checkout a svn repository in CMD?

Open the SVN server, right-click on the repository and select the copy URL to clipboard (for the VIsualSVN server) and paste it on the command line. User credentials will be the same as what we set at the time of user creation. After every successful checkout operation, the output will print a revision number.

How do I checkout a file in svn?

So we right-click on this folder and select 'SVN Checkout…' From here we'll specify the location of the repository that we want to check our files out from. So something like… If you've forgotten what this URL is then you can go back to the VisualSVN server app and right click to select 'Copy URL to Clipboard'.


If you already have it checked out locally then you can cd to where it is checked out, then use this syntax:

$ svn up -rXXXX

ref: Checkout a specific revision from subversion from command line


Either

svn checkout url://repository/path@1234

or

svn checkout -r 1234 url://repository/path

Any reason for using TortoiseProc instead of just the normal svn command line?

I'd use:

svn checkout svn://somepath@1234 working-directory

(to get revision 1234)


You should never use TortoiseProc.exe as a command-line Subversion client! TortoiseProc should be utilized only for automating TortoiseSVN's GUI. See the note in TortoiseSVN's Manual:

Remember that TortoiseSVN is a GUI client, and this automation guide shows you how to make the TortoiseSVN dialogs appear to collect user input. If you want to write a script which requires no input, you should use the official Subversion command line client instead.

Use the Subversion command-line svn.exe client. With the command-line client, you can

  • checkout a working copy in REV revision:

    1. svn checkout --revision REV https://svn.example.com/svn/MyRepo/trunk/

    2. svn checkout https://svn.example.com/svn/MyRepo/trunk/@REV

  • update your local working copy to REV revision:

    svn update --revision REV

  • export (i.e. download) a file or a development branch in REV revision:

    1. svn export --revision REV https://svn.example.com/svn/MyRepo/trunk/

    2. svn export https://svn.example.com/MyRepo/trunk/@REV

You may notice that with svn checkout and svn export you can enter REV number as --revision REV argument and as trailing @REV after URL. The first one is called operative revision, and the second one is called peg revision. Read SVNBook for more information about peg and operative revisions concept.


svn checkout to revision where your repository is on another server

Use svn log command to find out which revisions are available:

svn log

Which prints:

------------------------------------------------------------------------
r762 | machines | 2012-12-02 13:00:16 -0500 (Sun, 02 Dec 2012) | 2 lines

------------------------------------------------------------------------
r761 | machines | 2012-12-02 12:59:40 -0500 (Sun, 02 Dec 2012) | 2 lines

Note the number r761. Here is the command description:

svn export http://url-to-your-file@761 /tmp/filename

I used this command specifically:

svn export svn+ssh://[email protected]/home1/oct/calc/calcFeatures.m@761 calcFeatures.m

Which causes calcFeatures.m revision 761 to be checked out to the current directory.