~benoit.pierre/bzrtools/shell_improvements

« back to all changes in this revision

Viewing changes to shell.py

  • Committer: Benoît Pierre
  • Date: 2008-11-23 23:23:57 UTC
  • Revision ID: benoit.pierre@gmail.com-20081123232357-ug9vbwpezbl7sxi7
Factorize code and add wrapper for reconfigure command so prompt gets
updated to reflect the new tree.

Show diffs side-by-side

added added

removed removed

Lines of Context:
167
167
    def do_help(self, line):
168
168
        self.default("help "+line)
169
169
 
170
 
    def do_switch(self, line):
171
 
        result = self.default('switch '+line)
 
170
    def exec_and_update_tree(self, line):
 
171
        result = self.default(line)
172
172
        if 0 == result:
173
173
            try:
174
174
                self.tree = WorkingTree.open_containing(".")[0]
176
176
                self.tree = None
177
177
        return result
178
178
 
 
179
    def do_switch(self, line):
 
180
        return self.exec_and_update_tree('switch ' + line)
 
181
 
 
182
    def do_reconfigure(self, line):
 
183
        return self.exec_and_update_tree('reconfigure ' + line)
 
184
 
179
185
    def default(self, line):
180
186
        args = shlex.split(line)
181
187
        alias_args = get_alias(args[0])