Simon Holywell

Posts tagged git

Moving to git and setting up InDefero as a web frontend

git Logo

Most of our development is done on Vista desktops (although I also run Ubuntu of course) and we wanted a web interface for easy browsing of code so I needed to use a pervasive and well supported VCS. After much hunting around and looking at Bazaar, Mercurial and git I decided to go with the latter due to its support in the community.  There are still some reservations I have against git, which work well for Linux kernal development but not our day to day web development – the major one being that subversion would allow you to commit and update on a file by file basis where as git versions the entire repository at once as far as I am aware.

Anyway now I have an Ubuntu server that I am using for storing the repositories and as a pretty frontend I have installed InDefero which also allows us to manage tickets.  InDefero is much like the code.google.com forge to manage and look at it so it is very simple.  I like Trac but I was not happy with the existing integrations with git.

It was not all plain sailing with the InDefero install as I had to make some very minor changes in the git plugin’s core code (the git plugin comes as part of InDefero and does not need to be installed seperately).  Basically the plugin was creating new repositories with very strict permissions which meant that the neither my backup user nor the apache process user could access them.  What this meant from the frontend was that the repository statistics (disk usage) were not displayed because it could not stat the directories and my back up process could not open them to make backups.

This problem is caused by the use of permissions setting in a PHP mkdir() command in the src/IDF/Plugin/SyncGit/Serve.php on lines 94 and 193.  You will want to increase the file permission octal just enough for your other users to gain access.  It is also worth mentioning that on line 111 there is a umask() command which you might also wish to tweak to improve your access.  Also don’t forget to update all $pluf_path values in the files in the scripts directory.  The rest of the way you should be fine just following the included documentation in doc/syncgit.mdtext

So far I am enjoying using InDefero though I think I will need to hack it so that when you add a new repository/project all the users names are placed in the project members as default to save vast amounts of copying and pasting.  Our development team is not large enough to warrant only giving certain people access to certain repositories/projects.

[UPDATE] I have made a small (and nasty) hack to the source of InDefero to cause the members text area when creating a new project to be pre-filled with my member’s names.  This involved changing /src/IDF/Form/Admin/ProjectCreate.php on line 107 by setting the array element initial to the value you want to appear in the text area.

For our desktop access to git we are using msysGit, PuTTY Plink and TortoiseGit.  This combination is working well for us so far and means that even non-technical users can begin versioning their documents and push them to a central repository for backup purposes.

Using phing for good - Unfuddle Add Repository and SVN Import Tasks

As you may be aware I have recently been playing with the excellent Agavi framework and it introduced me to the interesting phing tool.  Phing can be used to automate tasks with build files that are close to interoperable with Apache Ant, which uses XML files to configure builds.  The advantage phing has for us PHP users is that it is entirely written in PHP so extending it is as simple as adding a new class.

On a few recent projects I did just that when I need the ability to perform SVN Import and access Unfuddle’s API to create a new repository on the fly.  Essentially my build file was creating a new website using a CMS and then creates a new repository for it and imports the newly built CMS automatically.  This was all written to use Unfuddle’s SVN but the add repository task should be able to be used to create a new git repository as well.  The Unfuddle side of things was completed with refactoring and building upon David Winterbottom’s work, which was originally intended to send Unfuddle messages.

Please find the code hosted on github in my phing repo.