Merge lp:~rom1-chal/bzr/post_checkout_hook into lp:bzr
Status: | Work in progress |
---|---|
Proposed branch: | lp:~rom1-chal/bzr/post_checkout_hook |
Merge into: | lp:bzr |
Diff against target: |
157 lines (+98/-1) 4 files modified
.bzrignore (+1/-0) bzrlib/branch.py (+41/-0) bzrlib/tests/per_branch/test_create_checkout.py (+53/-1) doc/en/release-notes/bzr-2.5.txt (+3/-0) |
To merge this branch: | bzr merge lp:~rom1-chal/bzr/post_checkout_hook |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Romain Chalumeau (community) | Approve | ||
Jelmer Vernooij (community) | Needs Information | ||
Review via email: mp+81589@code.launchpad.net |
Description of the change
Hi,
As mentioned in IRC chan, please find an implementation of a post_checkout hook.
* Code : It is called with bzrlib.
(checkouted branch, checkouted revision_id, created workingtree, checkout path). It fired at the end of the Branch.
* Tests : per_branch tests take into account lightweight, heavyweight and earlier revision cehkout.
./bzr selftest -v TestCheckoutHook
* Doc : I haven't found the hooks document generator to test the 'bzr help hooks' output.
Yet, I have update the releasenotes.
My planned usage is the following :
- I have a CI server running merges from bzr-builder recipes,
- When a conflict is detected, it reports the conflicts and mails them to related users.
The goal now is to propose to the developer to simply checkout a branch to reproduce locally the conflicts from the recipe.
With the post_checkout hook, i trigger the merge directive right after the checkout.
Rgds/Romain
Unmerged revisions
- 6249. By Romain Chalumeau
-
Fixes tests with tree.last_revision
- 6248. By Romain Chalumeau
-
Fixes CheckoutHookParams params comment for api doc
- 6247. By Romain Chalumeau
-
Merge trunk
- 6246. By Romain Chalumeau
-
Fixes after code review (jelmer)
- 6245. By Romain Chalumeau
-
Add line for post_checkout hook in releasenotes
- 6244. By Romain Chalumeau
-
Add post_checkout hook in BranchHooks. Fired at the end of Branch.
create_ checkout
Tests : tests hook per branch with lightweight, heavyweight and earlier revision checkout
Hi Romain,
This looks good overall. My only concern is that we shouldn't be adding unnecessary hooks. Is there a particular reason you want additional merges to happen on checkout, rather than having users actually run the recipe locally?
Assuming we do indeed want to add this hook, I think this code looks really good. Some minor notes/things that need fixing:
The docs for "bzr help hooks" should be automatically updated, once new hooks are registered. Since you added this hook to BranchHooks, it should now show up in "bzr hooks".
Since checkouts can be heavyweight or lighweight, the term "branch" in the context of a checkout is ambiguous. I would suggest renaming the "branch" member of PostCheckoutHooks to "master_branch" to make it clearer which branch is being passed in.
19 + params = CheckoutHookPar ams(self, revision_id or self.last_ revision( ),
20 + tree, to_location )
There is a race condition here - the master branch can have changed since the working tree was created. It is probably better to use "tree.last_ revision( )" rather than "revision_id or self.last_ revision( )".
Also, you should take credit for this change in doc/en/ release- notes/bzr- 2.5.txt. :-)
Sorry it took so long to get back to you.