bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
| 
2052.3.2
by John Arbash Meinel
 Change Copyright .. by Canonical to Copyright ... Canonical  | 
1  | 
# Copyright (C) 2005 Canonical Ltd
 | 
| 
1685.1.80
by Wouter van Heyst
 more code cleanup  | 
2  | 
#
 | 
| 
1185.54.23
by Aaron Bentley
 Added unit tests for find_unmerged  | 
3  | 
# This program is free software; you can redistribute it and/or modify
 | 
4  | 
# it under the terms of the GNU General Public License as published by
 | 
|
5  | 
# the Free Software Foundation; either version 2 of the License, or
 | 
|
6  | 
# (at your option) any later version.
 | 
|
| 
1685.1.80
by Wouter van Heyst
 more code cleanup  | 
7  | 
#
 | 
| 
1185.54.23
by Aaron Bentley
 Added unit tests for find_unmerged  | 
8  | 
# This program is distributed in the hope that it will be useful,
 | 
9  | 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
|
10  | 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
|
11  | 
# GNU General Public License for more details.
 | 
|
| 
1685.1.80
by Wouter van Heyst
 more code cleanup  | 
12  | 
#
 | 
| 
1185.54.23
by Aaron Bentley
 Added unit tests for find_unmerged  | 
13  | 
# You should have received a copy of the GNU General Public License
 | 
14  | 
# along with this program; if not, write to the Free Software
 | 
|
15  | 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 | 
|
| 
1534.4.26
by Robert Collins
 Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create.  | 
16  | 
|
17  | 
import os  | 
|
18  | 
||
19  | 
||
| 
1534.4.28
by Robert Collins
 first cut at merge from integration.  | 
20  | 
from bzrlib.builtins import merge  | 
| 
2490.1.2
by John Arbash Meinel
 Cleanup according to PEP8 and some other small whitespace fixes  | 
21  | 
from bzrlib.missing import (  | 
| 
2466.8.1
by Kent Gibson
 Reworked LogFormatter API to simplify extending the attributes of the revision being logged. Added support for begin_log() and end_log() hooks in LogFormatters.  | 
22  | 
find_unmerged,  | 
| 
2490.1.3
by John Arbash Meinel
 Restore the test for iter_log_data as a deprecated function.  | 
23  | 
iter_log_data,  | 
| 
2466.8.1
by Kent Gibson
 Reworked LogFormatter API to simplify extending the attributes of the revision being logged. Added support for begin_log() and end_log() hooks in LogFormatters.  | 
24  | 
iter_log_revisions,  | 
25  | 
    )
 | 
|
| 
2490.1.3
by John Arbash Meinel
 Restore the test for iter_log_data as a deprecated function.  | 
26  | 
from bzrlib.symbol_versioning import zero_seventeen  | 
| 
1534.4.26
by Robert Collins
 Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create.  | 
27  | 
from bzrlib.tests import TestCaseWithTransport  | 
28  | 
from bzrlib.workingtree import WorkingTree  | 
|
29  | 
||
| 
1534.4.28
by Robert Collins
 first cut at merge from integration.  | 
30  | 
|
| 
1534.4.26
by Robert Collins
 Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create.  | 
31  | 
class TestMissing(TestCaseWithTransport):  | 
32  | 
||
| 
1185.54.23
by Aaron Bentley
 Added unit tests for find_unmerged  | 
33  | 
def test_find_unmerged(self):  | 
| 
1534.4.26
by Robert Collins
 Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create.  | 
34  | 
original_tree = self.make_branch_and_tree('original')  | 
35  | 
original = original_tree.branch  | 
|
36  | 
puller_tree = self.make_branch_and_tree('puller')  | 
|
37  | 
puller = puller_tree.branch  | 
|
38  | 
merger_tree = self.make_branch_and_tree('merger')  | 
|
39  | 
merger = merger_tree.branch  | 
|
| 
1185.54.23
by Aaron Bentley
 Added unit tests for find_unmerged  | 
40  | 
self.assertEqual(find_unmerged(original, puller), ([], []))  | 
| 
1534.4.26
by Robert Collins
 Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create.  | 
41  | 
original_tree.commit('a', rev_id='a')  | 
| 
1185.54.23
by Aaron Bentley
 Added unit tests for find_unmerged  | 
42  | 
self.assertEqual(find_unmerged(original, puller), ([(1, u'a')], []))  | 
| 
1666.1.4
by Robert Collins
 * 'Metadir' is now the default disk format. This improves behaviour in  | 
43  | 
puller_tree.pull(original)  | 
| 
1185.54.23
by Aaron Bentley
 Added unit tests for find_unmerged  | 
44  | 
self.assertEqual(find_unmerged(original, puller), ([], []))  | 
| 
1666.1.4
by Robert Collins
 * 'Metadir' is now the default disk format. This improves behaviour in  | 
45  | 
merger_tree.pull(original)  | 
| 
1534.4.26
by Robert Collins
 Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create.  | 
46  | 
original_tree.commit('b', rev_id='b')  | 
47  | 
original_tree.commit('c', rev_id='c')  | 
|
| 
1185.54.23
by Aaron Bentley
 Added unit tests for find_unmerged  | 
48  | 
self.assertEqual(find_unmerged(original, puller), ([(2, u'b'),  | 
49  | 
(3, u'c')], []))  | 
|
50  | 
||
| 
1666.1.4
by Robert Collins
 * 'Metadir' is now the default disk format. This improves behaviour in  | 
51  | 
puller_tree.pull(original)  | 
| 
1185.54.23
by Aaron Bentley
 Added unit tests for find_unmerged  | 
52  | 
self.assertEqual(find_unmerged(original, puller), ([], []))  | 
53  | 
self.assertEqual(find_unmerged(original, merger), ([(2, u'b'),  | 
|
54  | 
(3, u'c')], []))  | 
|
55  | 
merge(['original', -1], [None, None], this_dir='merger')  | 
|
56  | 
self.assertEqual(find_unmerged(original, merger), ([(2, u'b'),  | 
|
57  | 
(3, u'c')], []))  | 
|
| 
1534.4.26
by Robert Collins
 Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create.  | 
58  | 
merger_tree.commit('d', rev_id='d')  | 
| 
1185.54.23
by Aaron Bentley
 Added unit tests for find_unmerged  | 
59  | 
self.assertEqual(find_unmerged(original, merger), ([], [(2, 'd')]))  | 
| 
2204.1.1
by John Arbash Meinel
 'bzr missing -v' was showing adds as deletes.  | 
60  | 
|
| 
2490.1.3
by John Arbash Meinel
 Restore the test for iter_log_data as a deprecated function.  | 
61  | 
def test_iter_log_data(self):  | 
62  | 
base_tree = self.make_branch_and_tree('base')  | 
|
63  | 
self.build_tree(['base/a'])  | 
|
64  | 
base_tree.add(['a'], ['a-id'])  | 
|
65  | 
base_tree.commit('add a', rev_id='b-1')  | 
|
66  | 
||
67  | 
child_tree = base_tree.bzrdir.sprout('child').open_workingtree()  | 
|
68  | 
||
69  | 
self.build_tree(['child/b'])  | 
|
70  | 
child_tree.add(['b'], ['b-id'])  | 
|
71  | 
child_tree.commit('adding b', rev_id='c-2')  | 
|
72  | 
||
73  | 
child_tree.remove(['a'])  | 
|
74  | 
child_tree.commit('removing a', rev_id='c-3')  | 
|
75  | 
||
76  | 
self.build_tree_contents([('child/b', 'new contents for b\n')])  | 
|
77  | 
child_tree.commit('modifying b', rev_id='c-4')  | 
|
78  | 
||
79  | 
child_tree.rename_one('b', 'c')  | 
|
80  | 
child_tree.commit('rename b=>c', rev_id='c-5')  | 
|
81  | 
||
82  | 
base_extra, child_extra = find_unmerged(base_tree.branch,  | 
|
83  | 
child_tree.branch)  | 
|
84  | 
results = list(self.applyDeprecated(zero_seventeen, iter_log_data,  | 
|
85  | 
base_extra,  | 
|
86  | 
base_tree.branch.repository,  | 
|
87  | 
verbose=True))  | 
|
88  | 
self.assertEqual([], results)  | 
|
89  | 
||
90  | 
results = list(self.applyDeprecated(zero_seventeen, iter_log_data,  | 
|
91  | 
child_extra,  | 
|
92  | 
child_tree.branch.repository,  | 
|
93  | 
verbose=True))  | 
|
94  | 
self.assertEqual(4, len(results))  | 
|
95  | 
||
96  | 
r0,r1,r2,r3 = results  | 
|
97  | 
||
98  | 
self.assertEqual((2, 'c-2'), (r0[0], r0[1].revision_id))  | 
|
99  | 
self.assertEqual((3, 'c-3'), (r1[0], r1[1].revision_id))  | 
|
100  | 
self.assertEqual((4, 'c-4'), (r2[0], r2[1].revision_id))  | 
|
101  | 
self.assertEqual((5, 'c-5'), (r3[0], r3[1].revision_id))  | 
|
102  | 
||
103  | 
delta0 = r0[2]  | 
|
104  | 
self.assertNotEqual(None, delta0)  | 
|
105  | 
self.assertEqual([('b', 'b-id', 'file')], delta0.added)  | 
|
106  | 
self.assertEqual([], delta0.removed)  | 
|
107  | 
self.assertEqual([], delta0.renamed)  | 
|
108  | 
self.assertEqual([], delta0.modified)  | 
|
109  | 
||
110  | 
delta1 = r1[2]  | 
|
111  | 
self.assertNotEqual(None, delta1)  | 
|
112  | 
self.assertEqual([], delta1.added)  | 
|
113  | 
self.assertEqual([('a', 'a-id', 'file')], delta1.removed)  | 
|
114  | 
self.assertEqual([], delta1.renamed)  | 
|
115  | 
self.assertEqual([], delta1.modified)  | 
|
116  | 
||
117  | 
delta2 = r2[2]  | 
|
118  | 
self.assertNotEqual(None, delta2)  | 
|
119  | 
self.assertEqual([], delta2.added)  | 
|
120  | 
self.assertEqual([], delta2.removed)  | 
|
121  | 
self.assertEqual([], delta2.renamed)  | 
|
122  | 
self.assertEqual([('b', 'b-id', 'file', True, False)], delta2.modified)  | 
|
123  | 
||
124  | 
delta3 = r3[2]  | 
|
125  | 
self.assertNotEqual(None, delta3)  | 
|
126  | 
self.assertEqual([], delta3.added)  | 
|
127  | 
self.assertEqual([], delta3.removed)  | 
|
128  | 
self.assertEqual([('b', 'c', 'b-id', 'file', False, False)],  | 
|
129  | 
delta3.renamed)  | 
|
130  | 
self.assertEqual([], delta3.modified)  | 
|
131  | 
||
| 
2466.8.1
by Kent Gibson
 Reworked LogFormatter API to simplify extending the attributes of the revision being logged. Added support for begin_log() and end_log() hooks in LogFormatters.  | 
132  | 
def test_iter_log_revisions(self):  | 
| 
2204.1.1
by John Arbash Meinel
 'bzr missing -v' was showing adds as deletes.  | 
133  | 
base_tree = self.make_branch_and_tree('base')  | 
134  | 
self.build_tree(['base/a'])  | 
|
135  | 
base_tree.add(['a'], ['a-id'])  | 
|
136  | 
base_tree.commit('add a', rev_id='b-1')  | 
|
137  | 
||
138  | 
child_tree = base_tree.bzrdir.sprout('child').open_workingtree()  | 
|
139  | 
||
140  | 
self.build_tree(['child/b'])  | 
|
141  | 
child_tree.add(['b'], ['b-id'])  | 
|
142  | 
child_tree.commit('adding b', rev_id='c-2')  | 
|
143  | 
||
144  | 
child_tree.remove(['a'])  | 
|
145  | 
child_tree.commit('removing a', rev_id='c-3')  | 
|
146  | 
||
147  | 
self.build_tree_contents([('child/b', 'new contents for b\n')])  | 
|
148  | 
child_tree.commit('modifying b', rev_id='c-4')  | 
|
149  | 
||
150  | 
child_tree.rename_one('b', 'c')  | 
|
151  | 
child_tree.commit('rename b=>c', rev_id='c-5')  | 
|
152  | 
||
153  | 
base_extra, child_extra = find_unmerged(base_tree.branch,  | 
|
154  | 
child_tree.branch)  | 
|
| 
2466.8.1
by Kent Gibson
 Reworked LogFormatter API to simplify extending the attributes of the revision being logged. Added support for begin_log() and end_log() hooks in LogFormatters.  | 
155  | 
results = list(iter_log_revisions(base_extra,  | 
156  | 
base_tree.branch.repository,  | 
|
157  | 
verbose=True))  | 
|
| 
2204.1.1
by John Arbash Meinel
 'bzr missing -v' was showing adds as deletes.  | 
158  | 
self.assertEqual([], results)  | 
159  | 
||
| 
2466.8.1
by Kent Gibson
 Reworked LogFormatter API to simplify extending the attributes of the revision being logged. Added support for begin_log() and end_log() hooks in LogFormatters.  | 
160  | 
results = list(iter_log_revisions(child_extra,  | 
161  | 
child_tree.branch.repository,  | 
|
162  | 
verbose=True))  | 
|
| 
2204.1.1
by John Arbash Meinel
 'bzr missing -v' was showing adds as deletes.  | 
163  | 
self.assertEqual(4, len(results))  | 
164  | 
||
165  | 
r0,r1,r2,r3 = results  | 
|
166  | 
||
| 
2466.8.1
by Kent Gibson
 Reworked LogFormatter API to simplify extending the attributes of the revision being logged. Added support for begin_log() and end_log() hooks in LogFormatters.  | 
167  | 
self.assertEqual((2, 'c-2'), (r0.revno, r0.rev.revision_id))  | 
168  | 
self.assertEqual((3, 'c-3'), (r1.revno, r1.rev.revision_id))  | 
|
169  | 
self.assertEqual((4, 'c-4'), (r2.revno, r2.rev.revision_id))  | 
|
170  | 
self.assertEqual((5, 'c-5'), (r3.revno, r3.rev.revision_id))  | 
|
| 
2204.1.1
by John Arbash Meinel
 'bzr missing -v' was showing adds as deletes.  | 
171  | 
|
| 
2466.8.1
by Kent Gibson
 Reworked LogFormatter API to simplify extending the attributes of the revision being logged. Added support for begin_log() and end_log() hooks in LogFormatters.  | 
172  | 
delta0 = r0.delta  | 
| 
2204.1.1
by John Arbash Meinel
 'bzr missing -v' was showing adds as deletes.  | 
173  | 
self.assertNotEqual(None, delta0)  | 
174  | 
self.assertEqual([('b', 'b-id', 'file')], delta0.added)  | 
|
175  | 
self.assertEqual([], delta0.removed)  | 
|
176  | 
self.assertEqual([], delta0.renamed)  | 
|
177  | 
self.assertEqual([], delta0.modified)  | 
|
178  | 
||
| 
2466.8.1
by Kent Gibson
 Reworked LogFormatter API to simplify extending the attributes of the revision being logged. Added support for begin_log() and end_log() hooks in LogFormatters.  | 
179  | 
delta1 = r1.delta  | 
| 
2204.1.1
by John Arbash Meinel
 'bzr missing -v' was showing adds as deletes.  | 
180  | 
self.assertNotEqual(None, delta1)  | 
181  | 
self.assertEqual([], delta1.added)  | 
|
182  | 
self.assertEqual([('a', 'a-id', 'file')], delta1.removed)  | 
|
183  | 
self.assertEqual([], delta1.renamed)  | 
|
184  | 
self.assertEqual([], delta1.modified)  | 
|
185  | 
||
| 
2466.8.1
by Kent Gibson
 Reworked LogFormatter API to simplify extending the attributes of the revision being logged. Added support for begin_log() and end_log() hooks in LogFormatters.  | 
186  | 
delta2 = r2.delta  | 
| 
2204.1.1
by John Arbash Meinel
 'bzr missing -v' was showing adds as deletes.  | 
187  | 
self.assertNotEqual(None, delta2)  | 
188  | 
self.assertEqual([], delta2.added)  | 
|
189  | 
self.assertEqual([], delta2.removed)  | 
|
190  | 
self.assertEqual([], delta2.renamed)  | 
|
191  | 
self.assertEqual([('b', 'b-id', 'file', True, False)], delta2.modified)  | 
|
192  | 
||
| 
2466.8.1
by Kent Gibson
 Reworked LogFormatter API to simplify extending the attributes of the revision being logged. Added support for begin_log() and end_log() hooks in LogFormatters.  | 
193  | 
delta3 = r3.delta  | 
| 
2204.1.1
by John Arbash Meinel
 'bzr missing -v' was showing adds as deletes.  | 
194  | 
self.assertNotEqual(None, delta3)  | 
195  | 
self.assertEqual([], delta3.added)  | 
|
196  | 
self.assertEqual([], delta3.removed)  | 
|
197  | 
self.assertEqual([('b', 'c', 'b-id', 'file', False, False)],  | 
|
198  | 
delta3.renamed)  | 
|
199  | 
self.assertEqual([], delta3.modified)  |