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

Martin Pool mbp at canonical.com
Wed Oct 10 03:39:29 BST 2007


Martin Pool has voted tweak.
Status is now: Conditionally approved
Comment:
+    def make_populated_repository(self, factory):
+        """Create a new repository populated by the given factory."""
+        repo = self.make_repository('broken-repo')
+        repo.lock_write()
+        try:
+            repo.start_write_group()
+            try:
+                factory(repo)
+                repo.commit_write_group()
+                return repo
+            except:
+                repo.abort_write_group()
+                raise
+        finally:
+            repo.unlock()

(comment only) It would be nice to have a more general facility in 
tests:

   self.call_in_write_group(repo, factory)

It's probably not good to have on the public Repository interface but
might be nice in tests.

+      checked, and possibly reconciled ASAP.  (Aaron Bentley)

Andrew should be credited here too.

=== added file 'bzrlib/tests/repository_implementations/test_check.py'
+from bzrlib.repository import _RevisionTextVersionCache

_RevisionTextVersionCache doesn't seem to be used in this file.

+
+class _RevisionTextVersionCache(object):
+    """A cache of the versionedfile versions for revision and 
file-id"""
+

+
+class WeaveChecker(object):
+

(comment) Because those two classes are only used in fairly special 
cases it
seems a bit unfortunate to have them making this file larger, just from 
the
point of view of ease of reading.  Maybe there is no other sensible
location; we know that one file per class is too slow.

Is WeaveChecker really weave-specific?  It seems more like a 
VersionedFileChecker?



+
+    result = TestSuite()
+    loader = TestLoader()
+
+    for module_name, appliers in test_repository_implementations:
+        tests = loader.loadTestsFromModuleNames([prefix + module_name])
+        suite = TestSuite()
+        suite.addTests(tests)
+        for applier in appliers:
+            new_suite = TestSuite()
+            for test in iter_suite_tests(suite):
+                new_suite.addTests(applier.adapt(test))
+            suite = new_suite
+        result.addTests(suite)

This seems a bit generic to have inline here.  Could you not generate 
the non-broken scenarios in the normal way, then add in

   multiply_tests_from_modules(['....test_check_reconcile'],
     reconcile_scenario_iter)

where that later one generates the cross product of formats and 
brokenness
scenarios?

Aside from that all good.


For details, see: 
http://bundlebuggy.aaronbentley.com/request/%3C20071005031130.GF17543%40steerpike.home.puzzling.org%3E



More information about the bazaar mailing list