Merge lp:~gerard-/bzr/update into lp:bzr
| Status: | Merged | ||||
|---|---|---|---|---|---|
| Approved by: | Vincent Ladeuil on 2010-02-10 | ||||
| Approved revision: | not available | ||||
| Merged at revision: | not available | ||||
| Proposed branch: | lp:~gerard-/bzr/update | ||||
| Merge into: | lp:bzr | ||||
| Diff against target: |
312 lines (+180/-49) 4 files modified
NEWS (+4/-0) bzrlib/tests/blackbox/test_commit.py (+7/-0) bzrlib/tests/blackbox/test_update.py (+131/-8) bzrlib/workingtree.py (+38/-41) |
||||
| To merge this branch: | bzr merge lp:~gerard-/bzr/update | ||||
| Related bugs: |
|
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Vincent Ladeuil | 2010-02-02 | Approve on 2010-02-10 | |
| John A Meinel | 2010-02-05 | Approve on 2010-02-09 | |
|
Review via email:
|
|||
| Gerard Krol (gerard-) wrote : | # |
| Martin Pool (mbp) wrote : | # |
Thanks for tackling this!
Are there specific bugs that you think this will fix?
| Gerard Krol (gerard-) wrote : | # |
Just bug #113809 (update performs two merges) + the 6 duplicates bug #116655, bug #175589, bug #228506, bug #236724, bug #270665 and bug #395514
| Martin Pool (mbp) wrote : | # |
just that hey? :-)
--
Martin <http://
- 4993. By Gerard Krol on 2010-02-05
-
Remove an unused local variable that was still lingering
| Vincent Ladeuil (vila) wrote : | # |
I let John review this as he's more familiar that code.
Just a couple of comments on some details.
While you're tweaking, can you fix the lines too long
(see doc/developers/
Also, if you disagree with some comments, update them instead
of deleting them (bzrlib/
Can you also have a look at http://
once it is approved ?
You may also add a NEWS entry mentioning the bugs you're addressing.
Make sure you have tests reproducing them.
| John A Meinel (jameinel) wrote : | # |
8 + a_file = file('u1/hosts', 'rt')
9 + text = a_file.read()
10 + a_file.close()
11 + self.assertEqua
12 +
^- I think this is better written as
self.assertFile
If that doesn't work because of line endings (it may be done in 'b' instead of
't' mode), then at least use:
self.assertEqu
first offline change in u1...
""", text)
We generally put 'expected' first, and assertEqualDiff gives nice output when
they aren't equal.
You have this a few times, and the lines are longer than 80 chars. (And some
other comments, etc are also >80 chars.)
I think this would do well with a clear statement of steps. Probably in a
comment somewhere. At least, it helped me sort it out. The old code did:
1) old_tip = self.branch.
master_
2) last_rev = basis_revision for current working tree
3) revision = new master_
4) merge_inner(
5) set_parent_
6) base_rev_id = unique_
7) merge_inner(
Which thinking about it, does seem a bit backwards. In the above analysis we
have these revisions at play
W wt.last_revision()
B wt.branch.
M wt.branch.
P wt.get_
already
The goal is to get from W to M in the most logical procession, but then also
handle that some of W (or B) may not be in M, so they have to be re-introduced.
Actually, I think it is that revisions in B that are not in M need to be
re-introduced, but I'm not sure if we care about revisions in W that aren't
in B or M. (though we certainly do care about P.)
So the current code does:
merge_inner(W => M)
Change the workingtree directly into the new master revision
merge_inner(
And re-merge the changes in the Branch that were not present in the Master
The new code does:
1) [same] old_tip = self.branch.
2) [same] last_rev = basis_revision for current working tree
3) [same] revision = master_
4) if old_tip != revision
merge_
if conflicts => stop (mark old_tip as merged into current tree)
5) if not merged:
merge_
else:
merge_
So I think this is:
merge_inner(
merge_inner(
# Note: I think one thing that neither code handles is when some of the
# revisions in M are already part of P, and thus probably shouldn't be
# re-introduced
So what does that do with a real graph
1
|\
2 3
| |
B-4 5-M
|
W
The old code would do:
apply the difference from W to M (revert 2,4, apply 3,5)
merge (1 => B) to M (apply 2,4)
Which should change the graph to look like:
1
|\
3 2
| |
MB-5 4
|/
W
Which is ~ what I would expect. It probably suffers from the probl...
| John A Meinel (jameinel) wrote : | # |
Just a thought....
Maybe what we want is:
if wt.get_
merge_
merge_inner(
| Gerard Krol (gerard-) wrote : | # |
> Also, if you disagree with some comments, update them instead
> of deleting them (bzrlib/
Those comments were identical to each other and to the comments on the test they were copied from. The best I can do at this point is remove them, as inventing my own will not add any information beyond what is already visible from the code. I might even misunderstand the code, and wrong comments are even worse than none.
- 4994. By Gerard Krol on 2010-02-06
-
Use assertFileEqual in the tests, instead of opening them and looking at the contents. TODO: check if this does work on Windows (due to possible \r\n line endings)?
- 4995. By Gerard Krol on 2010-02-06
-
Reformat long lines
| Gerard Krol (gerard-) wrote : | # |
> While you're tweaking, can you fix the lines too long
Fixed
| Gerard Krol (gerard-) wrote : | # |
> 8 + a_file = file('u1/hosts', 'rt')
> 9 + text = a_file.read()
> 10 + a_file.close()
> 11 + self.assertEqua
> u1=======\naltered in u2>>>>>>> MERGE-SOURCE\n')
> 12 +
>
>
> ^- I think this is better written as
>
> self.assertFile
Fixed
- 4996. By Gerard Krol on 2010-02-06
-
No need to use "result +=" anymore
- 4997. By Gerard Krol on 2010-02-06
-
Test for a case where update should remove commits
- 4998. By Gerard Krol on 2010-02-06
-
Pass the new test by doing the first merge with self.basis_tree() as base
- 4999. By Gerard Krol on 2010-02-06
-
Don't compare old_tip to revision, just do the merge.
- 5000. By Gerard Krol on 2010-02-06
-
Now correctly determine the branch point (instead of some lucky guesses)
| Gerard Krol (gerard-) wrote : | # |
I FINALLY understand the issue (thanks John!)
I think that this is ready for the merge now.
- 5001. By Gerard Krol on 2010-02-06
-
NEWS item
| Gerard Krol (gerard-) wrote : | # |
I'll talk with my boss about signing the "Canonical Contributor Agreement" this Monday.
If there are any additional changes needed to the patch or actions to take please let me know.
| Gerard Krol (gerard-) wrote : | # |
> I'll talk with my boss about signing the "Canonical Contributor Agreement"
> this Monday.
Signed it.
| John A Meinel (jameinel) wrote : | # |
This fits my expectations. If one of the merging steps creates conflicts, it stops as expected. It also looks like it should not spuriously remove committed changes, causing conflicts in uncommitted changes when bringing in the updates from the master branch.
We should still get a second review, I think.
| Vincent Ladeuil (vila) wrote : | # |
I've cleanup the tests a bit to be real whitebox ones based on branchbuilder.
I still the feeling that we don't have enough tests here but that's good enough for now.
I'll merge.

I don't really proposing to merge this as-is, but I think I solved the double merge problem update had for a long time. It will now perform the merges in a order that will minimize conflicts (first the local branch, then the master) and also stop after it encounters a conflict for the first merge. The only problem is really that I don't understand how it works...
I also added some tests for the new behaviour.
Please comment!