24
24
from bzrlib.tests.blackbox import ExternalBase
25
from bzrlib.tests import TestCaseInTempDir
25
from bzrlib.tests import TestCaseInTempDir, TestCaseWithTransport
28
28
class TestLog(ExternalBase):
30
def _prepare(self, format=None):
32
self.runbzr("init --format="+format)
32
35
self.build_tree(['hello.txt', 'goodbye.txt', 'meep.txt'])
33
36
self.runbzr("add hello.txt")
34
37
self.runbzr("commit -m message1 hello.txt")
116
119
self.assertContainsRe(
117
120
err, 'Path does not have any revision history: does-not-exist')
122
def test_log_with_tags(self):
123
self._prepare(format='dirstate-tags')
124
self.runbzr('tag -r1 tag1')
125
self.runbzr('tag -r1 tag1.1')
126
self.runbzr('tag tag3')
128
log = self.runbzr("log -r-1")[0]
129
self.assertTrue('tags: tag3' in log)
131
log = self.runbzr("log -r1")[0]
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
134
self.assertContainsRe(log, r'tags: (tag1, tag1\.1|tag1\.1, tag1)')
136
def test_merged_log_with_tags(self):
139
self._prepare(format='dirstate-tags')
141
self.runbzr('branch branch1 branch2')
143
self.runbzr('commit -m foobar --unchanged')
144
self.runbzr('tag tag1')
145
os.chdir('../branch2')
146
self.runbzr('merge ../branch1')
147
self.runbzr('commit -m merge_branch_1')
148
log = self.runbzr("log -r-1")[0]
149
self.assertContainsRe(log, r' tags: tag1')
119
152
class TestLogMerges(ExternalBase):
121
154
def test_merges_are_indented_by_level(self):
290
323
# Make sure the cp1251 string is not found anywhere
291
324
self.assertEquals(-1, stdout.find(test_in_cp1251))
327
class TestLogFile(TestCaseWithTransport):
329
def test_log_local_branch_file(self):
330
"""We should be able to log files in local treeless branches"""
331
tree = self.make_branch_and_tree('tree')
332
self.build_tree(['tree/file'])
334
tree.commit('revision 1')
335
tree.bzrdir.destroy_workingtree()
336
self.run_bzr('log', 'tree/file')
338
def test_log_file(self):
339
"""The log for a particular file should only list revs for that file"""
340
tree = self.make_branch_and_tree('parent')
341
self.build_tree(['parent/file1', 'parent/file2', 'parent/file3'])
343
tree.commit('add file1')
345
tree.commit('add file2')
347
tree.commit('add file3')
348
self.run_bzr('branch', 'parent', 'child')
349
print >> file('child/file2', 'wb'), 'hello'
350
self.run_bzr('commit', '-m', 'branch 1', 'child')
352
self.run_bzr('merge', '../child')
353
self.run_bzr('commit', '-m', 'merge child branch')
355
log = self.run_bzr('log', 'file1')[0]
356
self.assertContainsRe(log, 'revno: 1\n')
357
self.assertNotContainsRe(log, 'revno: 2\n')
358
self.assertNotContainsRe(log, 'revno: 3\n')
359
self.assertNotContainsRe(log, 'revno: 3.1.1\n')
360
self.assertNotContainsRe(log, 'revno: 4\n')
361
log = self.run_bzr('log', 'file2')[0]
362
self.assertNotContainsRe(log, 'revno: 1\n')
363
self.assertContainsRe(log, 'revno: 2\n')
364
self.assertNotContainsRe(log, 'revno: 3\n')
365
self.assertContainsRe(log, 'revno: 3.1.1\n')
366
self.assertContainsRe(log, 'revno: 4\n')
367
log = self.run_bzr('log', 'file3')[0]
368
self.assertNotContainsRe(log, 'revno: 1\n')
369
self.assertNotContainsRe(log, 'revno: 2\n')
370
self.assertContainsRe(log, 'revno: 3\n')
371
self.assertNotContainsRe(log, 'revno: 3.1.1\n')
372
self.assertNotContainsRe(log, 'revno: 4\n')