/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_annotate.py

  • Committer: John Arbash Meinel
  • Date: 2006-12-13 22:23:27 UTC
  • mto: This revision was merged to the branch mainline in revision 2186.
  • Revision ID: john@arbash-meinel.com-20061213222327-qikhtcopbp1mf5hg
add show-ids and test that nearby areas are collapsed without full

Show diffs side-by-side

added added

removed removed

Lines of Context:
66
66
        tree1.commit('noop merge', rev_id='rev-4')
67
67
 
68
68
        self.build_tree_contents([('tree3/a', 'first\nthird\nfourth\n')])
69
 
        tree3.commit('four', rev_id='rev-1.1.1.1.1',
 
69
        tree3.commit('four', rev_id='rev-1_1_1_1_1',
70
70
                     committer='jerry@foo.com', timestamp=1166046003.00)
71
71
 
72
72
        tree4 = tree3.bzrdir.clone('tree4').open_workingtree()
76
76
        self.assertEqual(0, tree1.merge_from_branch(tree3.branch))
77
77
        tree1.commit('merge four', rev_id='rev-5')
78
78
 
79
 
        self.build_tree_contents([('tree4/a', 'first\nthird\nfourth\nfifth\n')])
80
 
        tree4.commit('five', rev_id='rev-1.1.1.1.1.1.1',
 
79
        self.build_tree_contents([('tree4/a',
 
80
                                   'first\nthird\nfourth\nfifth\nsixth\n')])
 
81
        tree4.commit('five and six', rev_id='rev-1_1_1_1_1_1_1',
81
82
                     committer='george@foo.com', timestamp=1166046005.00)
82
83
        self.assertEqual(0, tree1.merge_from_branch(tree4.branch))
83
 
        tree1.commit('merge five', rev_id='rev-6')
 
84
        tree1.commit('merge five and six', rev_id='rev-6')
84
85
        return tree1
85
86
 
86
87
    def test_annotate_shows_dotted_revnos(self):
100
101
 
101
102
        sio = StringIO()
102
103
        annotate.annotate_file(tree1.branch, 'rev-6', 'a-id',
103
 
                               to_file=sio)
104
 
        self.assertEqualDiff('1            joe@foo | first\n'
105
 
                             '2            joe@foo | second\n'
106
 
                             '1.1.1        barry@f | third\n'
107
 
                             '1.1.1.1.1    jerry@f | fourth\n'
108
 
                             '1.1.1.1.1.1> george@ | fifth\n',
 
104
                               to_file=sio, verbose=False, full=False)
 
105
        self.assertEqualDiff('1            joe@foo | first\n'
 
106
                             '2            joe@foo | second\n'
 
107
                             '1.1.1        barry@f | third\n'
 
108
                             '1.1.1.1.1    jerry@f | fourth\n'
 
109
                             '1.1.1.1.1.1> george@ | fifth\n'
 
110
                             '                     | sixth\n',
 
111
                             sio.getvalue())
 
112
 
 
113
        sio = StringIO()
 
114
        annotate.annotate_file(tree1.branch, 'rev-6', 'a-id',
 
115
                               to_file=sio, verbose=False, full=True)
 
116
        self.assertEqualDiff('1            joe@foo | first\n'
 
117
                             '2            joe@foo | second\n'
 
118
                             '1.1.1        barry@f | third\n'
 
119
                             '1.1.1.1.1    jerry@f | fourth\n'
 
120
                             '1.1.1.1.1.1> george@ | fifth\n'
 
121
                             '1.1.1.1.1.1> george@ | sixth\n',
109
122
                             sio.getvalue())
110
123
 
111
124
        # verbose=True shows everything, the full revno, user id, and date
112
125
        sio = StringIO()
113
126
        annotate.annotate_file(tree1.branch, 'rev-6', 'a-id',
114
 
                               to_file=sio, verbose=True)
115
 
        self.assertEqualDiff('1             joe@foo.com    20061213 | first\n'
116
 
                             '2             joe@foo.com    20061213 | second\n'
117
 
                             '1.1.1         barry@foo.com  20061213 | third\n'
118
 
                             '1.1.1.1.1     jerry@foo.com  20061213 | fourth\n'
119
 
                             '1.1.1.1.1.1.1 george@foo.com 20061213 | fifth\n',
 
127
                               to_file=sio, verbose=True, full=False)
 
128
        self.assertEqualDiff('1             joe@foo.com    20061213 | first\n'
 
129
                             '2             joe@foo.com    20061213 | second\n'
 
130
                             '1.1.1         barry@foo.com  20061213 | third\n'
 
131
                             '1.1.1.1.1     jerry@foo.com  20061213 | fourth\n'
 
132
                             '1.1.1.1.1.1.1 george@foo.com 20061213 | fifth\n'
 
133
                             '                                      | sixth\n',
 
134
                             sio.getvalue())
 
135
 
 
136
        sio = StringIO()
 
137
        annotate.annotate_file(tree1.branch, 'rev-6', 'a-id',
 
138
                               to_file=sio, verbose=True, full=True)
 
139
        self.assertEqualDiff('1             joe@foo.com    20061213 | first\n'
 
140
                             '2             joe@foo.com    20061213 | second\n'
 
141
                             '1.1.1         barry@foo.com  20061213 | third\n'
 
142
                             '1.1.1.1.1     jerry@foo.com  20061213 | fourth\n'
 
143
                             '1.1.1.1.1.1.1 george@foo.com 20061213 | fifth\n'
 
144
                             '1.1.1.1.1.1.1 george@foo.com 20061213 | sixth\n',
 
145
                             sio.getvalue())
 
146
    
 
147
    def test_annotate_show_ids(self):
 
148
        tree1 = self.create_deeply_merged_trees()
 
149
 
 
150
        sio = StringIO()
 
151
        annotate.annotate_file(tree1.branch, 'rev-6', 'a-id',
 
152
                               to_file=sio, show_ids=True, full=False)
 
153
 
 
154
        # It looks better with real revision ids :)
 
155
        self.assertEqualDiff('            rev-1 | first\n'
 
156
                             '            rev-2 | second\n'
 
157
                             '        rev-1_1_1 | third\n'
 
158
                             '    rev-1_1_1_1_1 | fourth\n'
 
159
                             'rev-1_1_1_1_1_1_1 | fifth\n'
 
160
                             '                  | sixth\n',
 
161
                             sio.getvalue())
 
162
 
 
163
        sio = StringIO()
 
164
        annotate.annotate_file(tree1.branch, 'rev-6', 'a-id',
 
165
                               to_file=sio, show_ids=True, full=True)
 
166
 
 
167
        self.assertEqualDiff('            rev-1 | first\n'
 
168
                             '            rev-2 | second\n'
 
169
                             '        rev-1_1_1 | third\n'
 
170
                             '    rev-1_1_1_1_1 | fourth\n'
 
171
                             'rev-1_1_1_1_1_1_1 | fifth\n'
 
172
                             'rev-1_1_1_1_1_1_1 | sixth\n',
120
173
                             sio.getvalue())