When I started with subversion it was a bit chaotic for me to grasp the subversion repository software basics.
Since I know there are many other people like me who are a novice into suversion I decided to post few of the
life saving (vital) subversion commands, I learned and use quite often this days.
This post should be considered as a very very overview of subversion commands. For more information please check, The subversion red-bean book here .
So here we go:
1. First To create repository after installing subversion you need to execute something similar to:
debian-server:~# svnadmin create --fs-type fsfs /path/to/repos/repo
In the above example /path/to/repos is actually the path to where you store the svn repositories, and repo is actually the repository name.
By the way note that by default svnadmin would create the repository in the fsfs database format, even if you skip the,
fsfs option.2. Let’s say you want to import some code into the newly created repository located in /path/to/repo via the local filesystem.
Here is how:
# imports in the subversion repositorydebian-server:~# svn import -m "importing directory in svn over local filesystem"
~/directory_to_import/ files:///path/to/repos/repo/trunk
In the forementioned example the, -m and the following text: “importing directory in svn over local filesystem†is for description of the importing data,
the ~/directory_to_import/ is the directory you prefer to import into the local repository, the code left,
files:///path/to/repo/trunk specifies that you want to import the data into the repository subdirectory “trunkâ€.
Then again let’s assume that you want to achieve a file import into a newly created repository through ssh + the apache mod_dav_svn
It’s pretty easy the above should be changed to:
debian-server:~# svn import -m "importing directory in svn over mod_dav_svn e.g. (svn+ssh)"
~/directory_to_import/ svn+ssh://user@host/path/to/repos/repo/trunk
of course it preliminary that you input a proper user and host or ip address as you have previously configured the mod_dav_svn, then again svn+ssh specifies the protocol type.
Now as we have imported our program source code into the repository, next it’s important to checkout the code to have a current copy of the source code.
3. To checkout code already existing in some repository in your subversion server via (svn+ssh) protocol, you need to execute some command similar to:
debian-server:~# svn co svn+ssh://user@host/path/to/repos/repo/trunk ~/checkout_into_directory/
Here again as a first protocol argument (svn+ssh://) it’s necessery to enter path/to/repos/repo/trunk and as a second argument to gsvn (the subversion command line client interface) we put ~/checkout_into_directory/ , it’s a nice idea to to create the checkout_into_directory beforehead.
Now if we have to checkout the code after we’ve been logged in the system and the repository database is locally stored on the same server as we are, we have to execute:
debian-server:~# svn co files://path/to/repos/repo/trunk ~/checkout_into_directory/
Take a note that in the example above I use the root user but possibly you would choose a non-privileged user, therefore you should have properly set both physical user account permissons on the subversion repository database (e.g. chown your /path/to/repos/repo/ and put your local user into the proper /etc/groups).
Another truly precious command that you will probably need to use on daily and hourly basis would probably be:
4. The listing of repository content cmd, in order to do that while locally logged on the server with the svn repository execute:
debian-server:~# svn list file:///path/to/repos/repo/trunk
I believe the above command is self-explanatory enough, in case if you plan to do file listing within the svn repository over (ssh+svn) here is how:
debian-server:~# svn list --verbose svn+ssh://user@host/path/to/repos/repo/trunk
Again, I won’t take the time to explain since the logic in the syntax is equal to the one exhibited beforehead.
5. Another handy thing to do with your subversion repository content after checkout is the subversion source repository update
the svn update The checkout will enable you to always synchronize your ~/checkout_into_directory to the latest stable version of the code within your svn repository.
So after the first checkout it would be good idea to use svn update and update your repository project source tree.
So here is how:
debian-server:~# svn update ~/checkout_into_directory/
So now as I have shown most basic operations with subversion, Lest important to show you is
6. How to delete source from a repository in subversion.
In order to delete some part from your subversion repository project source from the local filesystem use:
debian-server:~# svn delete files:///path/to/repos/repo/track/some_directory
This command would completely erradidacate some_directory from your example repo. Yet if you desire to delete a file specify a file instead of the some_directory
Now to accomplish the same delete operation via (svn+ssh) execute something like:
debian-server:~# svn delete svn+ssh://user@host/path/to/repos/repo/track/some_directory
Once again I won’t bother to explain the above example code, cause I believe it’s clear enough for everybody to understand.
7. To reverse your project code to some stable release of your source code existing in the repository you should use something like:
debian-serve~:# svn checkout -r 4 files:///path/to/repos/repo/trunk
This would checkout the project source to it's 4th release from the repository: repo
8. To commit code with changes in your subversion repository use a command like:
debian-server:~# svn commit -m "Some description text" some_directory/
The svn command line interface is also capable of svn copy and svn rename in order to either,
copy or rename commited source, however I won’t get into details on that just experiment and you’ll quickly master them.
9. Now one last thing I’m gonna tell you about is the subversion svn info command and svn status . This really useful command should be used to check information on your source tree after you have either checked it out or have used svn update to have the latest copy of it. This is an absolute necessity.
Here is how to check the information assigned about the version release and some other useful info for your source tree.
debian-server:~# svn info ~/check_into_directory
or you might type svn info without arguments as well
debian-server:~# svn info
Yet another useful one on project status is:
debian-server:~# svn status
Enable Rsyslog and Syslog cron events logging in /var/log/cron.log on Debian Lenny
Friday, April 9th, 2010By default Debian doesn’t log it’s cron events in a separate log file.
All the cron events got logged along with all the other syslog events configured by default in either syslog or rsyslog.
So you end up with a /var/log/syslog which includes many versatile messages. That’s really unpleasent if you want to keep track of your cron events separately.
I always change this behaviour while configuring new servers or Desktop systems running Debian.
Therefore I decided to share here what I do to enable separate cron logging. The logged cron events would go to var/log/cron.log.
As a starter please make sure you have the file /var/log/cron.log existing on your filesystem tree, if you have it not then please create it:
debian:~# touch /var/log/cron.log
To configure your crond to log to /var/log/cron.log on a system running syslogd all you have to do is edit /etc/syslog.conf and either include the line:
cron.* /var/log/cron.log
or simply uncomment the same line already laying commented in the syslog.conf.
If you’re using the enhanced version of syslogd for Linux (Rsyslog) the code syntax that is necessery to be included is absolutely identical.
Again you have to include:
cron.* /var/log/cron.log
in /etc/rsyslog.conf or uncomment the line shown above in /etc/rsyslog.conf.
Now last step to do is to reload syslogd or rsyslogd.
With syslogd running on your system execute:
debian:~# killall -HUP syslogd
With rsyslogd as a default system logger:
debian:~# killall -HUP rsyslogd
Now you should have your crond logging to the separate /var/log/cron.log, wish you happy cron.log reading 🙂
Tags: configured, cron, Debian Lenny, default, filesystem, line, Linux Rsyslog, running, uncomment, var
Posted in System Administration | 2 Comments »