~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Robert Collins
  • Date: 2010-04-08 04:34:03 UTC
  • mfrom: (5138 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5139.
  • Revision ID: robertc@robertcollins.net-20100408043403-56z0d07vdqrx7f3t
Update bugfix for 528114 to trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006 Canonical Ltd
 
1
# Copyright (C) 2006-2010 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
25
25
    tests,
26
26
    workingtree,
27
27
    )
 
28
from bzrlib.diff import (
 
29
    DiffTree,
 
30
    format_registry as diff_format_registry,
 
31
    )
28
32
 
29
33
 
30
34
def subst_dates(string):
132
136
        out, err = self.run_bzr('diff -r 1..23..123', retcode=3,
133
137
            error_regexes=('one or two revision specifiers',))
134
138
 
 
139
    def test_diff_using_and_format(self):
 
140
        out, err = self.run_bzr('diff --format=default --using=mydi', retcode=3,
 
141
            error_regexes=('are mutually exclusive',))
 
142
 
135
143
    def test_diff_nonexistent_revision(self):
136
144
        out, err = self.run_bzr('diff -r 123', retcode=3,
137
145
            error_regexes=("Requested revision: '123' does not "
297
305
        output = self.run_bzr('diff -r 1.. branch1', retcode=1)
298
306
        self.assertContainsRe(output[0], '\n\\-original line\n\\+repo line\n')
299
307
 
 
308
    def test_custom_format(self):
 
309
        class BooDiffTree(DiffTree):
 
310
 
 
311
            def show_diff(self, specific_files, extra_trees=None):
 
312
                self.to_file.write("BOO!\n")
 
313
                return super(BooDiffTree, self).show_diff(specific_files,
 
314
                    extra_trees)
 
315
 
 
316
        diff_format_registry.register("boo", BooDiffTree, 
 
317
            "Scary diff format")
 
318
        self.addCleanup(diff_format_registry.remove, "boo")
 
319
        self.make_example_branch()
 
320
        self.build_tree_contents([('hello', 'hello world!\n')])
 
321
        output = self.run_bzr('diff --format=boo', retcode=1)
 
322
        self.assertTrue("BOO!" in output[0])
 
323
 
300
324
 
301
325
class TestCheckoutDiff(TestDiff):
302
326