Demo Joomla! 1.5

Visit the Joomla! 1.5 demo site to see my extensions live running

Demo Joomla! 2.5

Visit the Joomla! 2.5 demo site to see my extensions live running

Support

Do not submit a bug report if you need technical support or have questions.

Forums

Post your suggestions ask for help in the community forums

Wiki

Visit the Wiki extensive and up to date documentation at your fingertips.

Contact Me

Missing images/links, any comments, suggestions, need help? Contact me

Skype

Need desperately help?
Skype Me™! But dont abuse of it!

Joomla development, correct usage of subversion

User Rating:  / 0
PoorBest 

JoomlaLogo I am developing for Joomla! now since the beginning but I was always disturbed by
the way people are using the code repository of Joomla! (www.joomlacode.org).
I am doing professional java development but was never able to reproduce the way
I am working nor really did take the time to really do it correctly (help by the fact that I
was developing always alone). Things changes... and now I am part of the effort of
bringing JoomlaComment to run natively in Joomla! 1.5 in a team of 3 people.

What people are doing, most of the time, is committing the code they write to Joomla
SVN/CVS in a flat way, it is just a set of files, or sometime even only the deliverable
(a set of zip that user can install)

So these kind of subversion layout are not uncommon

A set of files A set of directory containing just different code version and code exploded Just one version exploded in root
securityimages5.0.0.zip
securityimages4.3.2.zip
plugin4.3.3.zip
/securityimages5.0.0
/securityimages4.3.2
/plugin4.3.3
file1.php
file2.php
layout A layout B layout C

 

All of these layout are highly not efficient...The point of SVN/CVS
is to  compare and synchronize code easily (you merge code nearly 40% of your time
as a developer), and resolve code conflicts. SVN only store differences so sync is fast
and repository size is very low.


Subversion® is an open-source version control system. Subversion® allows developers to share
there projects on the repositories, where they are stored afterwards. Repository is much similar
to a file server, except the fact, that it not only stores the copy of the file system, but its previous
states and changing history. Subversion® access its repositories using network, so it provides a
probability for a person to work over some shared files and watch for every possible changes made
by other developers.

With all of the above layout A, B or C, the code committed is not connected to the runtime
where you are developing!

The developer runtime is a running Joomla instance, and developer change their code directly
in the file system of Joomla!. If you work in a group, you'll be force to connect another project
with the layout  A, B or C and merge code change manually from the local Joomla! instance to the shared
directory.

 

Recommended SVN layout

I am now using the recommended SVN layout:  /trunk /tags /branches

Trunk is a main (head) line of development. That's where you share your project and do initial commit.
The code in trunk is considered not stable or in development. Usually nobody  should commit code which
break the trunk (to know it there is nothing else better than regression testing and continuous build server)

Tag
is a snapshot of the project state. You can create a tag of the one specified revision or a tag, containing
resources of different revisions. Tags are a kind of specific labels for a set of files each with its own revision
number. Used to track the important events if project's life cycle.

Branching means creating a new line of development on the repository location. This may be useful in
a different cases, for example if different clients wish to get the same product but with some differences
in functionality. Of course it's not convenient to create both products from the beginning to the end
separately, so the developers create branches. Branches are the additional lines of development.
Used when branching for different versions from one initial is needed or when each developer has his
own development line and plan.

I recommend you using Eclipse PDT (free),  So I have created 2 new PHP project in eclipse:
securityimages4 (Joomla! 1.4) and securityimages5 (Joomla! 1.5). For eaxmple securityimages5

  • Contains Joomla 1.5.3, my code is sometimes highly dependent on a specific Joomla API version,
    or may break if Joomla! release a new version, so it has to be tested against some specific version of it
  • Has the latest version of securityimages installed  (5.0.0Rc1)
  • Has a MYSQL dump securityimages.sql which create a DB securityimages4 with its data, so anybody can have
    a running environment just by doing a checkout from trunk
  • Has an ANT build file, more on it later.

 

This project is fully versioned (so even Joomla! and MYSQL dump). What could be disturbing at first but make sense
to version also the container (Joomla!) where your code run.

Carefully commit

While working in a team, not all file has to be committed to /trunk

The configuration.php for example is a default one (mine), anybody can make change but shall not commit it to the trunk! ->
Not all developer use XAMPP at the same location or may use another DB user (this is another topic among a team of developer:
standardize developer environment). I've commit dummy login/password for administrator panel is admin:admin
The login for MYSQL in  configuration.php is root: empty.

Development

When I develop, alone or in a team, I do daily before every change a Team synchronize on project securityimages4 in order
to see what has changed or who has done what and on which lines.

I it highly recommended not to update without looking at what is coming from SVN, so anybody can give give feedback on
code quality better if you look at it), you get update from the trunk, or commit your new code change to the trunk.

As soon as I have no visible bug and all functionalities, I create a new release

Create a new release

When I want to make a new release, I launch in eclipse an ant build  (right click – run as ant build on / securityimages4/build.xml)

This create the deliverable (a component zip or N files as zip with a version number) that I can publish/version also in another project
or NOT version at all since I can at any time load a project tag of securityimages4 and recreate the deliverable build!

The deliverable are what I publish on my site.

The ANT build file look like:

   1:  <?xml version="1.0" encoding="UTF-8"?>
   2:  <project name="securityimages" default="_build">
   3:  <description>Create a new release of joomla component</description>
   4:   
   5:  <property name="workspace.dir" value="." />
   6:  <property name="component.version" value="5.0.0RC2" />
   7:  <property name="component.name" value="securityimages" />
   8:   
   9:  <property name="destination.dir" value="c:\temp\${component.name}-${component.version}" />
  10:   
   2:  <project name="securityimages" default="_build">
0
   2:  <project name="securityimages" default="_build">
1
   2:  <project name="securityimages" default="_build">
2
   2:  <project name="securityimages" default="_build">
3
   2:  <project name="securityimages" default="_build">
4
   2:  <project name="securityimages" default="_build">
5
   2:  <project name="securityimages" default="_build">
6
   2:  <project name="securityimages" default="_build">
7
   2:  <project name="securityimages" default="_build">
8
   2:  <project name="securityimages" default="_build">
9
   3:  <description>Create a new release of joomla component</description>
0
   3:  <description>Create a new release of joomla component</description>
1
   3:  <description>Create a new release of joomla component</description>
2
   3:  <description>Create a new release of joomla component</description>
3
   3:  <description>Create a new release of joomla component</description>
4

Its purpose it to build a new deliverable in one click without going through the file system over and over.

I also version the project securityimages5 with the same version number, so I can then continue developing in trunk.

 

Branching an existing release

If someone report an issue, lets say in securityimages5.0.1.zip and code in /trunk is too far away in trunk or still unstable
to be released, I make a branch on project securityimages5 

I load the tag version 5.0.1 of the project securityimages5  in my eclipse workspace (Team replace with - tags) and open
a branch (Team – open branch)  and this project is now suddenly similar to another trunk:

  • A branch is not unique and is reacting like a trunk
  • The tag 5.0.1 still exist and is read only
  • I can now can commit new code in the branch (= to a trunk)
  • The main /trunk still exist and is not touched

When all issues are solved, after many commit to the branch (= to a trunk), I version the branch with a …. Tag, for example
5.0.2  which is a normal tag and represent a new stable state in the lifetime of the software.

Nasty back porting

Somehow a bug in version 5.0.1 has a lot of chance of also being in the latest version (the code in /trunk). So I am forced to
load the trunk (= current code) and make Team – compare with – another branch – tag version - 5.0.2 and back port all code
changes in trunk if it make sense.

Remember a tag should never be change, it is possible to overwrite tag, but this should occur 0.000001% of the developer lifetime.
A tag is a freeze code status from the past and the past can not be change ;-)

Joomla Releasing new versions

Joomla release a new version? I install the new version of Joomla! in my eclipse project securityimages5 If securityimages still
work, nice! if not I make changes for that version of Joomla! and create a … new tag of securityimages.

 

Conclusions

 

You are now able to compare the trunk with any working/non working versions (tag or branches) of the past. See what has committed what
and where in the file system of Joomla! and this by using the merging client of Eclipse SVN/CVS client which is way more efficient than any diff
for merging code. This were before with version directory in Subversion (SVN/CVS) not possible. 

You might also like:
Announcing Module nimbus for all users of Phil Taylor Joomla
818 days ago
Announcing Module nimbus for all users of Phil Taylor Joomla
I am a very happy user of Joomla! tags from Phil Taylor. My only complaints is that it is still not
Content plugin for Joomla! 1.5 to embed Freemind Mind Map in
818 days ago
Content plugin for Joomla! 1.5 to embed Freemind Mind Map in
I offer You now a new plug-in for Joomla! 1.5 that allow you to display any Freemind Mind Map usi
Joomtwitter a twitter module for Joomla!
970 days ago
Joomtwitter a twitter module for Joomla!
Twitter is a free service that lets you keep in touch with people through the exchange of quick, fre
Adding Google Analytics to Atlassian JIRA
1091 days ago
Adding Google Analytics to Atlassian JIRA
As I found no better tutorial on Internet, here is a very very short how to add Google analytics to
blog comments powered by Disqus
Parent Category: Joomla
Category: Development

Donations

Thank You for supporting my work

Follow Me

Follow cedricwalter on Twitter Subscribe via RSS Subscribe via RSS Follow us on Facebook Follow us on Google+

Latest Articles

  • Thanks to Nathan Rennie-Waldock. you can have the latest PHP5 5.3.10 running in Ubuntu Oneiric, Natty, Maverick and Lu... ...
  • Download and install the latest  VMware Player 4.0.2 to run this Virtual Appliance “Ubuntu 11.10 x64 Server” ... ...
  • Download and install VMware Player 4.0.2 to run this Virtual Appliance “Ubuntu 11.10 x64 Server” Ready to user st... ...
  • Thanks to Ondřej Surý,  maintainer for some Debian packages, you can have the latest PHP5 maintained by Debian ... ...
  • Munin is a networked resource monitoring tool that can help analyze resource trends and "what just happened to ki... ...

Latest Comments

Popular Posts

rockettheme advertisement

dropbox logo

Help Us & Leave Feedback!

  • Do you have an excellent article idea you would like to read about here? Share it!
  • Do you have some interesting tips how we could improve our site?
  • Something missing here? Help us make this blog a better place, leave feedback!
We would love to hear from you! Be active! Write us now!

Blogs

Didier Beck Tech Head Brothers

google+ badge