diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2009-10-21 16:52:25 +0200 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2009-10-21 18:17:47 +0200 |
commit | babf5765da3e328cc1060cb9b37fbdeb6fd58350 (patch) | |
tree | 2a04fc35a1dc68c64fb40188b1ec153370deb5fd /test/git/test_index.py | |
parent | b9d6494f1075e5370a20e406c3edb102fca12854 (diff) | |
download | gitpython-babf5765da3e328cc1060cb9b37fbdeb6fd58350.tar.gz |
Initial version of merge including tests for one-way, two-way and tree-way merge
Diffstat (limited to 'test/git/test_index.py')
-rw-r--r-- | test/git/test_index.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/git/test_index.py b/test/git/test_index.py index 7a0e21eb..ead231d1 100644 --- a/test/git/test_index.py +++ b/test/git/test_index.py @@ -41,3 +41,24 @@ class TestTree(TestCase): index_output.seek(0) assert index_output.read() == fixture("index_merge") + def test_merge(self): + common_ancestor_sha = "5117c9c8a4d3af19a9958677e45cda9269de1541" + cur_sha = "4b43ca7ff72d5f535134241e7c797ddc9c7a3573" + other_sha = "39f85c4358b7346fee22169da9cad93901ea9eb9" + + # simple index from tree + base_index = Index.from_tree(self.repo, common_ancestor_sha) + assert base_index.entries + + # merge two trees + two_way_index = Index.from_tree(self.repo, common_ancestor_sha, cur_sha) + assert two_way_index.entries + for e in two_way_index.entries.values(): + print "%i | %s" % ( e.stage, e.path ) + + # merge three trees - here we have a merge conflict + tree_way_index = Index.from_tree(self.repo, common_ancestor_sha, cur_sha, other_sha) + assert len(list(e for e in tree_way_index.entries.values() if e.stage != 0)) + + def test_custom_commit(self): + self.fail("Custom commit:write tree, make commit with custom parents") |