~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to shelf.py

  • Committer: Aaron Bentley
  • Date: 2005-10-04 16:52:26 UTC
  • mto: This revision was merged to the branch mainline in revision 211.
  • Revision ID: abentley@panoramicfeedback.com-20051004165226-05abbb66e0127c5f
Applied win32 compatibility fix from Belchenko

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
import os
5
5
import sys
6
6
import string
7
 
import tty, termios
8
7
import glob
9
8
from bzrlib.commands import Command
10
9
from bzrlib.branch import Branch
339
338
            print '    %d hunks to be kept' % keep
340
339
            print
341
340
 
342
 
    def __getchar(self):
343
 
        fd = sys.stdin.fileno()
344
 
        settings = termios.tcgetattr(fd)
345
 
        try:
346
 
            tty.setraw(fd)
347
 
            ch = sys.stdin.read(1)
348
 
        finally:
349
 
            termios.tcsetattr(fd, termios.TCSADRAIN, settings)
350
 
        return ch
 
341
    if sys.platform != "win32":
 
342
        def __getchar(self):
 
343
            import tty
 
344
            import termios
 
345
            fd = sys.stdin.fileno()
 
346
            settings = termios.tcgetattr(fd)
 
347
            try:
 
348
                tty.setraw(fd)
 
349
                ch = sys.stdin.read(1)
 
350
            finally:
 
351
                termios.tcsetattr(fd, termios.TCSADRAIN, settings)
 
352
            return ch
 
353
    else:
 
354
        import msvcrt
 
355
        def __getchar(self):
 
356
            return msvcrt.getche()
351
357
 
352
358
    def __ask_user(self, prompt, options):
353
359
        while True: