~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/version.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-06-12 02:17:42 UTC
  • mfrom: (2521.1.1 56322)
  • Revision ID: pqm@pqm.ubuntu.com-20070612021742-uetsy3g747iq3xkk
mergeĀ initĀ --create-prefix

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
    )
24
29
from bzrlib.branch import Branch
25
30
 
26
31
 
36
41
        print "    revid:", src_revision_id
37
42
        print "    branch nick:", src_tree.branch.nick
38
43
    print "Using python interpreter:", sys.executable
39
 
    import site
40
 
    print "Using python standard library:", os.path.dirname(site.__file__)
 
44
    print "Using python standard library:", os.path.dirname(os.__file__)
41
45
    print "Using bzrlib:",
42
46
    if len(bzrlib.__path__) > 1:
43
47
        # print repr, which is a good enough way of making it clear it's
45
49
        print repr(bzrlib.__path__)
46
50
    else:
47
51
        print bzrlib.__path__[0]
48
 
 
 
52
    print "Using bazaar configuration:", config.config_dir()
49
53
    print
50
54
    print bzrlib.__copyright__
51
55
    print "http://bazaar-vcs.org/"
61
65
    If bzr is not being run from its working tree, returns None.
62
66
    """
63
67
    try:
64
 
        from bzrlib.workingtree import WorkingTree
65
 
        return WorkingTree.open_containing(__file__)[0]
66
 
    except (errors.NotBranchError, errors.UnknownFormatError):
 
68
        control = bzrdir.BzrDir.open_containing(__file__)[0]
 
69
        return control.open_workingtree(recommend_upgrade=False)
 
70
    except (errors.NotBranchError, errors.UnknownFormatError,
 
71
            errors.NoWorkingTree):
67
72
        return None