~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-08-16 04:31:16 UTC
  • mfrom: (1819.1.9 bzr.mbp.perf-history)
  • Revision ID: pqm@pqm.ubuntu.com-20060816043116-0e82b6cea99bffd4
(mbp) performance-history tracking

Show diffs side-by-side

added added

removed removed

Lines of Context:
1985
1985
                test_suite_factory = benchmarks.test_suite
1986
1986
                if verbose is None:
1987
1987
                    verbose = True
 
1988
                benchfile = open(".perf_history", "at")
1988
1989
            else:
1989
1990
                test_suite_factory = None
1990
1991
                if verbose is None:
1991
1992
                    verbose = False
1992
 
            result = selftest(verbose=verbose, 
1993
 
                              pattern=pattern,
1994
 
                              stop_on_failure=one, 
1995
 
                              keep_output=keep_output,
1996
 
                              transport=transport,
1997
 
                              test_suite_factory=test_suite_factory,
1998
 
                              lsprof_timed=lsprof_timed)
 
1993
                benchfile = None
 
1994
            try:
 
1995
                result = selftest(verbose=verbose, 
 
1996
                                  pattern=pattern,
 
1997
                                  stop_on_failure=one, 
 
1998
                                  keep_output=keep_output,
 
1999
                                  transport=transport,
 
2000
                                  test_suite_factory=test_suite_factory,
 
2001
                                  lsprof_timed=lsprof_timed,
 
2002
                                  bench_history=benchfile)
 
2003
            finally:
 
2004
                if benchfile is not None:
 
2005
                    benchfile.close()
1999
2006
            if result:
2000
2007
                info('tests passed')
2001
2008
            else:
2005
2012
            ui.ui_factory = save_ui
2006
2013
 
2007
2014
 
2008
 
def _get_bzr_branch():
2009
 
    """If bzr is run from a branch, return Branch or None"""
2010
 
    from os.path import dirname
2011
 
    
2012
 
    try:
2013
 
        branch = Branch.open(dirname(osutils.abspath(dirname(__file__))))
2014
 
        return branch
2015
 
    except errors.BzrError:
2016
 
        return None
2017
 
    
2018
 
 
2019
 
def show_version():
2020
 
    import bzrlib
2021
 
    print "Bazaar (bzr) %s" % bzrlib.__version__
2022
 
    # is bzrlib itself in a branch?
2023
 
    branch = _get_bzr_branch()
2024
 
    if branch:
2025
 
        rh = branch.revision_history()
2026
 
        revno = len(rh)
2027
 
        print "  bzr checkout, revision %d" % (revno,)
2028
 
        print "  nick: %s" % (branch.nick,)
2029
 
        if rh:
2030
 
            print "  revid: %s" % (rh[-1],)
2031
 
    print "Using python interpreter:", sys.executable
2032
 
    import site
2033
 
    print "Using python standard library:", os.path.dirname(site.__file__)
2034
 
    print "Using bzrlib:",
2035
 
    if len(bzrlib.__path__) > 1:
2036
 
        # print repr, which is a good enough way of making it clear it's
2037
 
        # more than one element (eg ['/foo/bar', '/foo/bzr'])
2038
 
        print repr(bzrlib.__path__)
2039
 
    else:
2040
 
        print bzrlib.__path__[0]
2041
 
 
2042
 
    print
2043
 
    print bzrlib.__copyright__
2044
 
    print "http://bazaar-vcs.org/"
2045
 
    print
2046
 
    print "bzr comes with ABSOLUTELY NO WARRANTY.  bzr is free software, and"
2047
 
    print "you may use, modify and redistribute it under the terms of the GNU"
2048
 
    print "General Public License version 2 or later."
2049
 
 
2050
 
 
2051
2015
class cmd_version(Command):
2052
2016
    """Show version of bzr."""
2053
2017
 
2054
2018
    @display_command
2055
2019
    def run(self):
 
2020
        from bzrlib.version import show_version
2056
2021
        show_version()
2057
2022
 
2058
2023