~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_log.py

  • Committer: Patch Queue Manager
  • Date: 2016-02-01 19:13:13 UTC
  • mfrom: (6614.2.2 trunk)
  • Revision ID: pqm@pqm.ubuntu.com-20160201191313-wdfvmfff1djde6oq
(vila) Release 2.7.0 (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2010 Canonical Ltd
 
1
# Copyright (C) 2006-2012, 2016 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
31
31
    test_log,
32
32
    features,
33
33
    )
 
34
from bzrlib.tests.matchers import ContainsNoVfsCalls
34
35
 
35
36
 
36
37
class TestLog(tests.TestCaseWithTransport, test_log.TestLogMixin):
204
205
        # 4  1.1.4
205
206
        # | /
206
207
        # 5
 
208
        # | \
 
209
        # | 5.1.1
 
210
        # | /
 
211
        # 6
207
212
 
208
213
        # mainline
209
214
        builder.build_snapshot('1', None, [
222
227
        builder.build_snapshot('1.1.4', ['1.1.3', '4'], [])
223
228
        # merge branch into mainline
224
229
        builder.build_snapshot('5', ['4', '1.1.4'], [])
 
230
        builder.build_snapshot('5.1.1', ['5'], [])
 
231
        builder.build_snapshot('6', ['5', '5.1.1'], [])
225
232
        builder.finish_series()
226
233
 
227
234
    def test_n0(self):
240
247
        self.assertLogRevnos(['-n1', '-r1.1.1..1.1.4', '--forward'],
241
248
                             ['1.1.1', '1.1.2', '1.1.3', '1.1.4'])
242
249
 
 
250
    def test_fallback_when_end_rev_is_not_on_mainline(self):
 
251
        self.assertLogRevnos(['-n1', '-r1.1.1..5.1.1'],
 
252
                             # We don't get 1.1.1 because we say -n1
 
253
                             ['5.1.1', '5', '4', '3'])
 
254
 
243
255
 
244
256
class Test_GenerateAllRevisions(TestLogWithLogCatcher):
245
257
 
257
269
        # The graph below may look a bit complicated (and it may be but I've
258
270
        # banged my head enough on it) but the bug requires at least dotted
259
271
        # revnos *and* merged revisions below that.
 
272
        # 1
 
273
        # | \
 
274
        # 2  1.1.1
 
275
        # | X
 
276
        # 3  2.1.1
 
277
        # |   |    \
 
278
        # |  2.1.2  2.2.1
 
279
        # |   |    X
 
280
        # |  2.1.3  \
 
281
        # | /       /
 
282
        # 4        /
 
283
        # |       /
 
284
        # 5 -----/
260
285
        builder.build_snapshot('1', None, [
261
286
            ('add', ('', 'root-id', 'directory', ''))])
262
287
        builder.build_snapshot('2', ['1'], [])
381
406
    def test_log_reversed_dotted_revspecs(self):
382
407
        self.make_merged_branch()
383
408
        self.run_bzr_error(('bzr: ERROR: Start revision not found in '
384
 
                            'left-hand history of end revision.\n',),
 
409
                            'history of end revision.\n',),
385
410
                           "log -r 1.1.1..1")
386
411
 
387
412
    def test_log_bad_message_re(self):
812
837
        test_in_cp866 = '\x92\xa5\xe1\xe2'
813
838
        test_in_cp1251 = '\xd2\xe5\xf1\xf2'
814
839
        # Make sure the log string is encoded in cp866
815
 
        self.assertEquals(test_in_cp866, message[2:])
 
840
        self.assertEqual(test_in_cp866, message[2:])
816
841
        # Make sure the cp1251 string is not found anywhere
817
 
        self.assertEquals(-1, stdout.find(test_in_cp1251))
 
842
        self.assertEqual(-1, stdout.find(test_in_cp1251))
818
843
 
819
844
 
820
845
class TestLogFile(TestLogWithLogCatcher):
993
1018
        (stdout, stderr) = self.run_bzr(['log', '-r..2'], retcode=3)
994
1019
        self.assertEqual(["2", "1"],
995
1020
                         [r.revno for r in self.get_captured_revisions()])
996
 
        self.assertEquals("bzr: ERROR: Further revision history missing.", stderr)
 
1021
        self.assertEqual("bzr: ERROR: Further revision history missing.", stderr)
997
1022
 
998
1023
    def test_log_range_open_end(self):
999
1024
        self.assertLogRevnos(["-r1.."], ["2", "1"])
1069
1094
        # being too low. If rpc_count increases, more network roundtrips have
1070
1095
        # become necessary for this use case. Please do not adjust this number
1071
1096
        # upwards without agreement from bzr's network support maintainers.
1072
 
        self.assertLength(15, self.hpss_calls)
 
1097
        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
 
1098
        self.assertLength(1, self.hpss_connections)
 
1099
        self.assertLength(9, self.hpss_calls)
1073
1100
 
1074
1101
    def test_verbose_log(self):
1075
1102
        self.setup_smart_server_with_call_log()
1084
1111
        # being too low. If rpc_count increases, more network roundtrips have
1085
1112
        # become necessary for this use case. Please do not adjust this number
1086
1113
        # upwards without agreement from bzr's network support maintainers.
1087
 
        self.assertLength(20, self.hpss_calls)
 
1114
        self.assertLength(10, self.hpss_calls)
 
1115
        self.assertLength(1, self.hpss_connections)
 
1116
        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
 
1117
 
 
1118
    def test_per_file(self):
 
1119
        self.setup_smart_server_with_call_log()
 
1120
        t = self.make_branch_and_tree('branch')
 
1121
        self.build_tree_contents([('branch/foo', 'thecontents')])
 
1122
        t.add("foo")
 
1123
        t.commit("message")
 
1124
        self.reset_smart_call_log()
 
1125
        out, err = self.run_bzr(['log', '-v', self.get_url('branch') + "/foo"])
 
1126
        # This figure represent the amount of work to perform this use case. It
 
1127
        # is entirely ok to reduce this number if a test fails due to rpc_count
 
1128
        # being too low. If rpc_count increases, more network roundtrips have
 
1129
        # become necessary for this use case. Please do not adjust this number
 
1130
        # upwards without agreement from bzr's network support maintainers.
 
1131
        self.assertLength(14, self.hpss_calls)
 
1132
        self.assertLength(1, self.hpss_connections)
 
1133
        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)