Merge lp://qastaging/~doxxx/bzrtools/shell-dir into lp://qastaging/bzrtools

Proposed by Gordon Tyler
Status: Merged
Merged at revision: not available
Proposed branch: lp://qastaging/~doxxx/bzrtools/shell-dir
Merge into: lp://qastaging/bzrtools
Diff against target: 48 lines (+14/-4)
2 files modified
command_classes.py (+11/-3)
shell.py (+3/-1)
To merge this branch: bzr merge lp://qastaging/~doxxx/bzrtools/shell-dir
Reviewer Review Type Date Requested Status
Aaron Bentley Approve
Review via email: mp+14919@code.qastaging.launchpad.net
To post a comment you must log in.
Revision history for this message
Gordon Tyler (doxxx) wrote :

Adds support for a --directory (-d) option to the shell command which changes the working directory to the given path before starting the shell.

Usecase: On Windows, I can add a context menu entry for folders to run 'bzr shell -d %1' to start the shell in the selected folder.

Revision history for this message
Aaron Bentley (abentley) wrote :

Thanks, taken.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'command_classes.py'
2--- command_classes.py 2009-10-20 22:21:59 +0000
3+++ command_classes.py 2009-11-16 20:55:18 +0000
4@@ -48,7 +48,7 @@
5
6 class cmd_graph_ancestry(BzrToolsCommand):
7 """Produce ancestry graphs using dot.
8-
9+
10 Output format is detected according to file extension. Some of the more
11 common output formats are html, png, gif, svg, ps. An extension of '.dot'
12 will cause a dot graph file to be produced. HTML output has mouseovers
13@@ -342,9 +342,17 @@
14 --all --help --revision --show-ids
15 bzr bzrtools:287/> status --
16 """
17- def run(self):
18+ takes_options = [
19+ Option('directory',
20+ help='Branch in which to start the shell, '
21+ 'rather than the one containing the working directory.',
22+ short_name='d',
23+ type=unicode,
24+ ),
25+ ]
26+ def run(self, directory=None):
27 import shell
28- return shell.run_shell()
29+ return shell.run_shell(directory)
30
31
32 class cmd_branch_history(BzrToolsCommand):
33
34=== modified file 'shell.py'
35--- shell.py 2009-11-12 09:17:55 +0000
36+++ shell.py 2009-11-16 20:55:18 +0000
37@@ -227,8 +227,10 @@
38 return CompletionContext(text, command=cmd).get_completions()
39
40
41-def run_shell():
42+def run_shell(directory=None):
43 try:
44+ if not directory is None:
45+ os.chdir(directory)
46 prompt = PromptCmd()
47 while True:
48 try:

Subscribers

People subscribed via source and target branches