~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to colordiff.py

  • Committer: Aaron Bentley
  • Date: 2008-11-23 21:03:13 UTC
  • Revision ID: aaron@aaronbentley.com-20081123210313-12bufxf1tobd5x08
Fix has_ansi_colors

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
        self.target = target
47
47
        self.lp = LineParser()
48
48
        self.chunks = []
 
49
        from terminal import has_ansi_colors
49
50
        if 'always' == color or ('auto' == color and has_ansi_colors()):
50
51
            self.colors = {
51
52
                'metaline':      'darkyellow',
190
191
        self._old_lines, self._new_lines = ([], [])
191
192
 
192
193
 
 
194
def auto_diff_writer(output):
 
195
    return DiffWriter(output, color='auto')
 
196
 
 
197
 
193
198
def colordiff(color, check_style, *args, **kwargs):
194
 
    from terminal import has_ansi_colors
195
199
    real_stdout = sys.stdout
196
200
    dw = DiffWriter(real_stdout, check_style, color)
197
201
    sys.stdout = dw