~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to hunk_selector.py

  • Committer: Robert Collins
  • Date: 2006-04-24 01:45:23 UTC
  • mto: (364.1.3 bzrtools)
  • mto: This revision was merged to the branch mainline in revision 366.
  • Revision ID: robertc@robertcollins.net-20060424014523-ef18f22034f17ec2
Backout debugging tweak to fai.py

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/python
2
2
 
3
 
import sys
4
 
 
5
3
from userinteractor import UserInteractor, UserOption
6
4
import copy
7
5
 
9
7
    strings = {}
10
8
 
11
9
    def __init__(self, patches):
12
 
        try:
13
 
            from colordiff import DiffWriter
14
 
            from terminal import has_ansi_colors
15
 
            if has_ansi_colors():
16
 
                self.diff_stream = DiffWriter(sys.stdout)
17
 
            else:
18
 
                self.diff_stream = sys.stdout
19
 
        except ImportError:
20
 
            self.diff_stream = sys.stdout
21
10
        self.standard_options = [
22
11
            UserOption('y', self._selected, self.strings['select_desc'],
23
12
                default=True),
76
65
    # Called once for each hunk
77
66
    def _hunk_callback(self, hunk, count):
78
67
        if self.last_printed != count:
79
 
            self.diff_stream.write(str(hunk.patch.get_header()))
80
 
            self.diff_stream.write(str(hunk))
 
68
            print hunk.patch.get_header(), hunk
81
69
            self.last_printed = count
82
70
 
83
71
        if hunk.selected: