bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
| 
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  | 
| 
1534.4.28
by Robert Collins
 first cut at merge from integration.  | 
4  | 
from bzrlib.builtins import merge  | 
| 
974.1.56
by aaron.bentley at utoronto
 Added merge test  | 
5  | 
from bzrlib.commit import commit  | 
| 
1185.24.3
by Aaron Bentley
 Integrated reprocessing into the rest of the merge stuff  | 
6  | 
from bzrlib.errors import UnrelatedBranches, NoCommits, BzrCommandError  | 
| 
1390
by Robert Collins
 pair programming worx... merge integration and weave  | 
7  | 
from bzrlib.fetch import fetch  | 
| 
1534.4.28
by Robert Collins
 first cut at merge from integration.  | 
8  | 
from bzrlib.merge import transform_tree  | 
| 
1185.31.32
by John Arbash Meinel
 Updated the bzr sourcecode to use bzrlib.osutils.pathjoin rather than os.path.join to enforce internal use of / instead of \  | 
9  | 
from bzrlib.osutils import pathjoin  | 
| 
1534.4.28
by Robert Collins
 first cut at merge from integration.  | 
10  | 
from bzrlib.revision import common_ancestor  | 
11  | 
from bzrlib.tests import TestCaseWithTransport  | 
|
| 
1534.4.26
by Robert Collins
 Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create.  | 
12  | 
from bzrlib.workingtree import WorkingTree  | 
13  | 
||
14  | 
||
15  | 
class TestMerge(TestCaseWithTransport):  | 
|
| 
974.1.56
by aaron.bentley at utoronto
 Added merge test  | 
16  | 
"""Test appending more than one revision"""  | 
| 
1534.4.26
by Robert Collins
 Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create.  | 
17  | 
|
| 
974.1.56
by aaron.bentley at utoronto
 Added merge test  | 
18  | 
def test_pending(self):  | 
| 
1534.4.26
by Robert Collins
 Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create.  | 
19  | 
wt = self.make_branch_and_tree('.')  | 
20  | 
wt.commit("lala!")  | 
|
21  | 
self.assertEquals(len(wt.pending_merges()), 0)  | 
|
| 
1185.33.66
by Martin Pool
 [patch] use unicode literals for all hardcoded paths (Alexander Belchenko)  | 
22  | 
merge([u'.', -1], [None, None])  | 
| 
1534.4.26
by Robert Collins
 Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create.  | 
23  | 
self.assertEquals(len(wt.pending_merges()), 0)  | 
| 
974.1.80
by Aaron Bentley
 Improved merge error handling and testing  | 
24  | 
|
25  | 
def test_nocommits(self):  | 
|
26  | 
self.test_pending()  | 
|
| 
1534.4.26
by Robert Collins
 Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create.  | 
27  | 
wt2 = self.make_branch_and_tree('branch2')  | 
| 
974.1.80
by Aaron Bentley
 Improved merge error handling and testing  | 
28  | 
self.assertRaises(NoCommits, merge, ['branch2', -1],  | 
29  | 
[None, None])  | 
|
| 
1534.4.26
by Robert Collins
 Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create.  | 
30  | 
return wt2  | 
| 
974.1.80
by Aaron Bentley
 Improved merge error handling and testing  | 
31  | 
|
32  | 
def test_unrelated(self):  | 
|
| 
1534.4.26
by Robert Collins
 Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create.  | 
33  | 
wt2 = self.test_nocommits()  | 
34  | 
wt2.commit("blah")  | 
|
| 
974.1.80
by Aaron Bentley
 Improved merge error handling and testing  | 
35  | 
self.assertRaises(UnrelatedBranches, merge, ['branch2', -1],  | 
36  | 
[None, None])  | 
|
| 
1534.4.26
by Robert Collins
 Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create.  | 
37  | 
return wt2  | 
| 
974.1.80
by Aaron Bentley
 Improved merge error handling and testing  | 
38  | 
|
| 
974.1.88
by Aaron Bentley
 Set a pending_merge if the merge base is forced to revno 0  | 
39  | 
def test_pending_with_null(self):  | 
40  | 
"""When base is forced to revno 0, pending_merges is set"""  | 
|
| 
1534.4.26
by Robert Collins
 Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create.  | 
41  | 
wt2 = self.test_unrelated()  | 
| 
1508.1.19
by Robert Collins
 Give format3 working trees their own last-revision marker.  | 
42  | 
wt1 = WorkingTree.open('.')  | 
| 
1534.4.26
by Robert Collins
 Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create.  | 
43  | 
br1 = wt1.branch  | 
44  | 
fetch(from_branch=wt2.branch, to_branch=br1)  | 
|
| 
1390
by Robert Collins
 pair programming worx... merge integration and weave  | 
45  | 
        # merge all of branch 2 into branch 1 even though they 
 | 
46  | 
        # are not related.
 | 
|
| 
1185.24.3
by Aaron Bentley
 Integrated reprocessing into the rest of the merge stuff  | 
47  | 
self.assertRaises(BzrCommandError, merge, ['branch2', -1],  | 
48  | 
['branch2', 0], reprocess=True, show_base=True)  | 
|
49  | 
merge(['branch2', -1], ['branch2', 0], reprocess=True)  | 
|
| 
1534.4.26
by Robert Collins
 Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create.  | 
50  | 
self.assertEquals(len(wt1.pending_merges()), 1)  | 
51  | 
return (wt1, wt2.branch)  | 
|
| 
974.1.89
by Aaron Bentley
 Fixed merging with multiple roots, by using null as graph root.  | 
52  | 
|
53  | 
def test_two_roots(self):  | 
|
54  | 
"""Merge base is sane when two unrelated branches are merged"""  | 
|
| 
1534.4.26
by Robert Collins
 Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create.  | 
55  | 
wt1, br2 = self.test_pending_with_null()  | 
56  | 
wt1.commit("blah")  | 
|
57  | 
last = wt1.branch.last_revision()  | 
|
| 
1534.4.28
by Robert Collins
 first cut at merge from integration.  | 
58  | 
self.assertEquals(common_ancestor(last, last, wt1.branch.repository), last)  | 
| 
1185.46.1
by Aaron Bentley
 Test case when file to be renamed is also deleted  | 
59  | 
|
60  | 
def test_create_rename(self):  | 
|
61  | 
"""Rename an inventory entry while creating the file"""  | 
|
| 
1534.4.26
by Robert Collins
 Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create.  | 
62  | 
tree =self.make_branch_and_tree('.')  | 
| 
1185.46.1
by Aaron Bentley
 Test case when file to be renamed is also deleted  | 
63  | 
file('name1', 'wb').write('Hello')  | 
64  | 
tree.add('name1')  | 
|
65  | 
tree.commit(message="hello")  | 
|
66  | 
tree.rename_one('name1', 'name2')  | 
|
67  | 
os.unlink('name2')  | 
|
| 
1534.4.26
by Robert Collins
 Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create.  | 
68  | 
transform_tree(tree, tree.branch.basis_tree())  | 
| 
1185.46.2
by Aaron Bentley
 Added test for renaming both parent and child  | 
69  | 
|
70  | 
def test_layered_rename(self):  | 
|
71  | 
"""Rename both child and parent at same time"""  | 
|
| 
1534.4.26
by Robert Collins
 Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create.  | 
72  | 
tree =self.make_branch_and_tree('.')  | 
| 
1185.46.2
by Aaron Bentley
 Added test for renaming both parent and child  | 
73  | 
os.mkdir('dirname1')  | 
74  | 
tree.add('dirname1')  | 
|
| 
1185.31.32
by John Arbash Meinel
 Updated the bzr sourcecode to use bzrlib.osutils.pathjoin rather than os.path.join to enforce internal use of / instead of \  | 
75  | 
filename = pathjoin('dirname1', 'name1')  | 
| 
1185.46.2
by Aaron Bentley
 Added test for renaming both parent and child  | 
76  | 
file(filename, 'wb').write('Hello')  | 
77  | 
tree.add(filename)  | 
|
78  | 
tree.commit(message="hello")  | 
|
| 
1185.31.32
by John Arbash Meinel
 Updated the bzr sourcecode to use bzrlib.osutils.pathjoin rather than os.path.join to enforce internal use of / instead of \  | 
79  | 
filename2 = pathjoin('dirname1', 'name2')  | 
| 
1185.46.2
by Aaron Bentley
 Added test for renaming both parent and child  | 
80  | 
tree.rename_one(filename, filename2)  | 
81  | 
tree.rename_one('dirname1', 'dirname2')  | 
|
| 
1534.4.26
by Robert Collins
 Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create.  | 
82  | 
transform_tree(tree, tree.branch.basis_tree())  |