~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/version.py

  • Committer: Robert Collins
  • Date: 2007-07-04 08:08:13 UTC
  • mfrom: (2572 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2587.
  • Revision ID: robertc@robertcollins.net-20070704080813-wzebx0r88fvwj5rq
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2004, 2005, 2006 by Canonical Ltd
 
1
# Copyright (C) 2004, 2005, 2006, 2007 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 errors, osutils
 
23
from bzrlib import (
 
24
    bzrdir,
 
25
    config,
 
26
    errors,
 
27
    osutils,
 
28
    trace,
 
29
    )
24
30
from bzrlib.branch import Branch
25
31
 
26
32
 
35
41
        print "    revision:", revno
36
42
        print "    revid:", src_revision_id
37
43
        print "    branch nick:", src_tree.branch.nick
38
 
    print "Using python interpreter:", sys.executable
39
 
    import site
40
 
    print "Using python standard library:", os.path.dirname(site.__file__)
 
44
    print "Using Python interpreter:", sys.executable
 
45
    print "Using Python standard library:", os.path.dirname(os.__file__)
41
46
    print "Using bzrlib:",
42
47
    if len(bzrlib.__path__) > 1:
43
48
        # print repr, which is a good enough way of making it clear it's
45
50
        print repr(bzrlib.__path__)
46
51
    else:
47
52
        print bzrlib.__path__[0]
48
 
 
 
53
    print "Using Bazaar configuration:", config.config_dir()
 
54
    print "Using Bazaar log file:", trace._bzr_log_filename
49
55
    print
50
56
    print bzrlib.__copyright__
51
57
    print "http://bazaar-vcs.org/"
61
67
    If bzr is not being run from its working tree, returns None.
62
68
    """
63
69
    try:
64
 
        from bzrlib.workingtree import WorkingTree
65
 
        return WorkingTree.open_containing(__file__)[0]
66
 
    except (errors.NotBranchError, errors.UnknownFormatError):
 
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):
67
74
        return None