~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to shell.py

  • Committer: Aaron Bentley
  • Date: 2006-12-04 14:32:43 UTC
  • Revision ID: abentley@panoramicfeedback.com-20061204143243-i28ph41mdgbsofev
Fixed handling of pipe errors when writing to patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
import string
25
25
import sys
26
26
 
27
 
from bzrlib import osutils
28
27
from bzrlib.branch import Branch
29
 
from bzrlib.config import config_dir, ensure_config_dir_exists
30
28
from bzrlib.commands import get_cmd_object, get_all_cmds, get_alias
31
29
from bzrlib.errors import BzrError
32
30
from bzrlib.workingtree import WorkingTree
82
80
            else:
83
81
                iter = iter_file_completions(self.text)
84
82
                completions.extend(filter_completions(iter, self.text))
85
 
            return completions
 
83
            return completions 
86
84
 
87
85
 
88
86
class PromptCmd(cmd.Cmd):
89
 
 
90
87
    def __init__(self):
91
88
        cmd.Cmd.__init__(self)
92
89
        self.prompt = "bzr> "
97
94
        self.set_title()
98
95
        self.set_prompt()
99
96
        self.identchars += '-'
100
 
        ensure_config_dir_exists()
101
 
        self.history_file = osutils.pathjoin(config_dir(), 'shell-history')
 
97
        self.history_file = os.path.expanduser("~/.bazaar/shell-history")
102
98
        readline.set_completer_delims(string.whitespace)
103
99
        if os.access(self.history_file, os.R_OK) and \
104
100
            os.path.isfile(self.history_file):
126
122
    def set_prompt(self):
127
123
        if self.tree is not None:
128
124
            try:
129
 
                prompt_data = (self.tree.branch.nick, self.tree.branch.revno(),
 
125
                prompt_data = (self.tree.branch.nick, self.tree.branch.revno(), 
130
126
                               self.tree.relpath('.'))
131
127
                prompt = " %s:%d/%s" % prompt_data
132
128
            except:
172
168
        alias_args = get_alias(args[0])
173
169
        if alias_args is not None:
174
170
            args[0] = alias_args.pop(0)
175
 
 
 
171
            
176
172
        commandname = args.pop(0)
177
173
        for char in ('|', '<', '>'):
178
174
            commandname = commandname.split(char)[0]
204
200
 
205
201
    def completedefault(self, text, line, begidx, endidx):
206
202
        """Perform completion for native commands.
207
 
 
 
203
        
208
204
        :param text: The text to complete
209
205
        :type text: str
210
206
        :param line: The entire line to complete