~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/shelf_ui.py

  • Committer: Aaron Bentley
  • Date: 2008-10-17 03:49:08 UTC
  • mto: This revision was merged to the branch mainline in revision 3823.
  • Revision ID: aaron@aaronbentley.com-20081017034908-n330q3dlomiaookr
Remove dependencies on bzrtools

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
    delta,
26
26
    diff,
27
27
    errors,
 
28
    osutils,
28
29
    patches,
29
30
    shelf,
30
31
    textfile,
31
32
    trace,
32
33
    ui,
33
34
    workingtree)
34
 
from bzrlib.plugins.bzrtools import colordiff
35
 
from bzrlib.plugins.bzrtools.userinteractor import getchar
 
35
try:
 
36
    from bzrlib.plugins.bzrtools import colordiff
 
37
except ImportError:
 
38
    colordiff = None
36
39
 
37
40
 
38
41
class Shelver(object):
45
48
        self.diff_file = StringIO()
46
49
        self.text_differ = diff.DiffText(self.target_tree, self.work_tree,
47
50
                                         self.diff_file)
48
 
        self.diff_writer = colordiff.DiffWriter(sys.stdout, False)
 
51
        if colordiff is not None:
 
52
            self.diff_writer = colordiff.DiffWriter(sys.stdout, False)
 
53
        else:
 
54
            self.diff_writer = sys.stdout
49
55
        self.manager = work_tree.get_shelf_manager()
50
56
        self.auto = auto
51
57
        self.auto_apply = auto_apply
129
135
            return True
130
136
        message = question + ' [yNfq]'
131
137
        sys.stdout.write(message)
132
 
        char = getchar()
 
138
        char = osutils.getchar()
133
139
        sys.stdout.write("\r" + ' ' * len(message) + '\r')
134
140
        sys.stdout.flush()
135
141
        if char == 'y':