/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
1551.10.18 by Aaron Bentley
Log works in local treeless branches (#84247)
1
# Copyright (C) 2005, 2006, 2007 Canonical Ltd
1540.2.6 by Robey Pointer
make 'log' and 'status' treat '-r N..' as implicitly '-r N..-1'
2
# -*- coding: utf-8 -*-
1887.1.1 by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines,
3
#
1540.2.6 by Robey Pointer
make 'log' and 'status' treat '-r N..' as implicitly '-r N..-1'
4
# This program is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation; either version 2 of the License, or
7
# (at your option) any later version.
1887.1.1 by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines,
8
#
1540.2.6 by Robey Pointer
make 'log' and 'status' treat '-r N..' as implicitly '-r N..-1'
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
# GNU General Public License for more details.
1887.1.1 by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines,
13
#
1540.2.6 by Robey Pointer
make 'log' and 'status' treat '-r N..' as implicitly '-r N..-1'
14
# You should have received a copy of the GNU General Public License
15
# along with this program; if not, write to the Free Software
16
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
18
1624.1.3 by Robert Collins
Convert log to use the new tsort.merge_sort routine.
19
"""Black-box tests for bzr log."""
1540.2.6 by Robey Pointer
make 'log' and 'status' treat '-r N..' as implicitly '-r N..-1'
20
3940.1.2 by Ian Clatworthy
add test
21
import os, re
1540.2.6 by Robey Pointer
make 'log' and 'status' treat '-r N..' as implicitly '-r N..-1'
22
3224.5.4 by Andrew Bennetts
Fix test suite, mainly weeding out uses of bzrlib.user_encoding.
23
from bzrlib import osutils
1540.2.6 by Robey Pointer
make 'log' and 'status' treat '-r N..' as implicitly '-r N..-1'
24
from bzrlib.tests.blackbox import ExternalBase
1551.10.18 by Aaron Bentley
Log works in local treeless branches (#84247)
25
from bzrlib.tests import TestCaseInTempDir, TestCaseWithTransport
2978.6.1 by Kent Gibson
Use normalize_log to more accurately test blackbox log output.
26
from bzrlib.tests.test_log import (
27
    normalize_log,
28
    )
3144.7.9 by Guillermo Gonzalez
* bzrlib.log.show_roperties don't hide handler errors
29
from bzrlib.tests import test_log
30
31
3842.2.5 by Vincent Ladeuil
Better fix for bug #300055.
32
class TestCaseWithoutPropsHandler(ExternalBase,
33
                                  test_log.TestCaseWithoutPropsHandler):
3144.7.9 by Guillermo Gonzalez
* bzrlib.log.show_roperties don't hide handler errors
34
    pass
1540.2.6 by Robey Pointer
make 'log' and 'status' treat '-r N..' as implicitly '-r N..-1'
35
36
37
class TestLog(ExternalBase):
38
2664.14.1 by Daniel Watkins
Fixed tests.blackbox.test_log to use internals where appropriate.
39
    def _prepare(self, path='.', format=None):
2809.1.2 by Daniel Watkins
Removed unnecessary check as per abentley's on-list comments.
40
        tree = self.make_branch_and_tree(path, format=format)
2664.14.1 by Daniel Watkins
Fixed tests.blackbox.test_log to use internals where appropriate.
41
        self.build_tree(
42
            [path + '/hello.txt', path + '/goodbye.txt', path + '/meep.txt'])
43
        tree.add('hello.txt')
44
        tree.commit(message='message1')
45
        tree.add('goodbye.txt')
46
        tree.commit(message='message2')
47
        tree.add('meep.txt')
48
        tree.commit(message='message3')
49
        self.full_log = self.run_bzr(["log", path])[0]
50
        return tree
1553.4.2 by Michael Ellerman
Make bzr log -r .. work, fixes bug #4609. Add a bunch of tests to make sure
51
52
    def test_log_null_end_revspec(self):
53
        self._prepare()
54
        self.assertTrue('revno: 1\n' in self.full_log)
55
        self.assertTrue('revno: 2\n' in self.full_log)
56
        self.assertTrue('revno: 3\n' in self.full_log)
57
        self.assertTrue('message:\n  message1\n' in self.full_log)
58
        self.assertTrue('message:\n  message2\n' in self.full_log)
59
        self.assertTrue('message:\n  message3\n' in self.full_log)
60
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
61
        log = self.run_bzr("log -r 1..")[0]
2466.11.2 by Kent Gibson
Add tests for deltas in merge revisions
62
        self.assertEqualDiff(log, self.full_log)
1553.4.2 by Michael Ellerman
Make bzr log -r .. work, fixes bug #4609. Add a bunch of tests to make sure
63
64
    def test_log_null_begin_revspec(self):
65
        self._prepare()
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
66
        log = self.run_bzr("log -r ..3")[0]
2466.11.2 by Kent Gibson
Add tests for deltas in merge revisions
67
        self.assertEqualDiff(self.full_log, log)
1553.4.2 by Michael Ellerman
Make bzr log -r .. work, fixes bug #4609. Add a bunch of tests to make sure
68
69
    def test_log_null_both_revspecs(self):
70
        self._prepare()
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
71
        log = self.run_bzr("log -r ..")[0]
2466.11.2 by Kent Gibson
Add tests for deltas in merge revisions
72
        self.assertEqualDiff(self.full_log, log)
1553.4.2 by Michael Ellerman
Make bzr log -r .. work, fixes bug #4609. Add a bunch of tests to make sure
73
2978.4.1 by Kent Gibson
Logging revision 0 returns error.
74
    def test_log_zero_revspec(self):
75
        self._prepare()
76
        self.run_bzr_error('bzr: ERROR: Logging revision 0 is invalid.',
77
                           ['log', '-r0'])
78
79
    def test_log_zero_begin_revspec(self):
80
        self._prepare()
81
        self.run_bzr_error('bzr: ERROR: Logging revision 0 is invalid.',
82
                           ['log', '-r0..2'])
83
84
    def test_log_zero_end_revspec(self):
85
        self._prepare()
86
        self.run_bzr_error('bzr: ERROR: Logging revision 0 is invalid.',
87
                           ['log', '-r-2..0'])
88
3144.1.1 by Lukáš Lalinský
Fixed error reporting of unsupported timezone format.
89
    def test_log_unsupported_timezone(self):
90
        self._prepare()
91
        self.run_bzr_error('bzr: ERROR: Unsupported timezone format "foo", '
92
                           'options are "utc", "original", "local".',
93
                           ['log', '--timezone', 'foo'])
94
1553.4.2 by Michael Ellerman
Make bzr log -r .. work, fixes bug #4609. Add a bunch of tests to make sure
95
    def test_log_negative_begin_revspec_full_log(self):
96
        self._prepare()
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
97
        log = self.run_bzr("log -r -3..")[0]
2466.11.2 by Kent Gibson
Add tests for deltas in merge revisions
98
        self.assertEqualDiff(self.full_log, log)
1553.4.2 by Michael Ellerman
Make bzr log -r .. work, fixes bug #4609. Add a bunch of tests to make sure
99
100
    def test_log_negative_both_revspec_full_log(self):
101
        self._prepare()
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
102
        log = self.run_bzr("log -r -3..-1")[0]
2466.11.2 by Kent Gibson
Add tests for deltas in merge revisions
103
        self.assertEqualDiff(self.full_log, log)
1553.4.2 by Michael Ellerman
Make bzr log -r .. work, fixes bug #4609. Add a bunch of tests to make sure
104
105
    def test_log_negative_both_revspec_partial(self):
106
        self._prepare()
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
107
        log = self.run_bzr("log -r -3..-2")[0]
1553.4.2 by Michael Ellerman
Make bzr log -r .. work, fixes bug #4609. Add a bunch of tests to make sure
108
        self.assertTrue('revno: 1\n' in log)
109
        self.assertTrue('revno: 2\n' in log)
110
        self.assertTrue('revno: 3\n' not in log)
111
112
    def test_log_negative_begin_revspec(self):
113
        self._prepare()
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
114
        log = self.run_bzr("log -r -2..")[0]
1553.4.2 by Michael Ellerman
Make bzr log -r .. work, fixes bug #4609. Add a bunch of tests to make sure
115
        self.assertTrue('revno: 1\n' not in log)
116
        self.assertTrue('revno: 2\n' in log)
117
        self.assertTrue('revno: 3\n' in log)
118
2978.4.1 by Kent Gibson
Logging revision 0 returns error.
119
    def test_log_positive_revspecs(self):
1553.4.2 by Michael Ellerman
Make bzr log -r .. work, fixes bug #4609. Add a bunch of tests to make sure
120
        self._prepare()
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
121
        log = self.run_bzr("log -r 1..3")[0]
2466.11.2 by Kent Gibson
Add tests for deltas in merge revisions
122
        self.assertEqualDiff(self.full_log, log)
1624.1.3 by Robert Collins
Convert log to use the new tsort.merge_sort routine.
123
2466.12.1 by Kent Gibson
Fix ``bzr log -r`` to support selecting merge revisions.
124
    def test_log_reversed_revspecs(self):
125
        self._prepare()
126
        self.run_bzr_error(('bzr: ERROR: Start revision must be older than '
127
                            'the end revision.\n',),
2581.1.6 by Martin Pool
fix up more run_bzr callers
128
                           ['log', '-r3..1'])
2466.12.1 by Kent Gibson
Fix ``bzr log -r`` to support selecting merge revisions.
129
1907.4.2 by Matthieu Moy
Make log work nicely with revno:N:path too.
130
    def test_log_revno_n_path(self):
2664.14.1 by Daniel Watkins
Fixed tests.blackbox.test_log to use internals where appropriate.
131
        self._prepare(path='branch1')
132
        self._prepare(path='branch2')
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
133
        log = self.run_bzr("log -r revno:2:branch1..revno:3:branch2",
1907.4.2 by Matthieu Moy
Make log work nicely with revno:N:path too.
134
                          retcode=3)[0]
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
135
        log = self.run_bzr("log -r revno:1:branch2..revno:3:branch2")[0]
2466.11.2 by Kent Gibson
Add tests for deltas in merge revisions
136
        self.assertEqualDiff(self.full_log, log)
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
137
        log = self.run_bzr("log -r revno:1:branch2")[0]
1907.4.2 by Matthieu Moy
Make log work nicely with revno:N:path too.
138
        self.assertTrue('revno: 1\n' in log)
139
        self.assertTrue('revno: 2\n' not in log)
140
        self.assertTrue('branch nick: branch2\n' in log)
141
        self.assertTrue('branch nick: branch1\n' not in log)
3734.1.1 by Vincent Ladeuil
Fix bug #248427 by adding a --change option to log.
142
3878.3.3 by Marius Kruger
Add tests for log -r with non-exising revno's
143
    def test_log_nonexistent_revno(self):
144
        self._prepare()
145
        (out, err) = self.run_bzr_error(args="log -r 1234",
146
            error_regexes=["bzr: ERROR: Requested revision: '1234' "
147
                "does not exist in branch:"])
148
149
    def test_log_nonexistent_dotted_revno(self):
150
        self._prepare()
151
        (out, err) = self.run_bzr_error(args="log -r 123.123",
152
            error_regexes=["bzr: ERROR: Requested revision: '123.123' "
153
                "does not exist in branch:"])
154
3734.1.1 by Vincent Ladeuil
Fix bug #248427 by adding a --change option to log.
155
    def test_log_change_revno(self):
156
        self._prepare()
157
        expected_log = self.run_bzr("log -r 1")[0]
158
        log = self.run_bzr("log -c 1")[0]
159
        self.assertEqualDiff(expected_log, log)
160
3878.3.2 by Marius Kruger
Add tests for log -c with non-exising revno's
161
    def test_log_change_nonexistent_revno(self):
162
        self._prepare()
163
        (out, err) = self.run_bzr_error(args="log -c 1234",
164
            error_regexes=["bzr: ERROR: Requested revision: '1234' "
165
                "does not exist in branch:"])
166
167
    def test_log_change_nonexistent_dotted_revno(self):
168
        self._prepare()
169
        (out, err) = self.run_bzr_error(args="log -c 123.123",
170
            error_regexes=["bzr: ERROR: Requested revision: '123.123' "
171
                "does not exist in branch:"])
172
3734.1.1 by Vincent Ladeuil
Fix bug #248427 by adding a --change option to log.
173
    def test_log_change_single_revno(self):
174
        self._prepare()
175
        self.run_bzr_error('bzr: ERROR: Option --change does not'
176
                           ' accept revision ranges',
177
                           ['log', '--change', '2..3'])
178
179
    def test_log_change_incompatible_with_revision(self):
180
        self._prepare()
181
        self.run_bzr_error('bzr: ERROR: --revision and --change'
182
                           ' are mutually exclusive',
183
                           ['log', '--change', '2', '--revision', '3'])
184
2100.1.1 by wang
Running ``bzr log`` on nonexistent file gives an error instead of the
185
    def test_log_nonexistent_file(self):
186
        # files that don't exist in either the basis tree or working tree
187
        # should give an error
188
        wt = self.make_branch_and_tree('.')
2552.2.3 by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests.
189
        out, err = self.run_bzr('log does-not-exist', retcode=3)
2100.1.1 by wang
Running ``bzr log`` on nonexistent file gives an error instead of the
190
        self.assertContainsRe(
191
            err, 'Path does not have any revision history: does-not-exist')
2388.1.11 by Alexander Belchenko
changes after John's review
192
2388.1.3 by Erik Bagfors
tests for tags in log output
193
    def test_log_with_tags(self):
2664.14.1 by Daniel Watkins
Fixed tests.blackbox.test_log to use internals where appropriate.
194
        tree = self._prepare(format='dirstate-tags')
195
        branch = tree.branch
196
        branch.tags.set_tag('tag1', branch.get_rev_id(1))
197
        branch.tags.set_tag('tag1.1', branch.get_rev_id(1))
3842.2.5 by Vincent Ladeuil
Better fix for bug #300055.
198
        branch.tags.set_tag('tag3', branch.last_revision())
199
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
200
        log = self.run_bzr("log -r-1")[0]
2388.1.3 by Erik Bagfors
tests for tags in log output
201
        self.assertTrue('tags: tag3' in log)
202
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
203
        log = self.run_bzr("log -r1")[0]
2388.1.3 by Erik Bagfors
tests for tags in log output
204
        # I guess that we can't know the order of tags in the output
205
        # since dicts are unordered, need to check both possibilities
2388.1.11 by Alexander Belchenko
changes after John's review
206
        self.assertContainsRe(log, r'tags: (tag1, tag1\.1|tag1\.1, tag1)')
207
2388.1.9 by Erik Bagfors
test for merges with tags in log
208
    def test_merged_log_with_tags(self):
2664.14.1 by Daniel Watkins
Fixed tests.blackbox.test_log to use internals where appropriate.
209
        branch1_tree = self._prepare(path='branch1', format='dirstate-tags')
210
        branch1 = branch1_tree.branch
211
        branch2_tree = branch1_tree.bzrdir.sprout('branch2').open_workingtree()
212
        branch1_tree.commit(message='foobar', allow_pointless=True)
213
        branch1.tags.set_tag('tag1', branch1.last_revision())
214
        os.chdir('branch2')
215
        self.run_bzr('merge ../branch1') # tags don't propagate otherwise
216
        branch2_tree.commit(message='merge branch 1')
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
217
        log = self.run_bzr("log -r-1")[0]
2388.1.11 by Alexander Belchenko
changes after John's review
218
        self.assertContainsRe(log, r'    tags: tag1')
2578.2.1 by Andrew Bennetts
Merge Kent Gibson's fix for bug #4663, resolving conflicts.
219
        log = self.run_bzr("log -r3.1.1")[0]
2466.12.2 by Kent Gibson
shift log output with only merge revisions to the left margin
220
        self.assertContainsRe(log, r'tags: tag1')
2388.1.3 by Erik Bagfors
tests for tags in log output
221
2466.9.1 by Kent Gibson
add bzr log --limit
222
    def test_log_limit(self):
3660.1.1 by Robert Collins
Fix log --limit (broken by log filtering patch).
223
        tree = self.make_branch_and_tree('.')
224
        # We want more commits than our batch size starts at
225
        for pos in range(10):
226
            tree.commit("%s" % pos)
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
227
        log = self.run_bzr("log --limit 2")[0]
3108.1.3 by Matt Nordhoff
Use assertContainsRe/assertNotContainsRe in tests.
228
        self.assertNotContainsRe(log, r'revno: 1\n')
3660.1.1 by Robert Collins
Fix log --limit (broken by log filtering patch).
229
        self.assertNotContainsRe(log, r'revno: 2\n')
230
        self.assertNotContainsRe(log, r'revno: 3\n')
231
        self.assertNotContainsRe(log, r'revno: 4\n')
232
        self.assertNotContainsRe(log, r'revno: 5\n')
233
        self.assertNotContainsRe(log, r'revno: 6\n')
234
        self.assertNotContainsRe(log, r'revno: 7\n')
235
        self.assertNotContainsRe(log, r'revno: 8\n')
236
        self.assertContainsRe(log, r'revno: 9\n')
237
        self.assertContainsRe(log, r'revno: 10\n')
2466.9.1 by Kent Gibson
add bzr log --limit
238
3108.1.2 by Matt Nordhoff
Simple copied unit test.
239
    def test_log_limit_short(self):
240
        self._prepare()
241
        log = self.run_bzr("log -l 2")[0]
3108.1.3 by Matt Nordhoff
Use assertContainsRe/assertNotContainsRe in tests.
242
        self.assertNotContainsRe(log, r'revno: 1\n')
243
        self.assertContainsRe(log, r'revno: 2\n')
244
        self.assertContainsRe(log, r'revno: 3\n')
3144.7.9 by Guillermo Gonzalez
* bzrlib.log.show_roperties don't hide handler errors
245
3874.1.8 by Vincent Ladeuil
Fixed as ber Robert's review.
246
247
class TestLogVerbose(TestCaseWithTransport):
248
249
    def setUp(self):
250
        super(TestLogVerbose, self).setUp()
251
        tree = self.make_branch_and_tree('.')
252
        self.build_tree(['hello.txt'])
253
        tree.add('hello.txt')
254
        tree.commit(message='message1')
255
256
    def assertUseShortDeltaFormat(self, cmd):
257
        log = self.run_bzr(cmd)[0]
258
        # Check that we use the short status format
3874.1.4 by Vincent Ladeuil
Fixed as per Aarons' comment.
259
        self.assertContainsRe(log, '(?m)^A  hello.txt$')
260
        self.assertNotContainsRe(log, '(?m)^added:$')
261
3874.1.8 by Vincent Ladeuil
Fixed as ber Robert's review.
262
    def assertUseLongDeltaFormat(self, cmd):
263
        log = self.run_bzr(cmd)[0]
264
        # Check that we use the long status format
265
        self.assertNotContainsRe(log, '(?m)^A  hello.txt$')
266
        self.assertContainsRe(log, '(?m)^added:$')
267
268
    def test_log_short_verbose(self):
269
        self.assertUseShortDeltaFormat(['log', '--short', '-v'])
270
3874.1.4 by Vincent Ladeuil
Fixed as per Aarons' comment.
271
    def test_log_short_verbose_verbose(self):
3874.1.8 by Vincent Ladeuil
Fixed as ber Robert's review.
272
        self.assertUseLongDeltaFormat(['log', '--short', '-vv'])
3874.1.4 by Vincent Ladeuil
Fixed as per Aarons' comment.
273
274
    def test_log_long_verbose(self):
3874.1.7 by Vincent Ladeuil
Restrict '-v' change to log --short only.
275
        # Check that we use the long status format, ignoring the verbosity
276
        # level
3874.1.8 by Vincent Ladeuil
Fixed as ber Robert's review.
277
        self.assertUseLongDeltaFormat(['log', '--long', '-v'])
3874.1.4 by Vincent Ladeuil
Fixed as per Aarons' comment.
278
279
    def test_log_long_verbose_verbose(self):
3874.1.7 by Vincent Ladeuil
Restrict '-v' change to log --short only.
280
        # Check that we use the long status format, ignoring the verbosity
281
        # level
3874.1.8 by Vincent Ladeuil
Fixed as ber Robert's review.
282
        self.assertUseLongDeltaFormat(['log', '--long', '-vv'])
3874.1.1 by Vincent Ladeuil
Fix #87179 by using the short status format when the short format is used for log.
283
3144.7.9 by Guillermo Gonzalez
* bzrlib.log.show_roperties don't hide handler errors
284
285
class TestLogMerges(TestCaseWithoutPropsHandler):
1624.1.3 by Robert Collins
Convert log to use the new tsort.merge_sort routine.
286
2466.12.1 by Kent Gibson
Fix ``bzr log -r`` to support selecting merge revisions.
287
    def _prepare(self):
2664.14.1 by Daniel Watkins
Fixed tests.blackbox.test_log to use internals where appropriate.
288
        parent_tree = self.make_branch_and_tree('parent')
289
        parent_tree.commit(message='first post', allow_pointless=True)
290
        child_tree = parent_tree.bzrdir.sprout('child').open_workingtree()
291
        child_tree.commit(message='branch 1', allow_pointless=True)
292
        smaller_tree = \
293
                child_tree.bzrdir.sprout('smallerchild').open_workingtree()
294
        smaller_tree.commit(message='branch 2', allow_pointless=True)
295
        child_tree.merge_from_branch(smaller_tree.branch)
296
        child_tree.commit(message='merge branch 2')
297
        parent_tree.merge_from_branch(child_tree.branch)
298
        parent_tree.commit(message='merge branch 1')
299
        os.chdir('parent')
2466.12.1 by Kent Gibson
Fix ``bzr log -r`` to support selecting merge revisions.
300
301
    def test_merges_are_indented_by_level(self):
302
        self._prepare()
1624.1.3 by Robert Collins
Convert log to use the new tsort.merge_sort routine.
303
        out,err = self.run_bzr('log')
304
        self.assertEqual('', err)
2978.6.1 by Kent Gibson
Use normalize_log to more accurately test blackbox log output.
305
        log = normalize_log(out)
306
        self.assertEqualDiff(log, """\
307
------------------------------------------------------------
308
revno: 2
309
committer: Lorem Ipsum <test@example.com>
310
branch nick: parent
311
timestamp: Just now
312
message:
313
  merge branch 1
314
    ------------------------------------------------------------
315
    revno: 1.1.2
316
    committer: Lorem Ipsum <test@example.com>
317
    branch nick: child
318
    timestamp: Just now
319
    message:
320
      merge branch 2
321
        ------------------------------------------------------------
3170.3.4 by John Arbash Meinel
Update the tests for the new revision numbering.
322
        revno: 1.2.1
2978.6.1 by Kent Gibson
Use normalize_log to more accurately test blackbox log output.
323
        committer: Lorem Ipsum <test@example.com>
324
        branch nick: smallerchild
325
        timestamp: Just now
326
        message:
327
          branch 2
328
    ------------------------------------------------------------
329
    revno: 1.1.1
330
    committer: Lorem Ipsum <test@example.com>
331
    branch nick: child
332
    timestamp: Just now
333
    message:
334
      branch 1
335
------------------------------------------------------------
336
revno: 1
337
committer: Lorem Ipsum <test@example.com>
338
branch nick: parent
339
timestamp: Just now
340
message:
341
  first post
342
""")
1685.1.5 by John Arbash Meinel
Merged test_log.py.moved into test_log.py
343
2466.12.1 by Kent Gibson
Fix ``bzr log -r`` to support selecting merge revisions.
344
    def test_merges_single_merge_rev(self):
345
        self._prepare()
2581.1.6 by Martin Pool
fix up more run_bzr callers
346
        out,err = self.run_bzr('log -r1.1.2')
2466.12.1 by Kent Gibson
Fix ``bzr log -r`` to support selecting merge revisions.
347
        self.assertEqual('', err)
2978.6.1 by Kent Gibson
Use normalize_log to more accurately test blackbox log output.
348
        log = normalize_log(out)
349
        self.assertEqualDiff(log, """\
350
------------------------------------------------------------
351
revno: 1.1.2
352
committer: Lorem Ipsum <test@example.com>
353
branch nick: child
354
timestamp: Just now
355
message:
356
  merge branch 2
357
    ------------------------------------------------------------
3170.3.4 by John Arbash Meinel
Update the tests for the new revision numbering.
358
    revno: 1.2.1
2978.6.1 by Kent Gibson
Use normalize_log to more accurately test blackbox log output.
359
    committer: Lorem Ipsum <test@example.com>
360
    branch nick: smallerchild
361
    timestamp: Just now
362
    message:
363
      branch 2
364
""")
2466.12.1 by Kent Gibson
Fix ``bzr log -r`` to support selecting merge revisions.
365
366
    def test_merges_partial_range(self):
367
        self._prepare()
3842.2.5 by Vincent Ladeuil
Better fix for bug #300055.
368
        out, err = self.run_bzr('log -r1.1.1..1.1.2')
2466.12.1 by Kent Gibson
Fix ``bzr log -r`` to support selecting merge revisions.
369
        self.assertEqual('', err)
2978.6.1 by Kent Gibson
Use normalize_log to more accurately test blackbox log output.
370
        log = normalize_log(out)
371
        self.assertEqualDiff(log, """\
372
------------------------------------------------------------
373
revno: 1.1.2
374
committer: Lorem Ipsum <test@example.com>
375
branch nick: child
376
timestamp: Just now
377
message:
378
  merge branch 2
379
    ------------------------------------------------------------
3170.3.4 by John Arbash Meinel
Update the tests for the new revision numbering.
380
    revno: 1.2.1
2978.6.1 by Kent Gibson
Use normalize_log to more accurately test blackbox log output.
381
    committer: Lorem Ipsum <test@example.com>
382
    branch nick: smallerchild
383
    timestamp: Just now
384
    message:
385
      branch 2
386
------------------------------------------------------------
387
revno: 1.1.1
388
committer: Lorem Ipsum <test@example.com>
389
branch nick: child
390
timestamp: Just now
391
message:
392
  branch 1
393
""")
2466.12.1 by Kent Gibson
Fix ``bzr log -r`` to support selecting merge revisions.
394
2978.3.1 by Kent Gibson
Return an error if the revisionspec contains merge revisions, but the log formatter doesn't support them.
395
    def test_merges_nonsupporting_formatter(self):
396
        self._prepare()
397
        err_msg = 'Selected log formatter only supports mainline revisions.'
2997.1.1 by Kent Gibson
Support logging single merge revisions with short and line log formatters.
398
        # The single revision case is tested in the core tests
399
        # since all standard formatters support single merge revisions.
2978.3.1 by Kent Gibson
Return an error if the revisionspec contains merge revisions, but the log formatter doesn't support them.
400
        out,err = self.run_bzr('log --short -r1..1.1.2', retcode=3)
401
        self.assertContainsRe(err, err_msg)
402
        out,err = self.run_bzr('log --short -r1.1.1..1.1.2', retcode=3)
403
        self.assertContainsRe(err, err_msg)
404
3842.2.5 by Vincent Ladeuil
Better fix for bug #300055.
405
3943.5.3 by Ian Clatworthy
add tests
406
def subst_dates(string):
407
    """Replace date strings with constant values."""
408
    return re.sub(r'\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} [-\+]\d{4}',
409
                  'YYYY-MM-DD HH:MM:SS +ZZZZ', string)
410
411
412
class TestLogDiff(TestCaseWithoutPropsHandler):
413
414
    def _prepare(self):
415
        parent_tree = self.make_branch_and_tree('parent')
416
        self.build_tree(['parent/file1', 'parent/file2'])
417
        parent_tree.add('file1')
418
        parent_tree.add('file2')
419
        parent_tree.commit(message='first post',
420
            timestamp=1132586655, timezone=36000,
421
            committer='Lorem Ipsum <test@example.com>')
422
        child_tree = parent_tree.bzrdir.sprout('child').open_workingtree()
423
        self.build_tree_contents([('child/file2', 'hello\n')])
424
        child_tree.commit(message='branch 1',
425
            timestamp=1132586700, timezone=36000,
426
            committer='Lorem Ipsum <test@example.com>')
427
        parent_tree.merge_from_branch(child_tree.branch)
428
        parent_tree.commit(message='merge branch 1',
429
            timestamp=1132586800, timezone=36000,
430
            committer='Lorem Ipsum <test@example.com>')
431
        os.chdir('parent')
432
433
    def test_log_show_diff_long(self):
434
        self._prepare()
3943.5.5 by Ian Clatworthy
tweak option name as requested in bug report
435
        out,err = self.run_bzr('log -p')
3943.5.3 by Ian Clatworthy
add tests
436
        self.assertEqual('', err)
437
        log = normalize_log(out)
438
        self.assertEqualDiff(subst_dates(log), """\
439
------------------------------------------------------------
440
revno: 2
441
committer: Lorem Ipsum <test@example.com>
442
branch nick: parent
443
timestamp: Just now
444
message:
445
  merge branch 1
446
diff:
3943.5.6 by Ian Clatworthy
feedback from jam's review
447
=== modified file 'file2'
448
--- file2\tYYYY-MM-DD HH:MM:SS +ZZZZ
449
+++ file2\tYYYY-MM-DD HH:MM:SS +ZZZZ
450
@@ -1,1 +1,1 @@
451
-contents of parent/file2
452
+hello
3943.5.3 by Ian Clatworthy
add tests
453
    ------------------------------------------------------------
454
    revno: 1.1.1
455
    committer: Lorem Ipsum <test@example.com>
456
    branch nick: child
457
    timestamp: Just now
458
    message:
459
      branch 1
460
    diff:
3943.5.6 by Ian Clatworthy
feedback from jam's review
461
    === modified file 'file2'
462
    --- file2\tYYYY-MM-DD HH:MM:SS +ZZZZ
463
    +++ file2\tYYYY-MM-DD HH:MM:SS +ZZZZ
464
    @@ -1,1 +1,1 @@
465
    -contents of parent/file2
466
    +hello
3943.5.3 by Ian Clatworthy
add tests
467
------------------------------------------------------------
468
revno: 1
469
committer: Lorem Ipsum <test@example.com>
470
branch nick: parent
471
timestamp: Just now
472
message:
473
  first post
474
diff:
3943.5.6 by Ian Clatworthy
feedback from jam's review
475
=== added file 'file1'
476
--- file1\tYYYY-MM-DD HH:MM:SS +ZZZZ
477
+++ file1\tYYYY-MM-DD HH:MM:SS +ZZZZ
478
@@ -0,0 +1,1 @@
479
+contents of parent/file1
480
481
=== added file 'file2'
482
--- file2\tYYYY-MM-DD HH:MM:SS +ZZZZ
483
+++ file2\tYYYY-MM-DD HH:MM:SS +ZZZZ
484
@@ -0,0 +1,1 @@
485
+contents of parent/file2
3943.5.3 by Ian Clatworthy
add tests
486
""")
487
488
    def test_log_show_diff_short(self):
489
        self._prepare()
3943.5.5 by Ian Clatworthy
tweak option name as requested in bug report
490
        out,err = self.run_bzr('log -p --short')
3943.5.3 by Ian Clatworthy
add tests
491
        self.assertEqual('', err)
492
        log = normalize_log(out)
493
        self.assertEqualDiff(subst_dates(log), """\
494
    2 Lorem Ipsum\t2005-11-22 [merge]
495
      merge branch 1
496
      === modified file 'file2'
497
      --- file2\tYYYY-MM-DD HH:MM:SS +ZZZZ
498
      +++ file2\tYYYY-MM-DD HH:MM:SS +ZZZZ
499
      @@ -1,1 +1,1 @@
500
      -contents of parent/file2
501
      +hello
502
503
    1 Lorem Ipsum\t2005-11-22
504
      first post
505
      === added file 'file1'
506
      --- file1\tYYYY-MM-DD HH:MM:SS +ZZZZ
507
      +++ file1\tYYYY-MM-DD HH:MM:SS +ZZZZ
508
      @@ -0,0 +1,1 @@
509
      +contents of parent/file1
510
      
511
      === added file 'file2'
512
      --- file2\tYYYY-MM-DD HH:MM:SS +ZZZZ
513
      +++ file2\tYYYY-MM-DD HH:MM:SS +ZZZZ
514
      @@ -0,0 +1,1 @@
515
      +contents of parent/file2
516
517
""")
518
519
    def test_log_show_diff_line(self):
520
        self._prepare()
3943.5.5 by Ian Clatworthy
tweak option name as requested in bug report
521
        out,err = self.run_bzr('log -p --line')
3943.5.3 by Ian Clatworthy
add tests
522
        self.assertEqual('', err)
523
        log = normalize_log(out)
524
        # Not supported by this formatter so expect plain output
525
        self.assertEqualDiff(subst_dates(log), """\
526
2: Lorem Ipsum 2005-11-22 merge branch 1
527
1: Lorem Ipsum 2005-11-22 first post
528
""")
529
3943.5.4 by Ian Clatworthy
filter diff by file
530
    def test_log_show_diff_file(self):
531
        """Only the diffs for the given file are to be shown"""
532
        self._prepare()
3943.5.5 by Ian Clatworthy
tweak option name as requested in bug report
533
        out,err = self.run_bzr('log -p --short file2')
3943.5.4 by Ian Clatworthy
filter diff by file
534
        self.assertEqual('', err)
535
        log = normalize_log(out)
536
        self.assertEqualDiff(subst_dates(log), """\
537
    2 Lorem Ipsum\t2005-11-22 [merge]
538
      merge branch 1
539
      === modified file 'file2'
540
      --- file2\tYYYY-MM-DD HH:MM:SS +ZZZZ
541
      +++ file2\tYYYY-MM-DD HH:MM:SS +ZZZZ
542
      @@ -1,1 +1,1 @@
543
      -contents of parent/file2
544
      +hello
545
546
    1 Lorem Ipsum\t2005-11-22
547
      first post
548
      === added file 'file2'
549
      --- file2\tYYYY-MM-DD HH:MM:SS +ZZZZ
550
      +++ file2\tYYYY-MM-DD HH:MM:SS +ZZZZ
551
      @@ -0,0 +1,1 @@
552
      +contents of parent/file2
553
554
""")
3943.5.5 by Ian Clatworthy
tweak option name as requested in bug report
555
        out,err = self.run_bzr('log -p --short file1')
3943.5.4 by Ian Clatworthy
filter diff by file
556
        self.assertEqual('', err)
557
        log = normalize_log(out)
558
        self.assertEqualDiff(subst_dates(log), """\
559
    1 Lorem Ipsum\t2005-11-22
560
      first post
561
      === added file 'file1'
562
      --- file1\tYYYY-MM-DD HH:MM:SS +ZZZZ
563
      +++ file1\tYYYY-MM-DD HH:MM:SS +ZZZZ
564
      @@ -0,0 +1,1 @@
565
      +contents of parent/file1
566
567
""")
568
3943.5.3 by Ian Clatworthy
add tests
569
1685.1.5 by John Arbash Meinel
Merged test_log.py.moved into test_log.py
570
class TestLogEncodings(TestCaseInTempDir):
571
572
    _mu = u'\xb5'
573
    _message = u'Message with \xb5'
574
575
    # Encodings which can encode mu
576
    good_encodings = [
577
        'utf-8',
578
        'latin-1',
579
        'iso-8859-1',
580
        'cp437', # Common windows encoding
581
        'cp1251', # Alexander Belchenko's windows encoding
582
        'cp1258', # Common windows encoding
583
    ]
584
    # Encodings which cannot encode mu
585
    bad_encodings = [
586
        'ascii',
587
        'iso-8859-2',
588
        'koi8_r',
589
    ]
590
591
    def setUp(self):
592
        TestCaseInTempDir.setUp(self)
3224.5.4 by Andrew Bennetts
Fix test suite, mainly weeding out uses of bzrlib.user_encoding.
593
        self.user_encoding = osutils._cached_user_encoding
1685.1.5 by John Arbash Meinel
Merged test_log.py.moved into test_log.py
594
595
    def tearDown(self):
3224.5.4 by Andrew Bennetts
Fix test suite, mainly weeding out uses of bzrlib.user_encoding.
596
        osutils._cached_user_encoding = self.user_encoding
1685.1.5 by John Arbash Meinel
Merged test_log.py.moved into test_log.py
597
        TestCaseInTempDir.tearDown(self)
598
599
    def create_branch(self):
600
        bzr = self.run_bzr
601
        bzr('init')
602
        open('a', 'wb').write('some stuff\n')
2552.2.3 by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests.
603
        bzr('add a')
604
        bzr(['commit', '-m', self._message])
1685.1.5 by John Arbash Meinel
Merged test_log.py.moved into test_log.py
605
606
    def try_encoding(self, encoding, fail=False):
607
        bzr = self.run_bzr
608
        if fail:
609
            self.assertRaises(UnicodeEncodeError,
610
                self._mu.encode, encoding)
611
            encoded_msg = self._message.encode(encoding, 'replace')
612
        else:
613
            encoded_msg = self._message.encode(encoding)
614
3224.5.4 by Andrew Bennetts
Fix test suite, mainly weeding out uses of bzrlib.user_encoding.
615
        old_encoding = osutils._cached_user_encoding
1685.1.5 by John Arbash Meinel
Merged test_log.py.moved into test_log.py
616
        # This test requires that 'run_bzr' uses the current
617
        # bzrlib, because we override user_encoding, and expect
618
        # it to be used
619
        try:
3224.5.4 by Andrew Bennetts
Fix test suite, mainly weeding out uses of bzrlib.user_encoding.
620
            osutils._cached_user_encoding = 'ascii'
1685.1.5 by John Arbash Meinel
Merged test_log.py.moved into test_log.py
621
            # We should be able to handle any encoding
622
            out, err = bzr('log', encoding=encoding)
623
            if not fail:
624
                # Make sure we wrote mu as we expected it to exist
625
                self.assertNotEqual(-1, out.find(encoded_msg))
626
                out_unicode = out.decode(encoding)
627
                self.assertNotEqual(-1, out_unicode.find(self._message))
628
            else:
629
                self.assertNotEqual(-1, out.find('Message with ?'))
630
        finally:
3224.5.4 by Andrew Bennetts
Fix test suite, mainly weeding out uses of bzrlib.user_encoding.
631
            osutils._cached_user_encoding = old_encoding
1685.1.5 by John Arbash Meinel
Merged test_log.py.moved into test_log.py
632
633
    def test_log_handles_encoding(self):
634
        self.create_branch()
635
636
        for encoding in self.good_encodings:
637
            self.try_encoding(encoding)
638
639
    def test_log_handles_bad_encoding(self):
640
        self.create_branch()
641
642
        for encoding in self.bad_encodings:
643
            self.try_encoding(encoding, fail=True)
644
645
    def test_stdout_encoding(self):
646
        bzr = self.run_bzr
3224.5.4 by Andrew Bennetts
Fix test suite, mainly weeding out uses of bzrlib.user_encoding.
647
        osutils._cached_user_encoding = "cp1251"
1685.1.5 by John Arbash Meinel
Merged test_log.py.moved into test_log.py
648
649
        bzr('init')
650
        self.build_tree(['a'])
2552.2.3 by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests.
651
        bzr('add a')
652
        bzr(['commit', '-m', u'\u0422\u0435\u0441\u0442'])
1685.1.5 by John Arbash Meinel
Merged test_log.py.moved into test_log.py
653
        stdout, stderr = self.run_bzr('log', encoding='cp866')
654
655
        message = stdout.splitlines()[-1]
656
657
        # explanation of the check:
658
        # u'\u0422\u0435\u0441\u0442' is word 'Test' in russian
659
        # in cp866  encoding this is string '\x92\xa5\xe1\xe2'
660
        # in cp1251 encoding this is string '\xd2\xe5\xf1\xf2'
661
        # This test should check that output of log command
662
        # encoded to sys.stdout.encoding
663
        test_in_cp866 = '\x92\xa5\xe1\xe2'
664
        test_in_cp1251 = '\xd2\xe5\xf1\xf2'
665
        # Make sure the log string is encoded in cp866
666
        self.assertEquals(test_in_cp866, message[2:])
667
        # Make sure the cp1251 string is not found anywhere
668
        self.assertEquals(-1, stdout.find(test_in_cp1251))
669
1551.10.18 by Aaron Bentley
Log works in local treeless branches (#84247)
670
671
class TestLogFile(TestCaseWithTransport):
672
673
    def test_log_local_branch_file(self):
674
        """We should be able to log files in local treeless branches"""
675
        tree = self.make_branch_and_tree('tree')
676
        self.build_tree(['tree/file'])
677
        tree.add('file')
678
        tree.commit('revision 1')
679
        tree.bzrdir.destroy_workingtree()
2552.2.3 by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests.
680
        self.run_bzr('log tree/file')
2359.1.1 by Kent Gibson
Fix ``bzr log <file>`` so it only logs the revisions that changed the file, and does it faster.
681
3940.1.2 by Ian Clatworthy
add test
682
    def prepare_tree(self):
2359.1.1 by Kent Gibson
Fix ``bzr log <file>`` so it only logs the revisions that changed the file, and does it faster.
683
        tree = self.make_branch_and_tree('parent')
684
        self.build_tree(['parent/file1', 'parent/file2', 'parent/file3'])
685
        tree.add('file1')
686
        tree.commit('add file1')
687
        tree.add('file2')
688
        tree.commit('add file2')
689
        tree.add('file3')
690
        tree.commit('add file3')
2664.14.1 by Daniel Watkins
Fixed tests.blackbox.test_log to use internals where appropriate.
691
        child_tree = tree.bzrdir.sprout('child').open_workingtree()
692
        self.build_tree_contents([('child/file2', 'hello')])
693
        child_tree.commit(message='branch 1')
694
        tree.merge_from_branch(child_tree.branch)
695
        tree.commit(message='merge child branch')
2359.1.1 by Kent Gibson
Fix ``bzr log <file>`` so it only logs the revisions that changed the file, and does it faster.
696
        os.chdir('parent')
3940.1.2 by Ian Clatworthy
add test
697
698
    def test_log_file(self):
699
        """The log for a particular file should only list revs for that file"""
700
        self.prepare_tree()
2581.1.6 by Martin Pool
fix up more run_bzr callers
701
        log = self.run_bzr('log file1')[0]
2359.1.1 by Kent Gibson
Fix ``bzr log <file>`` so it only logs the revisions that changed the file, and does it faster.
702
        self.assertContainsRe(log, 'revno: 1\n')
703
        self.assertNotContainsRe(log, 'revno: 2\n')
704
        self.assertNotContainsRe(log, 'revno: 3\n')
705
        self.assertNotContainsRe(log, 'revno: 3.1.1\n')
706
        self.assertNotContainsRe(log, 'revno: 4\n')
2581.1.6 by Martin Pool
fix up more run_bzr callers
707
        log = self.run_bzr('log file2')[0]
2359.1.1 by Kent Gibson
Fix ``bzr log <file>`` so it only logs the revisions that changed the file, and does it faster.
708
        self.assertNotContainsRe(log, 'revno: 1\n')
709
        self.assertContainsRe(log, 'revno: 2\n')
710
        self.assertNotContainsRe(log, 'revno: 3\n')
711
        self.assertContainsRe(log, 'revno: 3.1.1\n')
2359.1.2 by Kent Gibson
add logging of merge revisions
712
        self.assertContainsRe(log, 'revno: 4\n')
2581.1.6 by Martin Pool
fix up more run_bzr callers
713
        log = self.run_bzr('log file3')[0]
2359.1.1 by Kent Gibson
Fix ``bzr log <file>`` so it only logs the revisions that changed the file, and does it faster.
714
        self.assertNotContainsRe(log, 'revno: 1\n')
715
        self.assertNotContainsRe(log, 'revno: 2\n')
716
        self.assertContainsRe(log, 'revno: 3\n')
717
        self.assertNotContainsRe(log, 'revno: 3.1.1\n')
718
        self.assertNotContainsRe(log, 'revno: 4\n')
2581.1.6 by Martin Pool
fix up more run_bzr callers
719
        log = self.run_bzr('log -r3.1.1 file2')[0]
2466.12.1 by Kent Gibson
Fix ``bzr log -r`` to support selecting merge revisions.
720
        self.assertNotContainsRe(log, 'revno: 1\n')
721
        self.assertNotContainsRe(log, 'revno: 2\n')
722
        self.assertNotContainsRe(log, 'revno: 3\n')
723
        self.assertContainsRe(log, 'revno: 3.1.1\n')
724
        self.assertNotContainsRe(log, 'revno: 4\n')
2581.1.6 by Martin Pool
fix up more run_bzr callers
725
        log = self.run_bzr('log -r4 file2')[0]
726
        self.assertNotContainsRe(log, 'revno: 1\n')
727
        self.assertNotContainsRe(log, 'revno: 2\n')
728
        self.assertNotContainsRe(log, 'revno: 3\n')
729
        self.assertContainsRe(log, 'revno: 3.1.1\n')
730
        self.assertContainsRe(log, 'revno: 4\n')
731
        log = self.run_bzr('log -r3.. file2')[0]
732
        self.assertNotContainsRe(log, 'revno: 1\n')
733
        self.assertNotContainsRe(log, 'revno: 2\n')
734
        self.assertNotContainsRe(log, 'revno: 3\n')
735
        self.assertContainsRe(log, 'revno: 3.1.1\n')
736
        self.assertContainsRe(log, 'revno: 4\n')
737
        log = self.run_bzr('log -r..3 file2')[0]
2466.12.1 by Kent Gibson
Fix ``bzr log -r`` to support selecting merge revisions.
738
        self.assertNotContainsRe(log, 'revno: 1\n')
739
        self.assertContainsRe(log, 'revno: 2\n')
740
        self.assertNotContainsRe(log, 'revno: 3\n')
741
        self.assertNotContainsRe(log, 'revno: 3.1.1\n')
742
        self.assertNotContainsRe(log, 'revno: 4\n')
3940.1.2 by Ian Clatworthy
add test
743
744
    def test_line_log_file(self):
745
        """The line log for a file should only list relevant mainline revs"""
746
        # Note: this also implicitly  covers the short logging case.
747
        # We test using --line in preference to --short because matching
748
        # revnos in the output of --line is more reliable.
749
        self.prepare_tree()
3940.1.5 by Ian Clatworthy
feedback from vila
750
751
        # full history of file1
3940.1.2 by Ian Clatworthy
add test
752
        log = self.run_bzr('log --line file1')[0]
753
        self.assertContainsRe(log, '^1:', re.MULTILINE)
754
        self.assertNotContainsRe(log, '^2:', re.MULTILINE)
755
        self.assertNotContainsRe(log, '^3:', re.MULTILINE)
756
        self.assertNotContainsRe(log, '^3.1.1:', re.MULTILINE)
757
        self.assertNotContainsRe(log, '^4:', re.MULTILINE)
3940.1.5 by Ian Clatworthy
feedback from vila
758
759
        # full history of file2
3940.1.2 by Ian Clatworthy
add test
760
        log = self.run_bzr('log --line file2')[0]
761
        self.assertNotContainsRe(log, '^1:', re.MULTILINE)
762
        self.assertContainsRe(log, '^2:', re.MULTILINE)
763
        self.assertNotContainsRe(log, '^3:', re.MULTILINE)
764
        self.assertNotContainsRe(log, '^3.1.1:', re.MULTILINE)
765
        self.assertContainsRe(log, '^4:', re.MULTILINE)
3940.1.5 by Ian Clatworthy
feedback from vila
766
767
        # full history of file3
3940.1.2 by Ian Clatworthy
add test
768
        log = self.run_bzr('log --line file3')[0]
769
        self.assertNotContainsRe(log, '^1:', re.MULTILINE)
770
        self.assertNotContainsRe(log, '^2:', re.MULTILINE)
771
        self.assertContainsRe(log, '^3:', re.MULTILINE)
772
        self.assertNotContainsRe(log, '^3.1.1:', re.MULTILINE)
773
        self.assertNotContainsRe(log, '^4:', re.MULTILINE)
3940.1.5 by Ian Clatworthy
feedback from vila
774
775
        # file in a merge revision
3940.1.2 by Ian Clatworthy
add test
776
        log = self.run_bzr('log --line -r3.1.1 file2')[0]
777
        self.assertNotContainsRe(log, '^1:', re.MULTILINE)
778
        self.assertNotContainsRe(log, '^2:', re.MULTILINE)
779
        self.assertNotContainsRe(log, '^3:', re.MULTILINE)
780
        self.assertContainsRe(log, '^3.1.1:', re.MULTILINE)
781
        self.assertNotContainsRe(log, '^4:', re.MULTILINE)
3940.1.5 by Ian Clatworthy
feedback from vila
782
783
        # file in a mainline revision
3940.1.2 by Ian Clatworthy
add test
784
        log = self.run_bzr('log --line -r4 file2')[0]
785
        self.assertNotContainsRe(log, '^1:', re.MULTILINE)
786
        self.assertNotContainsRe(log, '^2:', re.MULTILINE)
787
        self.assertNotContainsRe(log, '^3:', re.MULTILINE)
788
        self.assertNotContainsRe(log, '^3.1.1:', re.MULTILINE)
789
        self.assertContainsRe(log, '^4:', re.MULTILINE)
3940.1.5 by Ian Clatworthy
feedback from vila
790
791
        # file since a revision
3940.1.2 by Ian Clatworthy
add test
792
        log = self.run_bzr('log --line -r3.. file2')[0]
793
        self.assertNotContainsRe(log, '^1:', re.MULTILINE)
794
        self.assertNotContainsRe(log, '^2:', re.MULTILINE)
795
        self.assertNotContainsRe(log, '^3:', re.MULTILINE)
796
        self.assertNotContainsRe(log, '^3.1.1:', re.MULTILINE)
797
        self.assertContainsRe(log, '^4:', re.MULTILINE)
3940.1.5 by Ian Clatworthy
feedback from vila
798
799
        # file up to a revision
3940.1.2 by Ian Clatworthy
add test
800
        log = self.run_bzr('log --line -r..3 file2')[0]
801
        self.assertNotContainsRe(log, '^1:', re.MULTILINE)
802
        self.assertContainsRe(log, '^2:', re.MULTILINE)
803
        self.assertNotContainsRe(log, '^3:', re.MULTILINE)
804
        self.assertNotContainsRe(log, '^3.1.1:', re.MULTILINE)
805
        self.assertNotContainsRe(log, '^4:', re.MULTILINE)