[patch] Use 'inherit' 'file' config setting when creating a new Environment (not loading defaults)
|Reported by:||Owned by:||osimons|
|Cc:||Christian Boos, shepting@…||Branch:|
Description (last modified by )
As I have started upgrading my code from 0.10 to 0.11 I have found this problem: My automated project creation now gives me new projects with 168 lines of default config options - whereas current setup with 0.10 I have only a few as the rest being inherited from global trac.ini.
The problem is obviously that there is no longer any trac.siteconfig that allows us to fetch a reference to any global trac.ini. The current mechanism is
[inherit] file = ... in project trac.ini.
options = [('inherit', 'file', '/path/to/global/trac.ini'),] to
Environment('/path/to/project', create=True, options) does not make a difference - current code loads all defaults, then add the line to the config options as any other setting. For any other setting that is likely an OK approach (as it overwrites defaults), but for file inheritance it is not as any inherited setting will now be overridden by defaults regardless.
Enclosed is a patch that:
- Does not load defaults if options are passed to Environment create, and one of those options is
- If inherit-file option, it also fully reloads the config after options have been written to file, as the 'inherit' will then be processed as well.
- Fixes environment created routine in workflow that assumes that settings never exists if it is a new project. The patch for workflow should be applied regardless, as if if an environment is created by passing in a custom workflow as options to create, the workflow routine will actually overwrite parts of that config - whatever lines it can match with own defaults… You get part custom, and part default - nice :-)