~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: 2010-02-03 10:06:19 UTC
  • mfrom: (4999.3.2 apport)
  • Revision ID: pqm@pqm.ubuntu.com-20100203100619-f76bo5y5bd5c14wk
(mbp) use apport to send bugs, not just store them

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2010 Canonical Ltd
 
1
# Copyright (C) 2004, 2005, 2006, 2007, 2009 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
16
16
 
17
17
"""Report on version of bzrlib"""
18
18
 
19
 
from __future__ import absolute_import
20
 
 
21
19
import os
22
20
import sys
23
21
 
24
22
import bzrlib
25
23
from bzrlib import (
 
24
    bzrdir,
26
25
    config,
27
 
    controldir,
28
26
    errors,
29
27
    osutils,
30
28
    trace,
31
29
    )
 
30
from bzrlib.branch import Branch
32
31
 
33
32
 
34
33
def show_version(show_config=True, show_copyright=True, to_file=None):
75
74
    else:
76
75
        to_file.write(bzrlib.__path__[0] + '\n')
77
76
    if show_config:
78
 
        config_dir = osutils.normpath(config.config_dir())  # use native slashes
 
77
        config_dir = os.path.normpath(config.config_dir())  # use native slashes
79
78
        if not isinstance(config_dir, unicode):
80
79
            config_dir = config_dir.decode(osutils.get_user_encoding())
81
80
        to_file.write("  Bazaar configuration: %s\n" % (config_dir,))
100
99
    If bzr is not being run from its working tree, returns None.
101
100
    """
102
101
    try:
103
 
        control = controldir.ControlDir.open_containing(__file__)[0]
 
102
        control = bzrdir.BzrDir.open_containing(__file__)[0]
104
103
        return control.open_workingtree(recommend_upgrade=False)
105
104
    except (errors.NotBranchError, errors.UnknownFormatError,
106
105
            errors.NoWorkingTree):