Merge lp:~spiv/bzr/checkout-tags-propagation-603395-2.2 into lp:bzr/2.2
| Status: | Rejected |
|---|---|
| Rejected by: | Andrew Bennetts on 2010-11-18 |
| Proposed branch: | lp:~spiv/bzr/checkout-tags-propagation-603395-2.2 |
| Merge into: | lp:bzr/2.2 |
| Diff against target: |
423 lines (+272/-16) 8 files modified
NEWS (+13/-0) bzrlib/branch.py (+1/-1) bzrlib/builtins.py (+3/-1) bzrlib/tag.py (+69/-13) bzrlib/tests/blackbox/test_merge.py (+1/-1) bzrlib/tests/blackbox/test_tags.py (+12/-0) bzrlib/tests/per_branch/test_tags.py (+170/-0) bzrlib/tests/test_tag.py (+3/-0) |
| To merge this branch: | bzr merge lp:~spiv/bzr/checkout-tags-propagation-603395-2.2 |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Vincent Ladeuil | Disapprove on 2010-11-11 | ||
| John A Meinel | 2010-11-09 | Pending | |
|
Review via email:
|
|||
This proposal supersedes a proposal from 2010-11-01.
Description of the Change
This is part of the fix for bug 603395. It makes BasicTags.merge_to also merge to the master branch, if there is one. This is consistent with e.g. set_tag. bzr-builddeb directly calls that API, and presumably expects merge_to in a checkout branch to update the master as well. Because bzr-builddeb does call this API directly I don't believe <https:/
I've dealt with my reservations on the original merge proposal: merge_to now accepts an optional kwarg, ignore_master, that cmd_merge uses to avoid prematurely propagating changes to the master. So I think this avoids any chance of regressing at all on #99137 (bzr revert will still not remove the new tags from the child branch, but that's not a regression). This does mean that external implementations of merge_to should be updated. I've documented the API change in NEWS, and made sure the callsite in bzr that does pass that kwarg falls back to not passing the kwarg. I've tested the fallback manually with bzr-svn (which has an external implementation of merge_to), and it appears to work as intended.
The tests take care to deal with all the permutations, including those that can only be triggered by an unfixed bzr operating on the checkout. See the test comments for details.
| Andrew Bennetts (spiv) wrote : | # |
| John A Meinel (jameinel) wrote : | # |
38 - dest_dict = to_tags.
39 - result, conflicts = self._reconcile
40 - overwrite)
41 - if result != dest_dict:
42 - to_tags.
43 + master = to_tags.
44 + try:
45 + if master is not None:
46 + master.lock_write()
47 + conflicts = self._merge_
48 + if master is not None:
49 + conflicts += self._merge_
50 + overwrite)
51 + finally:
52 + if master is not None:
53 + master.unlock()
Isn't this better written as:
master = to_tags.
if master is not None:
master.
try:
conflicts = ...
finally:
master.
Note that the way you wrote it, if we fail to take the write lock in the first place (no such permission), we end up still calling unlock.
I think you wrote it this way because you check the conflicts anyway, but the code looks clearer to me if you just add an 'else: conflicts = ...' to the above statement.
I suppose either way it is a bit clumsy, since you want the merge to fail immediately if you can't propagate the tags to the master branch before you try to merge to the local one...
I think the logic is otherwise ok.
| Andrew Bennetts (spiv) wrote : | # |
John A Meinel wrote:
[...]
> Note that the way you wrote it, if we fail to take the write lock in
> the first place (no such permission), we end up still calling unlock.
Good point!
> I think you wrote it this way because you check the conflicts anyway,
> but the code looks clearer to me if you just add an 'else: conflicts =
> ...' to the above statement.
>
> I suppose either way it is a bit clumsy, since you want the merge to
> fail immediately if you can't propagate the tags to the master branch
> before you try to merge to the local one...
Really what I want is to use add_cleanup. It seemed like it was perhaps
overkill, so I didn't do that initially. But this review makes it clear
to me that it really would be worthwhile, despite incurring a larger
diff.
- 5115. By Andrew Bennetts on 2010-11-09
-
Remove inaccurate test comment.
| Vincent Ladeuil (vila) wrote : | # |
Our policy for stable branches is a strict 'no API changes'.
I realize you have gone very far in ensuring compatibility and that this impacts UDD but this still doesn't justify breaking our policy IMHO.
Are there some other ways to propagate the tags to the master branch without this patch ?
I'm otherwise +1 for landing this on trunk.
| Vincent Ladeuil (vila) wrote : | # |
More thoughts on this as I realize it's always frustrating to have a mp rejected.
My concerns here of course are: what if we break something ? Would that means we'll get into a whack-a-mole frenzy updating bzr and plugins introducing even more problems ?
Instead of focusing on the right fix on trunk...
What are your thoughts here and what do you plan to do next ?
Is there some way we can have some real-world testing here ? May be asking Jelmer for bzr-svn fallouts ? Do we have a clear understanding of *which* plugins are (or could be) impacted there ?
| John A Meinel (jameinel) wrote : | # |
I think I'm happy with the change, but I would agree with Vincent's hesitancy to land it in 2.2, vs just landing it in trunk.
Unmerged revisions
- 5115. By Andrew Bennetts on 2010-11-09
-
Remove inaccurate test comment.
- 5114. By Andrew Bennetts on 2010-11-09
-
Add unit test for ignore_master=True, and improve other test comments.
- 5113. By Andrew Bennetts on 2010-11-09
-
Cosmetic tweak to deprecation.
- 5112. By Andrew Bennetts on 2010-11-09
-
Move bound_branch.
tags.merge_ to tests to per_branch. - 5111. By Andrew Bennetts on 2010-11-09
-
Move new test to bb.test_tag, to avoid repeating test infrastructure.
- 5110. By Andrew Bennetts on 2010-11-09
-
Add blackbox test to demonstrate that 'merge' alone still does not propagate tags to the master.
- 5109. By Andrew Bennetts on 2010-11-09
-
Merge lp:bzr/2.2.
- 5108. By Andrew Bennetts on 2010-11-09
-
Don't propagate tags to the master branch during cmd_merge.
- 5107. By Andrew Bennetts on 2010-11-09
-
Use add_cleanup for simpler and more correct unlocking.
- 5106. By Andrew Bennetts on 2010-11-01
-
More tests, more description of test intent, and specify exactly what happens with duplicate vs. different conflicts.

I should point out: this does have the perhaps unwanted side-effect that "bzr merge" can cause tags to be added the master even if the next command is "bzr commit". That's really <https:/ /bugs.launchpad .net/bzr/ +bug/99137> (tags are "permanently" propagated by merge), and this patch is just making the overall behaviour more consistent. I can see an argument that undoing the accidental limiting of the the effect of bug 99137 might not be acceptable in a stable branch, though.
A compromise would be to add a new optional argument to merge_to (or perhaps a whole new method) that callers can use to explicitly enable/disable propagation. I'm not sure if it would be better to default to enabled (so that plugins like builddeb can automatically benefit), or disabled (to minimise the change in behaviour, and also perhaps to avoid needing to tweak the API layers between cmd_merge and br.tags.merge_to to pass the flag). With 'bzr merge' not propagating we'd then rely on <https:/ /code.launchpad .net/~spiv/ bzr/tags- commit- propagation- 603395- 2.2> to propagate at commit time rather than merge time.