1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
#!/usr/bin/python
"""Show paths used by bzr itself and push/pull locations for current branch
Written by Alexander Belchenko, 2006
License: Free for bzr users
"""
from bzrlib.commands import Command, register_command
class cmd_show_paths(Command):
"""Show paths used by bzr itself and push/pull locations for current branch"""
def run(self):
import os
import sys
import bzrlib
from bzrlib.branch import Branch
from bzrlib.config import config_dir
from bzrlib.errors import NotBranchError, NoWorkingTree
from bzrlib import osutils
from bzrlib.plugin import DEFAULT_PLUGIN_PATH
from bzrlib import plugins
from bzrlib import trace
from bzrlib.workingtree import WorkingTree
FORMAT = '%16s: %s'
print FORMAT % ('bzr executable', osutils.realpath(sys.argv[0]))
print FORMAT % ('bzrlib', osutils.realpath(bzrlib.__path__[0]))
print FORMAT % ('bzr config dir', osutils.realpath(config_dir()))
dirs = os.environ.get('BZR_PLUGIN_PATH', DEFAULT_PLUGIN_PATH).split(os.pathsep)
dirs.insert(0, os.path.dirname(plugins.__file__))
if len(dirs) == 1:
print FORMAT % ('bzr plugins dir', osutils.realpath(dirs[0]))
else:
print FORMAT % ('bzr plugins dirs', osutils.realpath(dirs[0]))
for dir_ in dirs[1:]:
print FORMAT % ('', osutils.realpath(dir_))
print FORMAT % ('.bzr.log', osutils.realpath(trace._bzr_log_file.name))
try:
try:
branch = WorkingTree.open_containing(u'.')[0].branch
except NoWorkingTree:
branch = Branch.open_containing(u'.')[0]
pull_loc = branch.get_parent() or 'None'
print FORMAT % ('branch pull from', pull_loc)
push_loc = branch.get_push_location() or 'None'
print FORMAT % ('branch push to', push_loc)
except NotBranchError:
pass
register_command(cmd_show_paths)
|