From be97c4558992a437cde235aafc7ae2bd6df84ac8 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Tue, 22 Jun 2010 21:23:47 +0200 Subject: Initial frame for implementing read_tree using pure python. As git-read-tree can do much more than we can ( and faster assumably ), the .new method is used to create new index instances from up to 3 trees. Implemented multi-tree traversal to facilitate building a stage list more efficiently ( although I am not sure whether it could be faster to use a dictionary together with some intensive lookup ), including test Added performance to learn how fast certain operations are, and whether one should be preferred over another --- test/git/test_index.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'test/git/test_index.py') diff --git a/test/git/test_index.py b/test/git/test_index.py index d0063e89..ae754430 100644 --- a/test/git/test_index.py +++ b/test/git/test_index.py @@ -580,7 +580,7 @@ class TestIndex(TestBase): # write all trees and compare them # its important to have a few submodules in there too - max_count = 100 + max_count = 25 count = 0 for commit in rw_repo.head.commit.traverse(): if count >= max_count: @@ -593,3 +593,7 @@ class TestIndex(TestBase): assert index.write_tree() == orig_tree # END for each commit + def test_index_new(self): + self.fail("todo index new") + + -- cgit v1.2.3 From 1e2265a23ecec4e4d9ad60d788462e7f124f1bb7 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Wed, 23 Jun 2010 15:48:57 +0200 Subject: fixed critical bug in traverse_trees_recursive, implemented IndexFile.new including simple test, it may be simple as the methods it uses are throroughly tested --- test/git/test_index.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'test/git/test_index.py') diff --git a/test/git/test_index.py b/test/git/test_index.py index ae754430..35580135 100644 --- a/test/git/test_index.py +++ b/test/git/test_index.py @@ -594,6 +594,13 @@ class TestIndex(TestBase): # END for each commit def test_index_new(self): - self.fail("todo index new") + B = self.rorepo.tree("6d9b1f4f9fa8c9f030e3207e7deacc5d5f8bba4e") + H = self.rorepo.tree("25dca42bac17d511b7e2ebdd9d1d679e7626db5f") + M = self.rorepo.tree("e746f96bcc29238b79118123028ca170adc4ff0f") + + for args in ((B,), (B,H), (B,H,M)): + index = IndexFile.new(self.rorepo, *args) + assert isinstance(index, IndexFile) + # END for each arg tuple -- cgit v1.2.3