Entries Tagged as Subversion
SVN and Squid
February 06, 2008 · 5 Comment s
We run a number of servers behind the scenes; Version Control (SVN), Trac, ColdFusion (dev and staging), Database (SQL Server, MySQL, PostgreSQL) ...
We've now deployed a proxy server in front of it all. In this case we've deployed Squid to act as a reverse proxy.
So, basically everything now goes through the Squid server, and it routes our requests based on the domain name requested.
It was all fairly straight forward to set up, except we encounted a slight problem when it came to committing changes back into SVN.
svn: Commit failed (details follow):
svn: MKACTIVITY of '/path/to/svn/repo/!svn/act/20b34b89-e624-0410-bfb9-b7cf8f28e335': 400 Bad Request (http://mydomain.com)
For the life of me I couldn't figure out what was going on. As well as the introduction of Squid, we had also upgraded SVN and Trac and I assumed it was the SVN upgrade that was causing the issue.
As it turns out, it was Squid. You have to make a slight change when you're using a proxy with SVN.
As they say, Read the F*%king Manual!!! http://subversion.tigris.org/faq.html#proxy
→ 5 Comment s Tags: Subversion · Squid
Updating the Status of a Trac ticket via a SVN commit
February 03, 2008 · 9 Comment s
One of the really nice things about the SVN/Trac combo is that when you commit changes to SVN, you can have the changeset update the status of a Trac ticket.
So, say the changes you have been working on, have tested, and are now committing back to SVN fix a specific ticket within Trac, and once you've made your commit, you would then log into Trac and close the ticket there.
You could also do this via the superb Mylyn integration if you're using Eclipse - which you should be :)
Well, how about updating the actual status when you do your commit? One action to rule them all, so to speak.
Well, this is possible, and here's how to do it.
The main reason for posting this, is that I've recently upgraded our Trac environment from 0.10 to 0.11 and I noticed the trac-post-commit was now broken.
The following is for Linux, so you'll need to Google for Windows.
Grab the trac-post-commit script
You need to pull the latest working version of the script from the Trac SVN repository.
svn export http://svn.edgewall.com/repos/trac/trunk/contrib/trac-post-commit-hook /my/svn/repo/hooks
Next rename the file you've just exported by sticking a ".py" on the end - it's a Python script.
Next make sure your post-commit script file is named appropriately (post-commit funnily enough) and make sure that execute permissions are set on the file. You know, chmod ugo+x post-commit
Edit the post-commit script
Next, edit your post-commit file and add the following line - this is the reason ours was broken.
TRAC_ENV=<span class='cc_value'>"/path/to/your/trac/env"</span>
Now add the following line, and this is the one that calls the trac-post-commit script
/usr/bin/python /path/to/hooks/trac-post-commit-hook.py -p <span class='cc_value'>"$TRAC_ENV"</span> -r "$REV
Just to be on the safe side of everything, just Apache a restart.
Commit Your Change
Now, from within Eclipse, when you want to commit your changes, you can now put the following in your comments (and you are filling in comments aren't you?????!!!???"
command #1
command #1,#2
command #1 & #2
command #1 and #2
The following commands are supported:
- close
- closed
- closes
- fix
- fixed
- fixes
The above will close the specified ticket number, in addition to adding the message you have specified.
Also, you can use the following commands:
- references
- refs
- addresses
- re
- see
The ticket numbers specific here are left as is, but the contents of the commit messages are added to their notes.
A quick example would be something like:
The changes made here fix #100, #102 and refs #85
This commit message will close tickets 100 and 102, and add the commit message to ticket 85.
→ 9 Comment s Tags: Trac · Subversion
Installing and Configuring SVN and Trac on Windows
July 19, 2007 · No Comments
At the risk of doing my company (Fuzzy Orange) out of business, I thought I would blog about how to set up SVN and Trac on Windows.
There has been a lot of discussion on this at the ScottishCFUG Google Group, and as much as I'd love to just say "Use Linux, it's easier", some folks aren't in that position.
So here it is:
Installing and Configuring SVN and Trac on Windows
Please leave comments, suggestions, questions, problems, etc here and I'll do my best to answer you.
→ No Comments Tags: Trac · Subversion
Version Control: You're a Fool if You Don't Use It
July 19, 2007 · 9 Comment s
We've been having a right good old natter on the ScottishCFUG Google Group, in particular about why Version Control is essential to all software development.
One of the group members asked:
All that you mention sounds very cool but i want to see what benefits it can bring a sole developer.
A reply by Alan Williamson, in my opinion, was so important I wanted to repeat it here.
and there in is the trap that many lone consultants/developers face; stop thinking of yourself as a single entity, but as a member of a team that, at present has only one member.
Alan also followed this up by stating:
I really don't know how anyone can work without version control and still claim to develop software. Bold statement? yes, but i stick by it.
I agree 100%. Any software development company who is without Version Control is ... well, it is appauling. Not only are they putting their clients at risking by not taking their business and indeed livihood seriously, but they are also inflicting damage to themselves by not making themselves as proficient as they could be, but they are also damaging their own reputation... I look on any software development firm who doesn't use Version Control as one who shouldn't be in this business. Calling them amateur, well I think I'm being rather generous.
In the past, when I've been the client, one stipulation I've also insisted on being in any contract is that the company doing the work has a Version Control system in place. If they didn't, end of conversation.
Even as a sole developer you should be using Version Control.
So, just to finish up, here's a couple of reasons why you should be using Version Control. Feel free to add more by leaving a comment.
- Provides a history of all changes
- Recover accidental deletions
- Helps co-ordinate new releases by deploying a build corresponding to a specific revision.
- Supports development by X number of developers
- Enables remote working if your repositories are public facing (and secure).
- It's not just for code. You can store all your contracts, legal documents, staff policies in Version Control.
→ 9 Comment s Tags: Subversion · Business · Development · Community
Using SVN to assist in commenting your code
July 18, 2007 · 9 Comment s
I'm quite heavy handed when it comes to commenting my code.
As well as inline comments, I always have a config comment at the top of every file.
In addition to basic information such as Author, Filename, when the file was created, I use Subversion to get information such as: the current revision, when was the file last updated, who updated the last file.
To automate the process, I have a CFEclipse snippet that is saved as a template (require separate ones for both CFM and CFC files). So when I create a new file, I create it from the template, and this runs the snippet automatically, prompting me to fill in certain information. You can see the snippet below.
<span class='comment'></span>
Once I commit this file to Subversion, the Subversion properties are populated, meaning I end up with something like below.
<!---
Filename: weatherProxy.cfc
Creation Date: 18/July/2007
Original Author: Andy Allan
Revision: $Rev: 45 $
$LastChangedBy: allana $
$LastChangedDate: 2007-07-18 12:24:59 +0100 (Wed, 18 Jul 2007) $
Description:
This is our proxy CFC, which in turn calls the Yahoo weather CFC as part of Ray Camden's Yahoo API package.
The component works by first being init'd, recieving a list of towns to which we have to retireve weather. At the moment this is passed in, but in time we will retrieve this information from a database as it will match all the locations for the company.
On init, we call getWeather() passing it the list of towns, and this method loops through the towns returning the weather data for each and storing in an Application
variable structure.
We then use getMyWeather() which accepts a town as an argument to return the weather data specfic to that town.
Methods:
init: This is our constructor method, which MUST be called before any other method. It takes a single
argument <span class='cc_value'>"datasource"</span> and returns itself.
getWeather: private function that loops through all the companies locations, getting their weather data and storing the data in an Application structure.
getMyWeather: method which returns the weather for a specific town.
--->
To get Subversion to actually populate your comments you need to assign a new property to every file/folder in your application.
You can either do this by running the following command:
propset -R svn:keywords <span class='cc_value'>"Rev LastChangedDate LastChangedBy"</span> /pathToFiles/trunk
Or from within CFEclipse, simply right click your Project folder and choose "Team" > "Set property" and then add the new property as indicated in the image below.
With every commit, you'll now see the most up to date Subversion information directly in your comments.
→ 9 Comment s Tags: ColdFusion · Subversion · CFEclipse
Woot - Trac up and running
August 23, 2006 · 21 Comment s
- Install Python - You must use Python 2.3.x - the Subversion bindings are not available for Python 2.4
- Copy the libsvn and svn folders in the Python Bindings to <python>\lib\site-packages
- Install PySQLite
- Extract neo_cgi.pyd from your Clearsilver download to <python>\lib\site-packages
- Install Trac
- Copy <python>\share\trac\cgi-bin\trac.cgi to <apache>\cgi-bin
- Edit the trac.cgi file so that the first line points to your python.exe file
d:\python23>python scripts\trac-admin d:/svn/trac.db
Initialise DB
Trac [d:/svn/trac.db]> initenv
Trac will now ask you for a Project Name, Database Connection String, Subversion Repository, and the Path to Templates
So as an example:
Project Name: Creative
Connection String: (just hit enter to accept default)
Subversion Repository: d:\svn\creative
Path to Templates: (just hit return)
Add Administrative Permissions
Trac [d:/svn/trac.db]> permission add admin TRAC_ADMIN
Add Trac to Apache
Edit httpd.conf:
# TRAC
Alias /trac <span class='cc_value'>"d:/Python23/share/trac/htdocs"</span>
<Location /cgi-bin/trac.cgi>
SetEnv TRAC_ENV <span class='cc_value'>"d:/svn/trac.db"</span>
SetEnv PYTHONPATH <span class='cc_value'>"d:/Subversion/bin"</span>
# if you are running Apache as a user other than System, the TMP variable
# needs to be set to a place where that user can write scratch files. Make
# sure that this directory is created and writable by that user.
# SetEnv TMP <span class='cc_value'>"d:/svn/trac.db/tmp
</Location>
<Location /cgi-bin/trac.cgi/login>
AuthType Basic
AuthName "</span>Creative<span class='cc_value'>"
AuthUserFile passwd
Require valid-user
</Location>
<Directory "</span>d:/Python23/share/trac/htdocs">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
Now you want to restart Apache.
Finally, hit http://yourdomain/cgi-bin/trac.cgi and log in via the username/password combinations you have set up in "passwd" for accessing Subversion.
Final Words
I know I've not covered everything, and I've certainly not mentioned any error messages you may potentially come across, but if you do have any issues, leave a comment here and I'll try and help out.
→ 21 Comment s Tags: Trac · Subversion
