/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
1624.1.3 by Robert Collins
Convert log to use the new tsort.merge_sort routine.
21
import os
1540.2.6 by Robey Pointer
make 'log' and 'status' treat '-r N..' as implicitly '-r N..-1'
22
1685.1.5 by John Arbash Meinel
Merged test_log.py.moved into test_log.py
23
import bzrlib
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
1540.2.6 by Robey Pointer
make 'log' and 'status' treat '-r N..' as implicitly '-r N..-1'
26
27
28
class TestLog(ExternalBase):
29
2388.1.3 by Erik Bagfors
tests for tags in log output
30
    def _prepare(self, format=None):
31
        if format:
2530.3.4 by Martin Pool
Deprecate run_bzr_captured in favour of just run_bzr
32
            self.run_bzr(["init", "--format="+format])
2388.1.3 by Erik Bagfors
tests for tags in log output
33
        else:
2530.3.4 by Martin Pool
Deprecate run_bzr_captured in favour of just run_bzr
34
            self.run_bzr("init")
1553.4.2 by Michael Ellerman
Make bzr log -r .. work, fixes bug #4609. Add a bunch of tests to make sure
35
        self.build_tree(['hello.txt', 'goodbye.txt', 'meep.txt'])
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
36
        self.run_bzr("add hello.txt")
37
        self.run_bzr("commit -m message1 hello.txt")
38
        self.run_bzr("add goodbye.txt")
39
        self.run_bzr("commit -m message2 goodbye.txt")
40
        self.run_bzr("add meep.txt")
41
        self.run_bzr("commit -m message3 meep.txt")
42
        self.full_log = self.run_bzr("log")[0]
1553.4.2 by Michael Ellerman
Make bzr log -r .. work, fixes bug #4609. Add a bunch of tests to make sure
43
44
    def test_log_null_end_revspec(self):
45
        self._prepare()
46
        self.assertTrue('revno: 1\n' in self.full_log)
47
        self.assertTrue('revno: 2\n' in self.full_log)
48
        self.assertTrue('revno: 3\n' in self.full_log)
49
        self.assertTrue('message:\n  message1\n' in self.full_log)
50
        self.assertTrue('message:\n  message2\n' in self.full_log)
51
        self.assertTrue('message:\n  message3\n' in self.full_log)
52
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
53
        log = self.run_bzr("log -r 1..")[0]
1553.4.2 by Michael Ellerman
Make bzr log -r .. work, fixes bug #4609. Add a bunch of tests to make sure
54
        self.assertEquals(log, self.full_log)
55
56
    def test_log_null_begin_revspec(self):
57
        self._prepare()
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
58
        log = self.run_bzr("log -r ..3")[0]
1553.4.2 by Michael Ellerman
Make bzr log -r .. work, fixes bug #4609. Add a bunch of tests to make sure
59
        self.assertEquals(self.full_log, log)
60
61
    def test_log_null_both_revspecs(self):
62
        self._prepare()
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
63
        log = self.run_bzr("log -r ..")[0]
1553.4.2 by Michael Ellerman
Make bzr log -r .. work, fixes bug #4609. Add a bunch of tests to make sure
64
        self.assertEquals(self.full_log, log)
65
66
    def test_log_negative_begin_revspec_full_log(self):
67
        self._prepare()
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
68
        log = self.run_bzr("log -r -3..")[0]
1553.4.2 by Michael Ellerman
Make bzr log -r .. work, fixes bug #4609. Add a bunch of tests to make sure
69
        self.assertEquals(self.full_log, log)
70
71
    def test_log_negative_both_revspec_full_log(self):
72
        self._prepare()
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
73
        log = self.run_bzr("log -r -3..-1")[0]
1553.4.2 by Michael Ellerman
Make bzr log -r .. work, fixes bug #4609. Add a bunch of tests to make sure
74
        self.assertEquals(self.full_log, log)
75
76
    def test_log_negative_both_revspec_partial(self):
77
        self._prepare()
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
78
        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
79
        self.assertTrue('revno: 1\n' in log)
80
        self.assertTrue('revno: 2\n' in log)
81
        self.assertTrue('revno: 3\n' not in log)
82
83
    def test_log_negative_begin_revspec(self):
84
        self._prepare()
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
85
        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
86
        self.assertTrue('revno: 1\n' not in log)
87
        self.assertTrue('revno: 2\n' in log)
88
        self.assertTrue('revno: 3\n' in log)
89
90
    def test_log_postive_revspecs(self):
91
        self._prepare()
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
92
        log = self.run_bzr("log -r 1..3")[0]
1553.4.2 by Michael Ellerman
Make bzr log -r .. work, fixes bug #4609. Add a bunch of tests to make sure
93
        self.assertEquals(self.full_log, log)
1624.1.3 by Robert Collins
Convert log to use the new tsort.merge_sort routine.
94
1907.4.2 by Matthieu Moy
Make log work nicely with revno:N:path too.
95
    def test_log_revno_n_path(self):
96
        os.mkdir('branch1')
97
        os.chdir('branch1')
98
        self._prepare()
99
        os.chdir('..')
100
        os.mkdir('branch2')
101
        os.chdir('branch2')
102
        self._prepare()
103
        os.chdir('..')
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
104
        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.
105
                          retcode=3)[0]
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
106
        log = self.run_bzr("log -r revno:1:branch2..revno:3:branch2")[0]
1907.4.2 by Matthieu Moy
Make log work nicely with revno:N:path too.
107
        self.assertEquals(self.full_log, log)
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
108
        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.
109
        self.assertTrue('revno: 1\n' in log)
110
        self.assertTrue('revno: 2\n' not in log)
111
        self.assertTrue('branch nick: branch2\n' in log)
112
        self.assertTrue('branch nick: branch1\n' not in log)
113
        
2100.1.1 by wang
Running ``bzr log`` on nonexistent file gives an error instead of the
114
    def test_log_nonexistent_file(self):
115
        # files that don't exist in either the basis tree or working tree
116
        # should give an error
117
        wt = self.make_branch_and_tree('.')
2552.2.3 by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests.
118
        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
119
        self.assertContainsRe(
120
            err, 'Path does not have any revision history: does-not-exist')
2388.1.11 by Alexander Belchenko
changes after John's review
121
2388.1.3 by Erik Bagfors
tests for tags in log output
122
    def test_log_with_tags(self):
123
        self._prepare(format='dirstate-tags')
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
124
        self.run_bzr('tag -r1 tag1')
125
        self.run_bzr('tag -r1 tag1.1')
126
        self.run_bzr('tag tag3')
2388.1.3 by Erik Bagfors
tests for tags in log output
127
        
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
128
        log = self.run_bzr("log -r-1")[0]
2388.1.3 by Erik Bagfors
tests for tags in log output
129
        self.assertTrue('tags: tag3' in log)
130
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
131
        log = self.run_bzr("log -r1")[0]
2388.1.3 by Erik Bagfors
tests for tags in log output
132
        # I guess that we can't know the order of tags in the output
133
        # since dicts are unordered, need to check both possibilities
2388.1.11 by Alexander Belchenko
changes after John's review
134
        self.assertContainsRe(log, r'tags: (tag1, tag1\.1|tag1\.1, tag1)')
135
2388.1.9 by Erik Bagfors
test for merges with tags in log
136
    def test_merged_log_with_tags(self):
137
        os.mkdir('branch1')
138
        os.chdir('branch1')
139
        self._prepare(format='dirstate-tags')
140
        os.chdir('..')
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
141
        self.run_bzr('branch branch1 branch2')
2388.1.9 by Erik Bagfors
test for merges with tags in log
142
        os.chdir('branch1')
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
143
        self.run_bzr('commit -m foobar --unchanged')
144
        self.run_bzr('tag tag1')
2388.1.9 by Erik Bagfors
test for merges with tags in log
145
        os.chdir('../branch2')
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
146
        self.run_bzr('merge ../branch1')
2552.2.5 by Vincent Ladeuil
Revert the intrusive run_bzr('commit') rewritings.
147
        self.run_bzr(['commit', '-m', 'merge branch 1'])
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
148
        log = self.run_bzr("log -r-1")[0]
2388.1.11 by Alexander Belchenko
changes after John's review
149
        self.assertContainsRe(log, r'    tags: tag1')
2388.1.3 by Erik Bagfors
tests for tags in log output
150
2466.9.1 by Kent Gibson
add bzr log --limit
151
    def test_log_limit(self):
152
        self._prepare()
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
153
        log = self.run_bzr("log --limit 2")[0]
2466.9.1 by Kent Gibson
add bzr log --limit
154
        self.assertTrue('revno: 1\n' not in log)
155
        self.assertTrue('revno: 2\n' in log)
156
        self.assertTrue('revno: 3\n' in log)
157
1624.1.3 by Robert Collins
Convert log to use the new tsort.merge_sort routine.
158
159
class TestLogMerges(ExternalBase):
160
161
    def test_merges_are_indented_by_level(self):
162
        self.build_tree(['parent/'])
2552.2.5 by Vincent Ladeuil
Revert the intrusive run_bzr('commit') rewritings.
163
        self.run_bzr('init', 'parent')
164
        self.run_bzr(['commit', '-m', 'first post', '--unchanged', 'parent'])
165
        self.run_bzr('branch', 'parent', 'child')
166
        self.run_bzr(['commit', '-m', 'branch 1', '--unchanged', 'child'])
167
        self.run_bzr('branch', 'child', 'smallerchild')
168
        self.run_bzr(['commit', '-m', 'branch 2', '--unchanged',
169
                      'smallerchild'])
1624.1.3 by Robert Collins
Convert log to use the new tsort.merge_sort routine.
170
        os.chdir('child')
2552.2.5 by Vincent Ladeuil
Revert the intrusive run_bzr('commit') rewritings.
171
        self.run_bzr('merge', '../smallerchild')
172
        self.run_bzr(['commit', '-m', 'merge branch 2'])
1624.1.3 by Robert Collins
Convert log to use the new tsort.merge_sort routine.
173
        os.chdir('../parent')
2552.2.5 by Vincent Ladeuil
Revert the intrusive run_bzr('commit') rewritings.
174
        self.run_bzr('merge', '../child')
175
        self.run_bzr(['commit', '-m', 'merge branch 1'])
1624.1.3 by Robert Collins
Convert log to use the new tsort.merge_sort routine.
176
        out,err = self.run_bzr('log')
177
        # the log will look something like:
178
#        self.assertEqual("""\
179
#------------------------------------------------------------
180
#revno: 2
181
#committer: Robert Collins <foo@example.com>
182
#branch nick: parent
183
#timestamp: Tue 2006-03-28 22:31:40 +1100
184
#message:
185
#  merge branch 1
186
#    ------------------------------------------------------------
1988.4.2 by Robert Collins
``bzr log`` Now shows dotted-decimal revision numbers for all revisions,
187
#    revno: 1.1.2  
1624.1.3 by Robert Collins
Convert log to use the new tsort.merge_sort routine.
188
#    merged: foo@example.com-20060328113140-91f43cfb46dc2863
189
#    committer: Robert Collins <foo@example.com>
190
#    branch nick: child
191
#    timestamp: Tue 2006-03-28 22:31:40 +1100
192
#    message:
193
#      merge branch 2
194
#        ------------------------------------------------------------
1988.4.2 by Robert Collins
``bzr log`` Now shows dotted-decimal revision numbers for all revisions,
195
#        revno: 1.1.1.1
1624.1.3 by Robert Collins
Convert log to use the new tsort.merge_sort routine.
196
#        merged: foo@example.com-20060328113140-1ba24f850a0ef573
197
#        committer: Robert Collins <foo@example.com>
198
#        branch nick: smallerchild
199
#        timestamp: Tue 2006-03-28 22:31:40 +1100
200
#        message:
201
#          branch 2
202
#    ------------------------------------------------------------
1988.4.2 by Robert Collins
``bzr log`` Now shows dotted-decimal revision numbers for all revisions,
203
#    revno: 1.1.1
1624.1.3 by Robert Collins
Convert log to use the new tsort.merge_sort routine.
204
#    merged: foo@example.com-20060328113140-5749a4757a8ac792
205
#    committer: Robert Collins <foo@example.com>
206
#    branch nick: child
207
#    timestamp: Tue 2006-03-28 22:31:40 +1100
208
#    message:
209
#      branch 1
210
#------------------------------------------------------------
211
#revno: 1
212
#committer: Robert Collins <foo@example.com>
213
#branch nick: parent
214
#timestamp: Tue 2006-03-28 22:31:39 +1100
215
#message:
216
#  first post
217
#""", out)
218
        # but we dont have a nice pattern matcher hooked up yet, so:
1988.4.2 by Robert Collins
``bzr log`` Now shows dotted-decimal revision numbers for all revisions,
219
        # we check for the indenting of the commit message and the 
220
        # revision numbers 
221
        self.assertTrue('revno: 2' in out)
2552.2.5 by Vincent Ladeuil
Revert the intrusive run_bzr('commit') rewritings.
222
        self.assertTrue('  merge branch 1' in out)
1988.4.2 by Robert Collins
``bzr log`` Now shows dotted-decimal revision numbers for all revisions,
223
        self.assertTrue('    revno: 1.1.2' in out)
2552.2.5 by Vincent Ladeuil
Revert the intrusive run_bzr('commit') rewritings.
224
        self.assertTrue('      merge branch 2' in out)
1988.4.2 by Robert Collins
``bzr log`` Now shows dotted-decimal revision numbers for all revisions,
225
        self.assertTrue('        revno: 1.1.1.1' in out)
2552.2.5 by Vincent Ladeuil
Revert the intrusive run_bzr('commit') rewritings.
226
        self.assertTrue('          branch 2' in out)
1988.4.2 by Robert Collins
``bzr log`` Now shows dotted-decimal revision numbers for all revisions,
227
        self.assertTrue('    revno: 1.1.1' in out)
2552.2.5 by Vincent Ladeuil
Revert the intrusive run_bzr('commit') rewritings.
228
        self.assertTrue('      branch 1' in out)
1988.4.2 by Robert Collins
``bzr log`` Now shows dotted-decimal revision numbers for all revisions,
229
        self.assertTrue('revno: 1' in out)
2552.2.5 by Vincent Ladeuil
Revert the intrusive run_bzr('commit') rewritings.
230
        self.assertTrue('  first post' in out)
1624.1.3 by Robert Collins
Convert log to use the new tsort.merge_sort routine.
231
        self.assertEqual('', err)
1685.1.5 by John Arbash Meinel
Merged test_log.py.moved into test_log.py
232
233
234
class TestLogEncodings(TestCaseInTempDir):
235
236
    _mu = u'\xb5'
237
    _message = u'Message with \xb5'
238
239
    # Encodings which can encode mu
240
    good_encodings = [
241
        'utf-8',
242
        'latin-1',
243
        'iso-8859-1',
244
        'cp437', # Common windows encoding
245
        'cp1251', # Alexander Belchenko's windows encoding
246
        'cp1258', # Common windows encoding
247
    ]
248
    # Encodings which cannot encode mu
249
    bad_encodings = [
250
        'ascii',
251
        'iso-8859-2',
252
        'koi8_r',
253
    ]
254
255
    def setUp(self):
256
        TestCaseInTempDir.setUp(self)
257
        self.user_encoding = bzrlib.user_encoding
258
259
    def tearDown(self):
260
        bzrlib.user_encoding = self.user_encoding
261
        TestCaseInTempDir.tearDown(self)
262
263
    def create_branch(self):
264
        bzr = self.run_bzr
265
        bzr('init')
266
        open('a', 'wb').write('some stuff\n')
2552.2.3 by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests.
267
        bzr('add a')
268
        bzr(['commit', '-m', self._message])
1685.1.5 by John Arbash Meinel
Merged test_log.py.moved into test_log.py
269
270
    def try_encoding(self, encoding, fail=False):
271
        bzr = self.run_bzr
272
        if fail:
273
            self.assertRaises(UnicodeEncodeError,
274
                self._mu.encode, encoding)
275
            encoded_msg = self._message.encode(encoding, 'replace')
276
        else:
277
            encoded_msg = self._message.encode(encoding)
278
279
        old_encoding = bzrlib.user_encoding
280
        # This test requires that 'run_bzr' uses the current
281
        # bzrlib, because we override user_encoding, and expect
282
        # it to be used
283
        try:
284
            bzrlib.user_encoding = 'ascii'
285
            # We should be able to handle any encoding
286
            out, err = bzr('log', encoding=encoding)
287
            if not fail:
288
                # Make sure we wrote mu as we expected it to exist
289
                self.assertNotEqual(-1, out.find(encoded_msg))
290
                out_unicode = out.decode(encoding)
291
                self.assertNotEqual(-1, out_unicode.find(self._message))
292
            else:
293
                self.assertNotEqual(-1, out.find('Message with ?'))
294
        finally:
295
            bzrlib.user_encoding = old_encoding
296
297
    def test_log_handles_encoding(self):
298
        self.create_branch()
299
300
        for encoding in self.good_encodings:
301
            self.try_encoding(encoding)
302
303
    def test_log_handles_bad_encoding(self):
304
        self.create_branch()
305
306
        for encoding in self.bad_encodings:
307
            self.try_encoding(encoding, fail=True)
308
309
    def test_stdout_encoding(self):
310
        bzr = self.run_bzr
311
        bzrlib.user_encoding = "cp1251"
312
313
        bzr('init')
314
        self.build_tree(['a'])
2552.2.3 by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests.
315
        bzr('add a')
316
        bzr(['commit', '-m', u'\u0422\u0435\u0441\u0442'])
1685.1.5 by John Arbash Meinel
Merged test_log.py.moved into test_log.py
317
        stdout, stderr = self.run_bzr('log', encoding='cp866')
318
319
        message = stdout.splitlines()[-1]
320
321
        # explanation of the check:
322
        # u'\u0422\u0435\u0441\u0442' is word 'Test' in russian
323
        # in cp866  encoding this is string '\x92\xa5\xe1\xe2'
324
        # in cp1251 encoding this is string '\xd2\xe5\xf1\xf2'
325
        # This test should check that output of log command
326
        # encoded to sys.stdout.encoding
327
        test_in_cp866 = '\x92\xa5\xe1\xe2'
328
        test_in_cp1251 = '\xd2\xe5\xf1\xf2'
329
        # Make sure the log string is encoded in cp866
330
        self.assertEquals(test_in_cp866, message[2:])
331
        # Make sure the cp1251 string is not found anywhere
332
        self.assertEquals(-1, stdout.find(test_in_cp1251))
333
1551.10.18 by Aaron Bentley
Log works in local treeless branches (#84247)
334
335
class TestLogFile(TestCaseWithTransport):
336
337
    def test_log_local_branch_file(self):
338
        """We should be able to log files in local treeless branches"""
339
        tree = self.make_branch_and_tree('tree')
340
        self.build_tree(['tree/file'])
341
        tree.add('file')
342
        tree.commit('revision 1')
343
        tree.bzrdir.destroy_workingtree()
2552.2.3 by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests.
344
        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.
345
346
    def test_log_file(self):
347
        """The log for a particular file should only list revs for that file"""
348
        tree = self.make_branch_and_tree('parent')
349
        self.build_tree(['parent/file1', 'parent/file2', 'parent/file3'])
350
        tree.add('file1')
351
        tree.commit('add file1')
352
        tree.add('file2')
353
        tree.commit('add file2')
354
        tree.add('file3')
355
        tree.commit('add file3')
2552.2.5 by Vincent Ladeuil
Revert the intrusive run_bzr('commit') rewritings.
356
        self.run_bzr('branch', 'parent', 'child')
2359.1.1 by Kent Gibson
Fix ``bzr log <file>`` so it only logs the revisions that changed the file, and does it faster.
357
        print >> file('child/file2', 'wb'), 'hello'
2552.2.5 by Vincent Ladeuil
Revert the intrusive run_bzr('commit') rewritings.
358
        self.run_bzr(['commit', '-m', 'branch 1', 'child'])
2359.1.1 by Kent Gibson
Fix ``bzr log <file>`` so it only logs the revisions that changed the file, and does it faster.
359
        os.chdir('parent')
2552.2.5 by Vincent Ladeuil
Revert the intrusive run_bzr('commit') rewritings.
360
        self.run_bzr('merge', '../child')
361
        self.run_bzr(['commit', '-m', '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.
362
        
2552.2.5 by Vincent Ladeuil
Revert the intrusive run_bzr('commit') rewritings.
363
        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.
364
        self.assertContainsRe(log, 'revno: 1\n')
365
        self.assertNotContainsRe(log, 'revno: 2\n')
366
        self.assertNotContainsRe(log, 'revno: 3\n')
367
        self.assertNotContainsRe(log, 'revno: 3.1.1\n')
368
        self.assertNotContainsRe(log, 'revno: 4\n')
2552.2.5 by Vincent Ladeuil
Revert the intrusive run_bzr('commit') rewritings.
369
        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.
370
        self.assertNotContainsRe(log, 'revno: 1\n')
371
        self.assertContainsRe(log, 'revno: 2\n')
372
        self.assertNotContainsRe(log, 'revno: 3\n')
373
        self.assertContainsRe(log, 'revno: 3.1.1\n')
2359.1.2 by Kent Gibson
add logging of merge revisions
374
        self.assertContainsRe(log, 'revno: 4\n')
2552.2.5 by Vincent Ladeuil
Revert the intrusive run_bzr('commit') rewritings.
375
        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.
376
        self.assertNotContainsRe(log, 'revno: 1\n')
377
        self.assertNotContainsRe(log, 'revno: 2\n')
378
        self.assertContainsRe(log, 'revno: 3\n')
379
        self.assertNotContainsRe(log, 'revno: 3.1.1\n')
380
        self.assertNotContainsRe(log, 'revno: 4\n')