~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: John Arbash Meinel
  • Date: 2008-09-09 15:09:12 UTC
  • mto: This revision was merged to the branch mainline in revision 3699.
  • Revision ID: john@arbash-meinel.com-20080909150912-wyttm8he1zsls2ck
Use the right timing function on win32

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2008 Canonical Ltd
 
1
# Copyright (C) 2005 Canonical Ltd
 
2
# -*- coding: utf-8 -*-
 
3
# vim: encoding=utf-8
2
4
#
3
5
# This program is free software; you can redistribute it and/or modify
4
6
# it under the terms of the GNU General Public License as published by
12
14
#
13
15
# You should have received a copy of the GNU General Public License
14
16
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
17
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
18
 
17
19
"""Black-box tests for bzr missing."""
18
20
 
26
28
 
27
29
class TestMissing(TestCaseWithTransport):
28
30
 
29
 
    def assertMessages(self, out, must_have=(), must_not_have=()):
30
 
        """Check if commit messages are in or not in the output"""
31
 
        for m in must_have:
32
 
            self.assertContainsRe(out, r'\nmessage:\n  %s\n' % m)
33
 
        for m in must_not_have:
34
 
            self.assertNotContainsRe(out, r'\nmessage:\n  %s\n' % m)
35
 
 
36
 
    def test_missing_quiet(self):
37
 
        # <https://bugs.launchpad.net/bzr/+bug/284748>
38
 
        # create a source branch
39
 
        #
40
 
        # XXX: This still needs a test that missing is quiet when there are
41
 
        # missing revisions.
42
 
        a_tree = self.make_branch_and_tree('.')
43
 
        self.build_tree_contents([('a', 'initial\n')])
44
 
        a_tree.add('a')
45
 
        a_tree.commit(message='initial')
46
 
 
47
 
        out, err = self.run_bzr('missing -q .')
48
 
        self.assertEqual('', out)
49
 
        self.assertEqual('', err)
50
 
 
51
31
    def test_missing(self):
52
32
        missing = "You are missing 1 revision(s):"
53
33
 
63
43
        b_tree.commit(message='more')
64
44
 
65
45
        # run missing in a against b
66
 
        # this should not require missing to take out a write lock on a
 
46
        # this should not require missing to take out a write lock on a 
67
47
        # or b. So we take a write lock on both to test that at the same
68
48
        # time. This may let the test pass while the default branch is an
69
49
        # os-locking branch, but it will trigger failures with lockdir based
100
80
        lines3 = self.run_bzr('missing ../b --theirs-only', retcode=0)[0]
101
81
        self.assertEqualDiff('Other branch is up to date.\n', lines3)
102
82
 
103
 
        # relative to a, missing the 'merge' commit
 
83
        # relative to a, missing the 'merge' commit 
104
84
        os.chdir('../b')
105
85
        lines = self.run_bzr('missing ../a', retcode=1)[0].splitlines()
106
86
        self.assertEqual(missing, lines[0])
144
124
        self.assertEqualDiff('Other branch is up to date.\n',
145
125
                             self.run_bzr('missing ../a --theirs-only')[0])
146
126
 
147
 
    def test_missing_filtered(self):
148
 
        # create a source branch
149
 
        a_tree = self.make_branch_and_tree('a')
150
 
        self.build_tree_contents([('a/a', 'initial\n')])
151
 
        a_tree.add('a')
152
 
        a_tree.commit(message='r1')
153
 
        # clone and add differing revisions
154
 
        b_tree = a_tree.bzrdir.sprout('b').open_workingtree()
155
 
 
156
 
        for i in range(2, 6):
157
 
            a_tree.commit(message='a%d' % i)
158
 
            b_tree.commit(message='b%d' % i)
159
 
 
160
 
        os.chdir('a')
161
 
        # local
162
 
        out,err = self.run_bzr('missing ../b --my-revision 3', retcode=1)
163
 
        self.assertMessages(out, ('a3', 'b2', 'b3', 'b4', 'b5'), ('a2', 'a4'))
164
 
 
165
 
        out,err = self.run_bzr('missing ../b --my-revision 3..4', retcode=1)
166
 
        self.assertMessages(out, ('a3', 'a4'), ('a2', 'a5'))
167
 
 
168
 
        #remote
169
 
        out,err = self.run_bzr('missing ../b -r 3', retcode=1)
170
 
        self.assertMessages(out, ('a2', 'a3', 'a4', 'a5', 'b3'), ('b2', 'b4'))
171
 
 
172
 
        out,err = self.run_bzr('missing ../b -r 3..4', retcode=1)
173
 
        self.assertMessages(out, ('b3', 'b4'), ('b2', 'b5'))
174
 
 
175
 
        #both
176
 
        out,err = self.run_bzr('missing ../b --my-revision 3..4 -r 3..4',
177
 
            retcode=1)
178
 
        self.assertMessages(out, ('a3', 'a4', 'b3', 'b4'),
179
 
            ('a2', 'a5', 'b2', 'b5'))
180
 
 
181
127
    def test_missing_check_last_location(self):
182
128
        # check that last location shown as filepath not file URL
183
129