Merge lp://staging/~parthm/bzr/173274-export-hooks into lp://staging/bzr
Proposed by
Parth Malwankar
Status: | Work in progress | ||||
---|---|---|---|---|---|
Proposed branch: | lp://staging/~parthm/bzr/173274-export-hooks | ||||
Merge into: | lp://staging/bzr | ||||
Diff against target: |
215 lines (+158/-3) 4 files modified
NEWS (+4/-0) bzrlib/export/__init__.py (+93/-3) bzrlib/hooks.py (+5/-0) bzrlib/tests/test_export.py (+56/-0) |
||||
To merge this branch: | bzr merge lp://staging/~parthm/bzr/173274-export-hooks | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Andrew Bennetts | Needs Fixing | ||
Review via email: mp+35919@code.staging.launchpad.net |
Commit message
support for pre_export and post_export hooks.
Description of the change
=== Fixes Bug #173274 ===
This patch adds support for pre_export and post_export hooks.
The 'return _exporters[
To post a comment you must log in.
Unmerged revisions
- 5436. By Parth Malwankar
-
merged in changes from trunk
- 5435. By Parth Malwankar
-
added NEWS entry. fixed typo.
- 5434. By Parth Malwankar
-
added pre-export and post-export hooks + tests.
- 5433. By Parth Malwankar
-
removed unwanted return from export function
144 +# FIXME: As export is a directory based module (as against a py file), our hooks.register_ lazy((' bzrlib. export. __init_ _', 'hooks'),
145 +# lazy registering doesn't see 'hooks' in the first tuple. To work around
146 +# this directly list __init__ below. This can possibly be cleaner.
147 +known_
148 + 'bzrlib.export', 'ExportHooks')
I don't understand why this is necessary... oh, I see. There's a bug in _LazyObjectGetter. I've submitted <https:/ /code.edge. launchpad. net/~spiv/ bzr/hooks- refactoring/ +merge/ 36101> to fix this, and also make known_hooks registration a little neater. Until that lands this is an ok workaround.
36 - return _exporters[ format] (tree, dest, root, subdir, filtered=filtered, timestamps= per_file_ timestamps) pre_export' ]: Params( tree, dest, format, root, subdir, timestamps) ) format] (tree, dest, root, subdir, filtered=filtered, timestamps= per_file_ timestamps) post_export' ]: Params( tree, dest, format, root, subdir, timestamps) )
37 - per_file_
38 + for hook in hooks['
39 + hook(ExportHook
40 + filtered, per_file_
41 + _exporters[
42 + per_file_
43 + for hook in hooks['
44 + hook(ExportHook
45 + filtered, per_file_
Is this actually sufficient to provide the functionality requested in bug 173274? Specifically, it requests a hook that allows modifying the tree to export, e.g. by running autoconf, and having the new, unversioned (and probably ignored) files that generates be included, and possibly include modifications to versioned files too. I don't think this implementation allows that, as I believe that regardless of the pre_export hook it will still export "the last committed revision", as "bzr help export" says.
Well, the pre-hook could commit a new revision with the changes, and the post-hook could uncommit it... that would be a really ugly hack, and a plugin could already wrap cmd_export to do that sort of hack.
So, two changes I'd like to see:
* support for somehow allowing selected unversioned files in the tree to be included in the export. Perhaps by changing the Tree object that is being exported?
* tests that demonstrate that support, so that we can be confident the use case in bug 173274 is satisfied :)