Using Git with eZ Publish projects

In my spare time I've been hanging out with a bunch of Ruby/Rails people. They are a fun bunch however they don't seem to like it when you point out that MVC existed well before Rails. One thing that have put me onto is Git.

Git is a distributed revision control / software configuration management project. You may have heard of it, Linus Torvalds (that clever guy behind Linux) wrote it to manage kernel development. There is plenty to read about it on Wikipedia

So I check it out svn co http://svn.projects.ez.no/ezapprove2/ezapprove2/ezp4/trunk/extension/ezapprove2 to investigate if it meets the requirements.

As part of this process I notice some bugs and being a good open source user I fix them, however I can't commit them back to the repository as I'm not a member of the project (I've applied). I've got other things to do and probably won't remember to commit the changes when and if my membership is approved. I've posted most the the patches to the forums in case anyone is looking at using it.

Git allows for distributed revision control, effectively I can have a local repository and make local commits. git-svn also allows for the sync a local git repository with a subversion one.

Here is what I've done so far...I'm new to this so any git experts out there I'm happy to hear any pointers from you!

Install git

I use kubuntu so installation was pretty painlesssudo apt-get install git-core git-svn git-gui

Check out the revision I want from subversion$ git-svn fetch -r2500 A sql/mysql/schema.sql A ezinfo.php A settings/module.ini.append.php A settings/collaboration.ini.append.php A settings/design.ini.append.php A settings/extendedattributefilter.ini.append.php A settings/workflow.ini.append.php A settings/ezapprove2.ini.append.php A settings/site.ini.append.php A translations/ger-DE/translation.ts A translations/nor-NO/translation.ts A INSTALL.txt A doc/upgrade/UPGRADE_0.1-0.2 A doc/upgrade/UPGRADE_0.2-0.3 A doc/upgrade/UPGRADE_0.3-0.4 A doc/upgrade/UPGRADE_0.4-0.5 A doc/upgrade/UPGRADE_0.5-0.6 A doc/upgrade/UPGRADE_0.6-0.7 A doc/upgrade/UPGRADE_0.7-0.8 A doc/changelogs/CHANGELOG_0.1-0.2 A doc/changelogs/CHANGELOG_0.2-0.3 A doc/changelogs/CHANGELOG_0.3-0.4 A doc/changelogs/CHANGELOG_0.4-0.5 A doc/changelogs/CHANGELOG_0.5-0.6 A doc/changelogs/CHANGELOG_0.6-0.7 A doc/changelogs/CHANGELOG_0.7-0.8 A eventtypes/event/ezapprove2/ezapprove2type.php A collaboration/ezapprove2/ezapprove2collaborationhandler.php A modules/ezapprove2/ezapprovefunctioncollection.php A modules/ezapprove2/function_definition.php A modules/ezapprove2/select_approver.php A modules/ezapprove2/view_approve_list.php A modules/ezapprove2/module.php A modules/ezapprove2/add_approver.php A design/standard/templates/notification/handler/ezcollaboration/view/ezapprove2/author.tpl A design/standard/templates/notification/handler/ezcollaboration/view/ezapprove2/approve.tpl A design/standard/templates/collaboration/handlers/view/full/ezapprove2.tpl A design/standard/templates/collaboration/handlers/view/line/ezapprove2.tpl A design/standard/templates/collaboration/message/view/element/ezapprove2_comment.tpl A design/standard/templates/workflow/eventtype/edit/event_ezapprove2.tpl A design/standard/templates/workflow/eventtype/view/event_ezapprove2.tpl A design/standard/templates/workflow/eventtype/ezapprove2/view_approve_list.tpl A design/standard/templates/workflow/eventtype/ezapprove2/add_approver.tpl A design/standard/templates/workflow/eventtype/ezapprove2/select_approver.tpl A classes/ezapprove2event.php A classes/ezapproveextendedfilter.php A classes/ezxapprovestatususerlink.php A classes/ezxapprovestatus.phpr2500 = 2528a77b6478e87833cc59e376965dbc03b5d775 (git-svn)

Now I want to create a local branch so I can distinguish which are my changes$ git status# On branch masternothing to commit (working directory clean)$ git checkout -b code_reviewSwitched to a new branch "code_review"$ git status# On branch code_reviewnothing to commit (working directory clean)

Now I can fix the bugs add new files and commit locally

There was an issue in the default node plain view template which is used by the collaboration preview. To fix this I added a file ( design/standard/templates/node/view/plain.tpl ) to the extension that fixes the issue.$ mkdir -p design/standard/templates/node/view$ vi design/standard/templates/node/view/plain.tpl$ git status# On branch code_review# Untracked files:# (use "git add >file<..." to include in what will be committed)## design/standard/templates/node/nothing added to commit but untracked files present (use "git add" to track)

Like with subversion I had to add the new directory before I can make the commit to the git repository.$ git add design/standard/templates/node$ git status# On branch code_review# Changes to be committed:# (use "git reset HEAD >file<..." to unstage)## new file: design/standard/templates/node/view/plain.tpl#$ git commit -m'fixed "Placed in:" for items previously unpublished' design/standard/templates/node/view/plain.tplCreated commit 0cc675c: fixed "Placed in:" for items previously unpublished1 files changed, 45 insertions(+), 0 deletions(-)create mode 100644 design/standard/templates/node/view/plain.tpl

So now we have made the change and have a local commit. I can go ahead and fix the bugs that I find, making local commits as I go. I can see the changes by checking the git log.

Having a Sys Admin background I'm more of a cmd line person so the lack of gui it's a real issue for me.

There are two issues that git solves for me, the offline commits, and subversion bridging. Both Bazaar or Mercurial support offline commits but I've been unable to quickly find information about subversion bridging.

In the preface to the current Admin interface specification the last paragraph caught my eye:A overview of user task need a dashboard, where she can follow here own content, approval and other tasks she might do on a regular basis.I recently saw a demo of the latest version of the bug tracking system JIRA 4.0 by Atlassian. It used an OpenSocial dashboard to allow users to customise their homepage to access and interact with information that was important to them. The system not only displays JIRA widgets but any OpenSocial widgets (and those from other Atlassian products). You can check out a video of it in action here and more information on how Atlassian is using OpenSocial here.

What is OpenSocial? From the official site:OpenSocial defines a common API for social applications across multiple websites. With standard JavaScript and HTML,
developers can create apps that access a social network's friends and update feeds. Google personal home page is an example of an OpenSocial da…

The following presentation was given on 24 July 2012 to the DevOps Brisbane group. Some of the technical detail about Vagrant is outdated but I think it provides a good overview of why moving to a "Infrastructure as code" setup makes a lot of sense.