[MERGE] Reconcile can fix bad parent references, Andrew's version

Andrew Bennetts andrew at canonical.com
Fri Sep 28 15:38:01 BST 2007


Hi all,

This is my branch that builds on Aaron's original branch.  The short summary is
that this improved version fixes the inconsistency we have in bzr.dev.  It's a
pretty large diff, though.

The biggest improvement I think is in the test coverage.  I found it difficult
to understand or extend the tests Aaron originally had; there was one “General
Fixture” (to use the term from the _xUnit Patterns_ book:
http://xunitpatterns.com/Obscure%20Test.html#General%20Fixture) which
intertwined many different edge cases, and then individual tests that would only
use part of the complex fixture.

With the help of Robert I decomposed the fixture into independent cases that
corresponded to a single test, and then we added some more.  I then created
"scenario" objects for these cases that define both the fixture and the expected
results from reconcile and check, to avoid writing duplicate tests.  There's a
bit of infrastructure involved here, but it's not particularly complex.  I think
it can be made better (in particular there's some repetition within each
scenario), but I hope it is “good enough” already.

So I hope the test scenarios are more concise and easier to comprehend, more
complete, and easier to add new cases to.

With the new test cases came test failures; I've changed the logic a bit to make
everything pass.  At some point it seemed like a good idea to refactor the bulk
of Repository.find_bad_ancestors into VersionedFile, so I did; with hindsight it
perhaps wasn't a great idea.  Reconcile doesn't call find_bad_ancestors at all
anymore though, instead it asks what the correct parents for a file version
should be, and if there is a mismatch it rewrites the versioned file using that
information (rather than detecting bad parents, and then separately calculating
what they should be inside reconcile, which seemed like duplicate work).  Check
still calls find_bad_ancestors to report on unreferenced revisions, but that can
probably be improved.

Aaron will be glad to hear I have left the treatment of ghost parents as he had
it; it still makes me uneasy, but not enough to contradict the work Aaron
already did.  So I'm trusting Aaron's judgement here.

So I think this patch is basically 90% done; there's a bit of mess to tidy up,
but nothing fundamental anymore.  It's certainly due for review, so here it is!

-Andrew.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: bzr-mail-l62pim.patch
Type: text/x-diff
Size: 157679 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20070929/f5e54698/attachment-0001.bin 


More information about the bazaar mailing list