Completing the SubVersion Setup »
FERDY CHRISTANT - APR 3, 2006 (07:49:46 PM)
Some of you may be wondering how long I will continue to preach about SubVersion. Not for much longer, I promise. In fact, I think that today I realized my perfect home setup for version management.
Remember yesterday's screenshot? I installed WebSVN for online repository browsing and slightly customized the look & feel:

There was however still one thing bothering me. Creating a new repository required me to set up a SSH session and execute some commands. Therefore, I have extended the homepage of my WebSVN installation. I can now create a new repository directly from the homepage :)

No high tech extension this is. Here's how I did it:
- Edit the "index.tmpl" file in the "WebSVN/S3maphor3/templates" directory, where "S3maphor3" is the name of my customized style. Added the following HTML just below the table that lists the SubVersion projects:
<form method="POST" action="create.php">
<table align="center" border=0 cellspacing=0 cellpadding=0 width="50%">
<tr><th align="left" colspan=2 class="HdrClmnEnd">Create a new project</th></tr>
<tr>
<td class="row0">
<img align="middle" src="./templates/BlueGrey/repo.png" alt="[FOLDER]">
<input type="text" name="repos">
<input type="submit" value="Create">
</td>
</tr>
</table>
</form>
-
Create a new file in the "WebSVN" directory called "create.php", that contains the following script:
<?php
// this script automatically creates a repository in subversion, based on
// the repository name, which is passed in the post of the create form
if (isset($_POST["repos"])) {
exec('svnadmin create /svn/repos/' . $_POST["repos"] . ' 2>&1', $out, $err);
// redirect to repository overview
$host = $_SERVER['HTTP_HOST'];
$uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
$extra = 'index.php';
header("Location: http://$host$uri/$extra");
exit;
}
?>
The script is still a bit sloppy, it could use some error handling, and the repository parent path is hard-coded. Yet, it works like a charm and is suitable for my home setup. Note that for a more advanced integration with Subversion, beyond the command line, you can use the PEAR package for it. A sense of relief has overcome me, finally I have my LAMP exactly the way I want it. Now it is time to start using it :)
PS: Do not assume SubVersion is for PHP development in particular. It's a general purpose version management system, you can put any file under its control, be it your source code or perhaps your resume Word file. Just wanted to get that out of the way, in case people do not understand my excitement about it.


Comments: 4
Reviews: 2
Average rating:
Highest rating: 5
Lowest rating: 5
COMMENT: ADRIAN
MAR 11, 05:21:00 PM
COMMENT: DANY SCHIAVO
MAR 17, 2008 - 19:41:01
COMMENT: DEEPALI
APR 6, 2008 - 08:30:47 AM
I face this problem
after these command
Stopping CollabNet Subversion: httpd (no pid file) not running
[ OK ]
Starting CollabNet Subversion: (98)Address already in use: make_sock: could not bind to address [::]:3690
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:3690
no listening sockets available, shutting down
Unable to open logs
[root@localhost ~]# [FAILED] «
COMMENT: TONY
JUN 18, 2008 - 05:46:31 PM