~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to hunk_selector.py

  • Committer: Aaron Bentley
  • Date: 2006-06-27 14:36:32 UTC
  • Revision ID: abentley@panoramicfeedback.com-20060627143632-0f4114d7b0a8d7d9
Fix zap for checkouts of branches with no parents

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: