1185.1.41
by Robert Collins
massive patch from Alexander Belchenko - many PEP8 fixes, removes unused function uuid |
1 |
import os |
2 |
||
974.1.56
by aaron.bentley at utoronto
Added merge test |
3 |
from bzrlib.branch import Branch |
4 |
from bzrlib.commit import commit |
|
5 |
from bzrlib.selftest import TestCaseInTempDir |
|
6 |
from bzrlib.merge import merge |
|
974.1.80
by Aaron Bentley
Improved merge error handling and testing |
7 |
from bzrlib.errors import UnrelatedBranches, NoCommits |
974.1.89
by Aaron Bentley
Fixed merging with multiple roots, by using null as graph root. |
8 |
from bzrlib.revision import common_ancestor |
1390
by Robert Collins
pair programming worx... merge integration and weave |
9 |
from bzrlib.fetch import fetch |
1185.1.41
by Robert Collins
massive patch from Alexander Belchenko - many PEP8 fixes, removes unused function uuid |
10 |
|
11 |
||
974.1.56
by aaron.bentley at utoronto
Added merge test |
12 |
class TestMerge(TestCaseInTempDir): |
13 |
"""Test appending more than one revision"""
|
|
14 |
def test_pending(self): |
|
1185.11.5
by John Arbash Meinel
Merged up-to-date against mainline, still broken. |
15 |
br = Branch.initialize(".") |
974.1.56
by aaron.bentley at utoronto
Added merge test |
16 |
commit(br, "lala!") |
17 |
self.assertEquals(len(br.pending_merges()), 0) |
|
18 |
merge(['.', -1], [None, None]) |
|
19 |
self.assertEquals(len(br.pending_merges()), 0) |
|
974.1.80
by Aaron Bentley
Improved merge error handling and testing |
20 |
|
21 |
def test_nocommits(self): |
|
22 |
self.test_pending() |
|
23 |
os.mkdir('branch2') |
|
1185.11.5
by John Arbash Meinel
Merged up-to-date against mainline, still broken. |
24 |
br2 = Branch.initialize('branch2') |
974.1.80
by Aaron Bentley
Improved merge error handling and testing |
25 |
self.assertRaises(NoCommits, merge, ['branch2', -1], |
26 |
[None, None]) |
|
27 |
return br2 |
|
28 |
||
29 |
def test_unrelated(self): |
|
30 |
br2 = self.test_nocommits() |
|
31 |
commit(br2, "blah") |
|
32 |
self.assertRaises(UnrelatedBranches, merge, ['branch2', -1], |
|
33 |
[None, None]) |
|
974.1.88
by Aaron Bentley
Set a pending_merge if the merge base is forced to revno 0 |
34 |
return br2 |
974.1.80
by Aaron Bentley
Improved merge error handling and testing |
35 |
|
974.1.88
by Aaron Bentley
Set a pending_merge if the merge base is forced to revno 0 |
36 |
def test_pending_with_null(self): |
37 |
"""When base is forced to revno 0, pending_merges is set"""
|
|
38 |
br2 = self.test_unrelated() |
|
974.1.91
by Aaron Bentley
Merged latest from mpool |
39 |
br1 = Branch.open('.') |
1390
by Robert Collins
pair programming worx... merge integration and weave |
40 |
fetch(from_branch=br2, to_branch=br1) |
41 |
# merge all of branch 2 into branch 1 even though they
|
|
42 |
# are not related.
|
|
974.1.88
by Aaron Bentley
Set a pending_merge if the merge base is forced to revno 0 |
43 |
merge(['branch2', -1], ['branch2', 0]) |
44 |
self.assertEquals(len(br1.pending_merges()), 1) |
|
45 |
return (br1, br2) |
|
974.1.89
by Aaron Bentley
Fixed merging with multiple roots, by using null as graph root. |
46 |
|
47 |
def test_two_roots(self): |
|
48 |
"""Merge base is sane when two unrelated branches are merged"""
|
|
49 |
br1, br2 = self.test_pending_with_null() |
|
50 |
commit(br1, "blah") |
|
1390
by Robert Collins
pair programming worx... merge integration and weave |
51 |
last = br1.last_revision() |
974.1.89
by Aaron Bentley
Fixed merging with multiple roots, by using null as graph root. |
52 |
self.assertEquals(common_ancestor(last, last, br1), last) |