folder and repo structure

Asked by Mathieu Schiffmann on 2011-12-29


first, i'm new to VCS and bzr.
I spent all my time in the last week on searching a solution for my needs.
I tested a lot with Bazaar explorer on Windows and tried to focus my web searches on bazzar related topics.
All of this done i still have not idea how to construct my developping ressources in order to make things easier for me.

My work starts on an existing CMS. i need to follow the changes made by the developper of this CMS.
I write modules affecting various folders within the CMS, in some rarely cases a module can affect an existing file of the CMS but mostly files and folders are only added by my module.
I also write themes for this CMS. Themes can be considered as isolated folders and do not affect any ather existing files in the CMS.
Finaly i also do some initial configurations within some files located in the CMS. i call these hacks.

Let me give you an example to describe what i'm expecting

assuming the following folder structure
+ cms.version.x
| + includes
| | - functions.php
| | - lib.php
| + modules
| | + news
| | | - index.php
| + themes
| | + default theme
| | | + templates
| | | | + News
| | | | | - index.html
+ modules
| + mymodule
| | + includes
| | | - functions.php
| | + modules
| | | + mymodule
| | | | - index.php
| | + themes
| | | + templates
| | | | + mymodule
| | | | | - index.html
+ hacks
| + includes
| | - lib.php
+ releases
| + release1
| | + includes
| | | - functions.php (the most recent revision)
| | | - lib.php (the most recent revision)
| | + modules
| | | + news
| | | | - index.php (FROM CMS CORE)
| | | + mymodule
| | | | - index.php (FROM mymodule)
| | + themes
| | | + default theme
| | | | + templates
| | | | | + News
| | | | | | - index.html (FROM CMS CORE)
| | | | | + mymodule
| | | | | | - index.html (FROM mymodule)

What i expect is :
- Having a dedicated versionning for each of my modules, themes and hacks and also the core files.
- Whole releasing localy by having merged the corefiles with all modules, themes and hacks.
- Module releasing by having only the files of the module folder.
- Checking out a customer production site from an existing release.

I'm sorry to post such a basic question. What i learned about CVS and bazaar allows me to handle very well a single project folder, but i could not figure out how to have a multi project repository with code libraries allowing me to merge into releases.

I also looked at things like scmproj but what i understood is that it is only batching core bzr commands so i prefered to understand how things work. This said i gave a look and tested scmproj to see the resulting structures, but i also failed in building the structure i expect.

Perhaps my way to work manualy the past years is wrong and i schould consider a new approach.

Question information

English Edit question
Bazaar Edit question
No assignee Edit question
Solved by:
Mathieu Schiffmann
Last query:
Last reply:
Martin Packman (gz) said : #1

> first, i'm new to VCS and bzr.

My first thought is if you're new to versioning your code, you should start simple rather than trying to construct a complicated complete solution.

I guess the arrangement you have currently comes from your current workflow which I guess involves copying code around as poor man's version control, and some need to independently swap out modules and themes?

The most basic option I can see is to just version all the components in one branch, perhaps tag individual component versions as needed, then for your 'release' structure, do a branch then update and revert subdirectories as needed. That way you can get some of the benefit of keeping incremental changes without having to completely change how you work, or bend the vcs over backwards to adapt to your old habits.

Mathieu Schiffmann (movix) said : #2

Thank you for your answer Martin.
Yes indeed i copy code around and i hope changing this with bazaar.

So you're solution is what i also testet, but perhaps not the right way.

You suggest that i store all files in one folder where everything is allread merged (core, modules, themes and hacks). I work within this folder commit my changes and so have a versionning of the whole project.
When needed i can release the whole project for a given revision of the working tree. So far so good.

But what when releasing only the files belonging to a specific module, what is the way to do it ? how can i easily keep track of the change made to one specific module ?
I do not understand what you advise when saying revert subdurectories ? I tried one time more this single branch solution but could not figure out how to do it.
I've seen tagging possibilites but completly ignore what they are for ? Would tags allow me to flag commits in the working branch as belonging to a given module ?

Perhaps there is a good literature on the net that can bring me on the right way of seeing ressource handling in VCS. Do you have a hint ?

Mathieu Schiffmann (movix) said : #3

After a lot of testings and the generous help from mgz and AuroraBorealis on the IRC i finaly came to a solution that fit my needs.
here how o proceed, i hope it's a consistant way of doing.

to create my global structure :

bzr init cmscore-source
bzr commit cmscore-source -m "Init : empty" --unchanged
xcopy sources\CMS\*.* cmscore-source\*.* /E
bzr add cmscore-source
bzr commit cmscore-source -m "Init : cms version xx"
bzr branch cmscore-source dev
bzr branch dev currentRelease

i have now a dev folder and a release folder

to create a new module

md "dev\modules\newModule"
bzr add dev
bzr commit dev -m "MODULE Create : newModule"
REM Create a branch for releasing the standalone module
md "modules\newModule"
bzr branch dev modules/newModules/currentRelease -r1
bzr merge dev --dir modules/newModule/currentRelease
cd "modules\newModule\currentRelease"
bzr revert --forget-merges
bzr revert *
bzr revert .htaccess
md "modules\newModule"
bzr add
bzr commit -m "MODULE INIT : newModule" --unchanged

I do all my work in the dev folder and commit changes always belonging to a given Module or task
To release a module as standalone version i merge the changes from dev using -rxx..yy so that i get the last changes in my modules/newModule/currentRelease folder.
To release the whole work i merge dev to currentRelease
For deadend releases i branch from currentRelease (whole one or module specific) to an according folder.

I greatly appreciate the help i got in the IRC. I will also post this information as a tutorial on the CMS community site. Perhaps the bazaar project can win some new users this way.

Thanl again and happy new year to you all :)