~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Alexander Belchenko
  • Date: 2006-09-05 07:37:01 UTC
  • mto: (1711.9.17 jam-integration)
  • mto: This revision was merged to the branch mainline in revision 1984.
  • Revision ID: bialix@ukr.net-20060905073701-93e7c0a44dd7ee05
small but important fix for 'make installer' dependencies

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006 Canonical Ltd
 
1
# Copyright (C) 2005, 2006 by 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
34
34
                  'YYYY-MM-DD HH:MM:SS +ZZZZ', string)
35
35
 
36
36
 
37
 
class DiffBase(ExternalBase):
38
 
    """Base class with common setup method"""
 
37
class TestDiff(ExternalBase):
39
38
 
40
39
    def make_example_branch(self):
41
40
        # FIXME: copied from test_too_much -- share elsewhere?
47
46
        tree.add(['goodbye'])
48
47
        tree.commit('setup')
49
48
 
50
 
 
51
 
class TestDiff(DiffBase):
52
 
 
53
49
    def test_diff(self):
54
50
        self.make_example_branch()
55
51
        file('hello', 'wt').write('hello world!')
118
114
        out, err = self.runbzr('diff does-not-exist', retcode=3)
119
115
        self.assertContainsRe(err, 'not versioned.*does-not-exist')
120
116
 
121
 
    def test_diff_illegal_revision_specifiers(self):
122
 
        out, err = self.runbzr('diff -r 1..23..123', retcode=3)
123
 
        self.assertContainsRe(err, 'one or two revision specifiers')
124
 
 
125
117
    def test_diff_unversioned(self):
126
118
        # Get an error when diffing a non-versioned file.
127
119
        # (Malone #3619)
238
230
        os.chdir('checkouts')
239
231
 
240
232
 
241
 
class TestDiffLabels(DiffBase):
 
233
class TestDiffLabels(TestDiff):
242
234
 
243
235
    def test_diff_label_removed(self):
244
236
        super(TestDiffLabels, self).make_example_branch()
266
258
        self.assertTrue("=== renamed file 'hello' => 'gruezi'" in diff[0])
267
259
 
268
260
 
269
 
class TestExternalDiff(DiffBase):
 
261
class TestExternalDiff(TestDiff):
270
262
 
271
263
    def test_external_diff(self):
272
264
        """Test that we can spawn an external diff process"""
280
272
            os.environ['BZR_PROGRESS_BAR'] = 'none'
281
273
            out, err = self.run_bzr_subprocess('diff', '-r', '1',
282
274
                                               '--diff-options', '-ub',
283
 
                                               universal_newlines=True,
284
275
                                               retcode=None)
285
276
        finally:
286
277
            if orig_progress is None:
298
289
                                   "+++ goodbye\t")
299
290
        self.assertEndsWith(out, "\n@@ -0,0 +1 @@\n"
300
291
                                 "+baz\n\n")
301
 
 
302
 
 
303
 
class TestDiffOutput(DiffBase):
304
 
 
305
 
    def test_diff_output(self):
306
 
        # check that output doesn't mangle line-endings
307
 
        self.make_example_branch()
308
 
        file('hello', 'wb').write('hello world!\n')
309
 
        output = self.run_bzr_subprocess('diff', retcode=1)[0]
310
 
        self.assert_('\n+hello world!\n' in output)