SVN Importanct Commands

1). The examples used in this appendix assume that you have svn, the Subversion command-line client, and svnadmin, the administrative tool, ready to go on a Unix-like operating system.

2). Subversion stores all versioned data in a central repository. To begin, create a new repository:
$ cd /var/svn
$ svnadmin create repos
$ ls repos
conf/ dav/ db/ format hooks/ locks/ README.txt

3). Your project's tree structure should contain three top-level directories named branches, tags, and trunk. The trunk directory should contain all of your data, and the branches and tags directories should be empty:

4). Instead of talking of "filepath" for these virtual directories, svn uses the terminology URL. The URL must be prefixed to indicate how the repository should be accessed. That's why we have the file:// prefix. We will see other examples later. For the moment let's play with the virtual directory structure.

5). Creating and removing directory in SVN folder:
$ svn mkdir file:///home/user/svn/foo -m "Created dumb directory"
Committed revision 1.
$ svn ls file:///home/user/svn
$ svn rm file:///home/user/svn/foo -m "Removed dumb directory"
Committed revision 2.
$ svn ls file:///home/user/svn

6). Show the log of the SVN : svn log file:///home/user/svn

7). Importing the local project : $ svn import /path/to/project/ file:///home/user/svn/project/trunk -m 'Initial import'
Note : A couple remarks. The -m flag is used to give a log message for the action.

8). Checking Out the project :
Code : $ svn checkout file:///home/user/svn/project

9). To get the info of the SVN : $ svn info

10). To get the status of the project : $ svn status or $svn st

11). To add the file : $ svn add filename/foldername

12). To commit the file : $ svn commit filename/foldername -m "Message" "OR" $ svn ci filename/foldername -m "Message"

13). Checking Out the project : svn checkout -r 4 file:///home/user/svn project "OR" svn co -r 4 file:///home/user/svn project

14). To get the copy of previous version : svn checkout -r version_numer file:///home/user/svn project
Note: The version_number is replaces by the version number which we want to import.

15). To delete the file : svn rm foldername/filename

16). To rename the file : svn rename foldername/filename new_folder_name/new_file_name

17). To get the help of SVN : svn help

19). svn revert undoes all changes under the current directory

20). svn update fetches all changes that were committed from another working directory;

21). svn diff displays the differences between the files under the current directory and the last version of these files that were committed.