Tuesday, January 18, 2011

SVN startup and Commands

Startup

SVN stands for subversion and it is a very useful tool for parallel development of an application. If you are developing a software application with collaboration with other developers, then it is a good idea to use SVN to develop parallel because all the burdens and hassles to manage and create consistency of the files is done by it.

The concept of SVN is to distribute files to users from a central file, i.e. all the controls is carried out by central server, so, although, the files are modified by multiple programmers, the actually managing is carried out by the server. Different from the central file server, the SVN actually keeps the file versions so that it is easy for developer to track the files to find out the changes in files, so it is called version control.

As stated earlier, to use SVN, we first of all, need SVN server which carries out the tasks file management. So, you can make your computer to work as SVN repository so that you can use it as SVN testing server. For that, do the following steps:
1) Create a directory. I created temp_repos directory under /home/krishna/tmp
2) Run the below command
     svnadmin create /home/krishna/tmp/temp_repos
This new repository uses the default FSFS database layer.
3)Run the following command for confirmation:
svn info file:///home/krishna/tmp/temp_repos


The above command will print below information:
Path: temp_repos
URL: file:///home/krishna/tmp/temp_repos
Repository Root: file:///home/krishna/tmp/temp_repos
Repository UUID: db10e1a4-0059-44d6-8a0f-289514cf4bb9
Revision: 0
Node Kind: directory
Last Changed Rev: 0
Last Changed Date: 2011-01-18 23:09:24 +0100 (Tue, 18 Jan 2011)

Now we can use the above mentioned URL as repository.
Note: We do not need to start SVN server to use in this way, and we can use it locally.


If we want to run SVN to be accessible by remote computers, we must run the SVN server using the following command:
svnserve --daemon --root /home/krishna/tmp/temp_repos
Now you can access this repository using svn URLs.
svn info svn://svnhostname
The default access is readonly, but we can change the access by changing the file
/home/krishna/tmp_repos/conf/svnserve.conf
Similary, we can create and assign the users in that file by using the passwd file in the location. The file is readable and we can easily understand where to modify in the file.


Commands:

The commond commands for SVN are shown below:
(Note: the commands help can be obtained by typing svn --help)
The command summary is shown below:
add
blame (praise, annotate, ann)
cat
changelist (cl)
checkout (co)
cleanup
commit (ci)
copy (cp)
delete (del, remove, rm)
diff (di)
export
help (?, h)
import
info
list (ls)
lock
log
merge
mergeinfo
mkdir
move (mv, rename, ren)
propdel (pdel, pd)
propedit (pedit, pe)
propget (pget, pg)
proplist (plist, pl)
propset (pset, ps)
resolve
resolved
revert
status (stat, st)
switch (sw)
unlock
update (up)


In linux, I could not actually remove the SVN repository connection to the local working directory. So, one way of doing, although it would be cumbersome, to deleted all .SVN folders. So, there is a shortcut command in linux which removes the all .SVN files:
find . -iname ".svn" -print0 | xargs -0 rm -r

No comments:

Post a Comment