30
30
def _prepare(self, format=None):
32
self.runbzr("init --format="+format)
32
self.run_bzr_captured(["init", "--format="+format])
34
self.run_bzr_captured("init")
35
35
self.build_tree(['hello.txt', 'goodbye.txt', 'meep.txt'])
36
self.runbzr("add hello.txt")
37
self.runbzr("commit -m message1 hello.txt")
38
self.runbzr("add goodbye.txt")
39
self.runbzr("commit -m message2 goodbye.txt")
40
self.runbzr("add meep.txt")
41
self.runbzr("commit -m message3 meep.txt")
42
self.full_log = self.runbzr("log")[0]
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]
44
44
def test_log_null_end_revspec(self):
50
50
self.assertTrue('message:\n message2\n' in self.full_log)
51
51
self.assertTrue('message:\n message3\n' in self.full_log)
53
log = self.runbzr("log -r 1..")[0]
53
log = self.run_bzr("log -r 1..")[0]
54
54
self.assertEquals(log, self.full_log)
56
56
def test_log_null_begin_revspec(self):
58
log = self.runbzr("log -r ..3")[0]
58
log = self.run_bzr("log -r ..3")[0]
59
59
self.assertEquals(self.full_log, log)
61
61
def test_log_null_both_revspecs(self):
63
log = self.runbzr("log -r ..")[0]
63
log = self.run_bzr("log -r ..")[0]
64
64
self.assertEquals(self.full_log, log)
66
66
def test_log_negative_begin_revspec_full_log(self):
68
log = self.runbzr("log -r -3..")[0]
68
log = self.run_bzr("log -r -3..")[0]
69
69
self.assertEquals(self.full_log, log)
71
71
def test_log_negative_both_revspec_full_log(self):
73
log = self.runbzr("log -r -3..-1")[0]
73
log = self.run_bzr("log -r -3..-1")[0]
74
74
self.assertEquals(self.full_log, log)
76
76
def test_log_negative_both_revspec_partial(self):
78
log = self.runbzr("log -r -3..-2")[0]
78
log = self.run_bzr("log -r -3..-2")[0]
79
79
self.assertTrue('revno: 1\n' in log)
80
80
self.assertTrue('revno: 2\n' in log)
81
81
self.assertTrue('revno: 3\n' not in log)
83
83
def test_log_negative_begin_revspec(self):
85
log = self.runbzr("log -r -2..")[0]
85
log = self.run_bzr("log -r -2..")[0]
86
86
self.assertTrue('revno: 1\n' not in log)
87
87
self.assertTrue('revno: 2\n' in log)
88
88
self.assertTrue('revno: 3\n' in log)
90
90
def test_log_postive_revspecs(self):
92
log = self.runbzr("log -r 1..3")[0]
92
log = self.run_bzr("log -r 1..3")[0]
93
93
self.assertEquals(self.full_log, log)
95
95
def test_log_revno_n_path(self):
101
101
os.chdir('branch2')
104
log = self.runbzr("log -r revno:2:branch1..revno:3:branch2",
104
log = self.run_bzr("log -r revno:2:branch1..revno:3:branch2",
106
log = self.runbzr("log -r revno:1:branch2..revno:3:branch2")[0]
106
log = self.run_bzr("log -r revno:1:branch2..revno:3:branch2")[0]
107
107
self.assertEquals(self.full_log, log)
108
log = self.runbzr("log -r revno:1:branch2")[0]
108
log = self.run_bzr("log -r revno:1:branch2")[0]
109
109
self.assertTrue('revno: 1\n' in log)
110
110
self.assertTrue('revno: 2\n' not in log)
111
111
self.assertTrue('branch nick: branch2\n' in log)
122
122
def test_log_with_tags(self):
123
123
self._prepare(format='dirstate-tags')
124
self.runbzr('tag -r1 tag1')
125
self.runbzr('tag -r1 tag1.1')
126
self.runbzr('tag tag3')
124
self.run_bzr('tag -r1 tag1')
125
self.run_bzr('tag -r1 tag1.1')
126
self.run_bzr('tag tag3')
128
log = self.runbzr("log -r-1")[0]
128
log = self.run_bzr("log -r-1")[0]
129
129
self.assertTrue('tags: tag3' in log)
131
log = self.runbzr("log -r1")[0]
131
log = self.run_bzr("log -r1")[0]
132
132
# I guess that we can't know the order of tags in the output
133
133
# since dicts are unordered, need to check both possibilities
134
134
self.assertContainsRe(log, r'tags: (tag1, tag1\.1|tag1\.1, tag1)')
138
138
os.chdir('branch1')
139
139
self._prepare(format='dirstate-tags')
141
self.runbzr('branch branch1 branch2')
141
self.run_bzr('branch branch1 branch2')
142
142
os.chdir('branch1')
143
self.runbzr('commit -m foobar --unchanged')
144
self.runbzr('tag tag1')
143
self.run_bzr('commit -m foobar --unchanged')
144
self.run_bzr('tag tag1')
145
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]
146
self.run_bzr('merge ../branch1')
147
self.run_bzr('commit -m merge_branch_1')
148
log = self.run_bzr("log -r-1")[0]
149
149
self.assertContainsRe(log, r' tags: tag1')
151
151
def test_log_limit(self):
153
log = self.runbzr("log --limit 2")[0]
153
log = self.run_bzr("log --limit 2")[0]
154
154
self.assertTrue('revno: 1\n' not in log)
155
155
self.assertTrue('revno: 2\n' in log)
156
156
self.assertTrue('revno: 3\n' in log)