[clug] version control help with behaviour driven development?

Steve McInerney steve at stedee.id.au
Mon Aug 10 19:44:40 MDT 2009


On Tue, 2009-08-11 at 10:33 +1000, Alex Satrapa wrote:
> Just a quick one for the version-control wizards:
> 
> In Behaviour Driven Development, we build specifications (aka "tests")  
> to define the behaviour of our program, then write the program to  
> match the spec.
> 
> When facing legacy code, we build specifications to define the current  
> behaviour of the program (the idea being to build a set of regression  
> tests to make sure stuff doesn't break).
> 
> Can anyone suggest a way to accommodate this scenario: I want to be  
> able to have the repository in a consistently "working" state. This  
> would mean that anyone else can access the repository at any time, and  
> all tests will work, and the code will perform as specified.

Yup. You need some sort of patch/merge-request manager that takes merge
requests; applies tests, and on success applies the merge request to a
master &/or blessed branch.


> When adding new features, I'd like to be able to save the specs  
> somewhere so I can hack and slash to get the code passing the new  
> specs, without worrying about breaking the specs in the meantime. So  
> effectively I'd have one local commit with the specs in it, then a  
> second commit with the working code. When committing to the  
> repository, I'd like to commit just one change which contains both the  
> specs and the code that matches the spec.
> 
...

> Has anyone used Bazaar enough to know if a similar thing is possible  
> in that environment?

Yes. This is *exactly* how bzr itself is built/managed, and launchpad
and various others. We use a tool called PQM:
https://edge.launchpad.net/pqm


The Devs take a local branch copy. hack hack hack to fix bug XYZ,
whatever.
Publish that branch somewhere (anywhere tbh) where PQM can get to it.
Submit the merge request to PQM
PQM takes the merge request; applies it; runs the tests
And on success, performs the merge to the master copy - generally you'd
want to set this up such that only PQM has the access to perform merges
- more to stop accidental commits. YMMV.

eg. https://code.edge.launchpad.net/bzr
You can see the various branches of bzr hosted on launchpad;
If you view trunk:
https://code.edge.launchpad.net/~bzr/bzr/trunk
You'll see the note:
"This is the bzr mainline. Commits to this branch are made only through
PQM which enforces the test suite on all merges."
And note that all the merges are "done" by pqm.


I'm aware of another tool called tarmac
https://edge.launchpad.net/tarmac
which is trying to do something similar, but I believe it's more
launchpad specific.


HTH?

Cheers!
- Steve




More information about the linux mailing list