~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/benchmarks/bench_sftp.py

  • Committer: Carl Friedrich Bolz
  • Date: 2006-08-17 12:32:04 UTC
  • mto: (1711.2.131 jam-integration)
  • mto: This revision was merged to the branch mainline in revision 1947.
  • Revision ID: cfbolz@gmx.de-20060817123204-74a298e1222f1720
More fixes according to John's comments.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 
16
16
 
17
17
class SFTPBenchmark(Benchmark):
18
 
    """A benchmark base class that provides a sftp server on localhost."""
 
18
    """Benchmark branch, push and pull across a local sftp connection."""
19
19
 
20
20
    def setUp(self):
21
21
        super(SFTPBenchmark, self).setUp()
25
25
         
26
26
    def test_branch(self):
27
27
        os.mkdir("a")
28
 
        t, files = self.create_with_commits(100, 100, "a")
 
28
        tree, files = self.create_with_commits(100, 100, "a")
29
29
        self.time(bzrdir.BzrDir.open(self.get_url('a')).sprout, "b")
30
30
 
31
31
    def test_pull_1(self):
32
32
        os.mkdir("a")
33
 
        t, files = self.create_with_commits(100, 100, "a")
 
33
        tree, files = self.create_with_commits(100, 100, "a")
34
34
        rbzrdir = bzrdir.BzrDir.open(self.get_url('a'))
35
 
        b2 = rbzrdir.sprout("b") # branch
 
35
        b2 = tree.bzrdir.sprout("b") # branch
36
36
        # change a few files and commit
37
 
        self.commit_some_revisions(t, files, 1, 20)
 
37
        self.commit_some_revisions(tree, files, 1, 20)
38
38
        self.time(b2.open_branch().pull, rbzrdir.open_branch())
39
39
        
40
40
    def test_pull_100(self):
41
41
        os.mkdir("a")
42
 
        t, files = self.create_with_commits(100, 100, "a")
 
42
        tree, files = self.create_with_commits(100, 100, "a")
43
43
        rbzrdir = bzrdir.BzrDir.open(self.get_url('a'))
44
 
        b2 = rbzrdir.sprout("b") # branch
 
44
        b2 = tree.bzrdir.sprout("b") # branch
45
45
        # change a few files and commit
46
 
        self.commit_some_revisions(t, files, 100, 20)
 
46
        self.commit_some_revisions(tree, files, 100, 20)
47
47
        self.time(b2.open_branch().pull, rbzrdir.open_branch())
48
48
 
49
49
    def create_commit_and_push(self, num_push_revisions):
50
50
        os.mkdir("a")
51
 
        t, files = self.create_with_commits(100, 100, "a")
 
51
        tree, files = self.create_with_commits(100, 100, "a")
52
52
        rbzrdir = bzrdir.BzrDir.open(self.get_url('a'))
53
53
        b2 = rbzrdir.sprout("b") # branch
54
 
        wt = b2.open_workingtree()
 
54
        wtree = b2.open_workingtree()
55
55
        # change a few files and commit
56
56
        self.commit_some_revisions(
57
 
            wt, ["b/%i" for i in range(100)], 
 
57
            wtree, ["b/%i" for i in range(100)], 
58
58
            num_commits=num_push_revisions,
59
59
            changes_per_commit=20)
60
60
        self.time(rbzrdir.open_branch().pull, wt.branch)