~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_annotate.py

  • Committer: John Arbash Meinel
  • Date: 2007-01-29 21:11:28 UTC
  • mto: This revision was merged to the branch mainline in revision 2255.
  • Revision ID: john@arbash-meinel.com-20070129211128-hg0myfxd22jwg38t
bzr annotate should use Branch's dotted revnos.
Not the dotted revnos from the last modification of the file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
101
101
class TestAnnotate(tests.TestCaseWithTransport):
102
102
 
103
103
    def create_merged_trees(self):
 
104
        """create 2 trees with merges between them.
 
105
 
 
106
        rev-1 --+
 
107
         |      |
 
108
        rev-2  rev-1_1_1
 
109
         |      |
 
110
         +------+
 
111
         |
 
112
        rev-3
 
113
        """
 
114
 
104
115
        tree1 = self.make_branch_and_tree('tree1')
105
116
        self.build_tree_contents([('tree1/a', 'first\n')])
106
117
        tree1.add(['a'], ['a-id'])
132
143
        return tree1, tree2
133
144
 
134
145
    def create_deeply_merged_trees(self):
 
146
        """Create some trees with a more complex merge history.
 
147
 
 
148
        rev-1 --+
 
149
         |      |
 
150
        rev-2  rev-1_1_1 --+
 
151
         |      |          |
 
152
         +------+          |
 
153
         |      |          |
 
154
        rev-3  rev-1_1_2  rev-1_1_1_1_1 --+
 
155
         |      |          |              |
 
156
         +------+          |              |
 
157
         |                 |              |
 
158
        rev-4             rev-1_1_1_1_2  rev-1_1_1_1_1_1_1
 
159
         |                 |              |
 
160
         +-----------------+              |
 
161
         |                                |
 
162
        rev-5                             |
 
163
         |                                |
 
164
         +--------------------------------+
 
165
         |
 
166
        rev-6
 
167
        """
135
168
        tree1, tree2 = self.create_merged_trees()
136
169
 
137
170
        tree3 = tree2.bzrdir.clone('tree3').open_workingtree()
138
171
 
139
 
        tree2.commit('noop', rev_id='rev-1.1.2')
 
172
        tree2.commit('noop', rev_id='rev-1_1_2')
140
173
        self.assertEqual(0, tree1.merge_from_branch(tree2.branch))
141
174
        tree1.commit('noop merge', rev_id='rev-4')
142
175
 
147
180
 
148
181
        tree4 = tree3.bzrdir.clone('tree4').open_workingtree()
149
182
 
150
 
        tree3.commit('noop', rev_id='rev-1.1.1.1.2',
 
183
        tree3.commit('noop', rev_id='rev-1_1_1_1_2',
151
184
                     committer='jerry@foo.com',
152
185
                     timestamp=1166046004.00, timezone=0)
153
186
        self.assertEqual(0, tree1.merge_from_branch(tree3.branch))
221
254
                             '1.1.1.1.1.1.1 george@foo.com 20061213 | fifth\n'
222
255
                             '1.1.1.1.1.1.1 george@foo.com 20061213 | sixth\n',
223
256
                             sio.getvalue())
224
 
    
 
257
 
 
258
    def test_annotate_uses_branch_context(self):
 
259
        """Dotted revnos should use the Branch context.
 
260
 
 
261
        When annotating a non-mainline revision, the annotation should still
 
262
        use dotted revnos from the mainline.
 
263
        """
 
264
        tree1 = self.create_deeply_merged_trees()
 
265
 
 
266
        sio = StringIO()
 
267
        annotate.annotate_file(tree1.branch, 'rev-1_1_1_1_1_1_1', 'a-id',
 
268
                               to_file=sio, verbose=False, full=False)
 
269
        self.assertEqualDiff('1            joe@foo | first\n'
 
270
                             '1.1.1        barry@f | third\n'
 
271
                             '1.1.1.1.1    jerry@f | fourth\n'
 
272
                             '1.1.1.1.1.1> george@ | fifth\n'
 
273
                             '                     | sixth\n',
 
274
                             sio.getvalue())
 
275
 
225
276
    def test_annotate_show_ids(self):
226
277
        tree1 = self.create_deeply_merged_trees()
227
278