On Thu, Mar 18, 2010 at 9:38 AM, David Hostetler <negativesum@gmail.com> wrote:
Is there some reason you can't use validate to set the default?

Consider the following validation spec:

parcels = string_list()

   default_branch = string()

   branch = string(default=$default_branch)

Applied to the following config:

parcels = parcel1,parcel2

   default_branch = master


   branch = someotherbranch

Now when you parse the config, and validate it against the spec, you
get the following:

>> cfg['project']['parcel1']['branch']
>> 'master'
>> cfg['project']['parcel2']['branch']
>> 'someotherbranch'

No hackery.  And you get the usual added benefits of validation.

TL;DR - I have philosophical issues that prevent me from going that route.

This actually brings up a good point though.  Essentially, my goal in creating envbuilder is to have a build system that's flexible enough to adapt to what the user is trying to use it for.  The above requires me to know what options the user is looking for beforehand and code them in the configspec.  This limits the amount of crazy stuff I didn't anticipate that a user can do.

In that vein, envbuilder can currently handle any VCS that has a command-line interface.  The above might be sensible for git, but does it work for hg or bzr or fossil or CVS?  :-)