~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/version.py

  • Committer: John Arbash Meinel
  • Date: 2006-11-10 15:38:16 UTC
  • mto: This revision was merged to the branch mainline in revision 2129.
  • Revision ID: john@arbash-meinel.com-20061110153816-46acf76fc86a512b
use try/finally to clean up a nested progress bar during weave fetching

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2004, 2005, 2006, 2007 Canonical Ltd
 
1
# Copyright (C) 2004, 2005, 2006 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
20
20
import sys
21
21
 
22
22
import bzrlib
23
 
from bzrlib import (
24
 
    bzrdir,
25
 
    config,
26
 
    errors,
27
 
    osutils,
28
 
    trace,
29
 
    )
 
23
from bzrlib import errors, osutils
30
24
from bzrlib.branch import Branch
31
25
 
32
26
 
41
35
        print "    revision:", revno
42
36
        print "    revid:", src_revision_id
43
37
        print "    branch nick:", src_tree.branch.nick
44
 
    print "Using Python interpreter:", sys.executable
45
 
    print "Using Python standard library:", os.path.dirname(os.__file__)
 
38
    print "Using python interpreter:", sys.executable
 
39
    import site
 
40
    print "Using python standard library:", os.path.dirname(site.__file__)
46
41
    print "Using bzrlib:",
47
42
    if len(bzrlib.__path__) > 1:
48
43
        # print repr, which is a good enough way of making it clear it's
50
45
        print repr(bzrlib.__path__)
51
46
    else:
52
47
        print bzrlib.__path__[0]
53
 
    print "Using Bazaar configuration:", config.config_dir()
54
 
    print "Using Bazaar log file:", trace._bzr_log_filename
 
48
 
55
49
    print
56
50
    print bzrlib.__copyright__
57
51
    print "http://bazaar-vcs.org/"
67
61
    If bzr is not being run from its working tree, returns None.
68
62
    """
69
63
    try:
70
 
        control = bzrdir.BzrDir.open_containing(__file__)[0]
71
 
        return control.open_workingtree(recommend_upgrade=False)
72
 
    except (errors.NotBranchError, errors.UnknownFormatError,
73
 
            errors.NoWorkingTree):
 
64
        from bzrlib.workingtree import WorkingTree
 
65
        return WorkingTree.open_containing(__file__)[0]
 
66
    except (errors.NotBranchError, errors.UnknownFormatError):
74
67
        return None