~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to shelf.py

  • Committer: Robert Collins
  • Date: 2005-10-16 00:25:31 UTC
  • mfrom: (147.2.14)
  • mto: (147.4.12) (364.1.3 bzrtools)
  • mto: This revision was merged to the branch mainline in revision 324.
  • Revision ID: robertc@lifelesslap.robertcollins.net-20051016002531-bc0d149f1ee42823
merge from aaron, and update test imports to import successfully.

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
 
10
from bzrlib import DEFAULT_IGNORE
 
11
 
 
12
DEFAULT_IGNORE.append('./.bzr-shelf*')
11
13
 
12
14
def main(args):
13
15
    name = os.path.basename(args.pop(0))
336
338
            print '    %d hunks to be kept' % keep
337
339
            print
338
340
 
339
 
    def __getchar(self):
340
 
        fd = sys.stdin.fileno()
341
 
        settings = termios.tcgetattr(fd)
342
 
        try:
343
 
            tty.setraw(fd)
344
 
            ch = sys.stdin.read(1)
345
 
        finally:
346
 
            termios.tcsetattr(fd, termios.TCSADRAIN, settings)
347
 
        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()
348
357
 
349
358
    def __ask_user(self, prompt, options):
350
359
        while True: