~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/benchmarks/bench_log.py

  • Committer: wang
  • Date: 2006-10-29 13:41:32 UTC
  • mto: (2104.4.1 wang_65714)
  • mto: This revision was merged to the branch mainline in revision 2109.
  • Revision ID: wang@ubuntu-20061029134132-3d7f4216f20c4aef
Replace python's difflib by patiencediff because the worst case 
performance is cubic for difflib and people commiting large data 
files are often hurt by this. The worst case performance of patience is 
quadratic. Fix bug 65714.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006 by Canonical Ltd
 
1
# Copyright (C) 2006 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
 
# it under the terms of the GNU General Public License version 2 as published by
5
 
# the Free Software Foundation.
 
4
# it under the terms of the GNU General Public License as published by
 
5
# the Free Software Foundation; either version 2 of the License, or
 
6
# (at your option) any later version.
6
7
#
7
8
# This program is distributed in the hope that it will be useful,
8
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
43
44
 
44
45
    def test_log(self):
45
46
        """Run log in a many-commit tree.""" 
46
 
        tree = self.make_many_commit_tree()
 
47
        tree = self.make_many_commit_tree(hardlink=True)
47
48
        lf = log_formatter('long', to_file=StringIO())
48
49
        self.time(show_log, tree.branch, lf, direction='reverse')
49
50
 
50
51
    def test_merge_log(self):
51
52
        """Run log in a tree with many merges"""
52
 
        tree = self.make_heavily_merged_tree()
 
53
        tree = self.make_heavily_merged_tree(hardlink=True)
53
54
        lf = log_formatter('short', to_file=StringIO())
54
55
        self.time(show_log, tree.branch, lf, direction='reverse')
55
56
 
67
68
 
68
69
    def screenful_tester(self, formatter):
69
70
        """Run show_log, but stop after 25 lines are generated"""
70
 
        tree = self.make_many_commit_tree()
 
71
        tree = self.make_many_commit_tree(hardlink=True)
71
72
        def log_screenful():
72
73
            lf = log_formatter(formatter, to_file=LineConsumer(25))
73
74
            try:
80
81
 
81
82
    def test_cmd_log(self):
82
83
        """Test execution of the log command.""" 
83
 
        tree = self.make_many_commit_tree()
 
84
        tree = self.make_many_commit_tree(hardlink=True)
84
85
        self.time(self.run_bzr, 'log', '-r', '-4..')
85
86
 
86
87
    def test_cmd_log_subprocess(self):
87
88
        """Text startup and execution of the log command.""" 
88
 
        tree = self.make_many_commit_tree()
 
89
        tree = self.make_many_commit_tree(hardlink=True)
89
90
        self.time(self.run_bzr_subprocess, 'log', '-r', '-4..')
90
91
 
91
92
    def test_log_verbose(self):
92
93
        """'verbose' log -- shows file changes"""
93
 
        tree = self.make_many_commit_tree()
 
94
        tree = self.make_many_commit_tree(hardlink=True)
94
95
        lf = log_formatter('long', to_file=StringIO())
95
96
        self.time(show_log, tree.branch, lf, direction='reverse', verbose=True)