~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

Optimize Tree._iter_changes with specific file_ids

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005 by Canonical Ltd
 
1
# Copyright (C) 2005 Canonical Ltd
2
2
# -*- coding: utf-8 -*-
3
 
 
 
3
#
4
4
# This program is free software; you can redistribute it and/or modify
5
5
# it under the terms of the GNU General Public License as published by
6
6
# the Free Software Foundation; either version 2 of the License, or
7
7
# (at your option) any later version.
8
 
 
 
8
#
9
9
# This program is distributed in the hope that it will be useful,
10
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
12
# GNU General Public License for more details.
13
 
 
 
13
#
14
14
# You should have received a copy of the GNU General Public License
15
15
# along with this program; if not, write to the Free Software
16
16
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
89
89
        log = self.runbzr("log -r 1..3")[0]
90
90
        self.assertEquals(self.full_log, log)
91
91
 
 
92
    def test_log_revno_n_path(self):
 
93
        os.mkdir('branch1')
 
94
        os.chdir('branch1')
 
95
        self._prepare()
 
96
        os.chdir('..')
 
97
        os.mkdir('branch2')
 
98
        os.chdir('branch2')
 
99
        self._prepare()
 
100
        os.chdir('..')
 
101
        log = self.runbzr("log -r revno:2:branch1..revno:3:branch2",
 
102
                          retcode=3)[0]
 
103
        log = self.runbzr("log -r revno:1:branch2..revno:3:branch2")[0]
 
104
        self.assertEquals(self.full_log, log)
 
105
        log = self.runbzr("log -r revno:1:branch2")[0]
 
106
        self.assertTrue('revno: 1\n' in log)
 
107
        self.assertTrue('revno: 2\n' not in log)
 
108
        self.assertTrue('branch nick: branch2\n' in log)
 
109
        self.assertTrue('branch nick: branch1\n' not in log)
 
110
        
 
111
    def test_log_nonexistent_file(self):
 
112
        # files that don't exist in either the basis tree or working tree
 
113
        # should give an error
 
114
        wt = self.make_branch_and_tree('.')
 
115
        out, err = self.run_bzr('log', 'does-not-exist', retcode=3)
 
116
        self.assertContainsRe(
 
117
            err, 'Path does not have any revision history: does-not-exist')
92
118
 
93
119
class TestLogMerges(ExternalBase):
94
120
 
117
143
#message:
118
144
#  merge branch 1
119
145
#    ------------------------------------------------------------
 
146
#    revno: 1.1.2  
120
147
#    merged: foo@example.com-20060328113140-91f43cfb46dc2863
121
148
#    committer: Robert Collins <foo@example.com>
122
149
#    branch nick: child
124
151
#    message:
125
152
#      merge branch 2
126
153
#        ------------------------------------------------------------
 
154
#        revno: 1.1.1.1
127
155
#        merged: foo@example.com-20060328113140-1ba24f850a0ef573
128
156
#        committer: Robert Collins <foo@example.com>
129
157
#        branch nick: smallerchild
131
159
#        message:
132
160
#          branch 2
133
161
#    ------------------------------------------------------------
 
162
#    revno: 1.1.1
134
163
#    merged: foo@example.com-20060328113140-5749a4757a8ac792
135
164
#    committer: Robert Collins <foo@example.com>
136
165
#    branch nick: child
146
175
#  first post
147
176
#""", out)
148
177
        # but we dont have a nice pattern matcher hooked up yet, so:
149
 
        # we check for the indenting of the commit message:
 
178
        # we check for the indenting of the commit message and the 
 
179
        # revision numbers 
 
180
        self.assertTrue('revno: 2' in out)
150
181
        self.assertTrue('  merge branch 1' in out)
 
182
        self.assertTrue('    revno: 1.1.2' in out)
151
183
        self.assertTrue('      merge branch 2' in out)
 
184
        self.assertTrue('        revno: 1.1.1.1' in out)
152
185
        self.assertTrue('          branch 2' in out)
 
186
        self.assertTrue('    revno: 1.1.1' in out)
153
187
        self.assertTrue('      branch 1' in out)
 
188
        self.assertTrue('revno: 1' in out)
154
189
        self.assertTrue('  first post' in out)
155
190
        self.assertEqual('', err)
156
191