~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/version.py

  • Committer: Martin Pool
  • Date: 2007-03-23 21:46:46 UTC
  • mto: (2323.5.2 0.15)
  • mto: This revision was merged to the branch mainline in revision 2390.
  • Revision ID: mbp@sourcefrog.net-20070323214646-zfvwiprkvbhuvz6o
Don't warn about old wt format when getting bzr's version

This fixes selftest when bzr is run from an old-format tree 
(as pqm does)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2004, 2005, 2006 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 config, 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
 
61
66
    If bzr is not being run from its working tree, returns None.
62
67
    """
63
68
    try:
64
 
        from bzrlib.workingtree import WorkingTree
65
 
        return WorkingTree.open_containing(__file__)[0]
 
69
        control = bzrdir.BzrDir.open_containing(__file__)[0]
 
70
        return control.open_workingtree(recommend_upgrade=False)
66
71
    except (errors.NotBranchError, errors.UnknownFormatError,
67
72
            errors.NoWorkingTree):
68
73
        return None