Monday, June 1, 2015

SVN : check out a specific version a file

There are occasions where you want to check out a specific version of a file.
I use an example below to show how to do this:
1. Get log info
$ svn log rtma.sh > log_record
$ cat log_record

------------------------------------------------------------------------
r267 | dxu | 2015-03-30 21:23:27 +0000 (Mon, 30 Mar 2015) | 1 line
------------------------------------------------------------------------
r63 | jator | 2014-05-07 18:38:30 +0000 (Wed, 07 May 2014) | 1 line
------------------------------------------------------------------------
r61 | jator | 2014-04-30 19:22:16 +0000 (Wed, 30 Apr 2014) | 1 line
------------------------------------------------------------------------
r54 | jator | 2014-04-14 17:22:15 +0000 (Mon, 14 Apr 2014) | 1 line

2. Check out specific versions
$ svn  cat  -r   267 rtma.sh  > abc267     # check out latest  version
$ svn  cat  -r   63   rtma.sh  > abc63       # check out a previous version
$ svn  cat  -r   61   rtma.sh  > abc61       # check out a previous version
$ svn  cat  -r   54   rtma.sh  > abc54       # check out a previous version
$ sstatus
$ diff  abc267   abc63
$ diff  abc267   abc61
$ diff  abc267   abc54



# Revert to a previous version
# way 1 
$ mv   abc54    rtma.sh
$ svn commit -m"balah..."   rtma.sh



# way 2 
$ svn update  -r   54   rtma.sh

No comments:

Post a Comment