275
275
--dry-run will show which files would be added, but not actually
278
--file-ids-from will try to use the file ids from the supplied path.
279
It looks up ids trying to find a matching parent directory with the
280
same filename, and then by pure path.
278
282
takes_args = ['file*']
279
takes_options = ['no-recurse', 'dry-run', 'verbose']
283
takes_options = ['no-recurse', 'dry-run', 'verbose',
284
Option('file-ids-from', type=unicode,
285
help='Lookup file ids from here')]
280
286
encoding_type = 'replace'
282
def run(self, file_list, no_recurse=False, dry_run=False, verbose=False):
288
def run(self, file_list, no_recurse=False, dry_run=False, verbose=False,
283
290
import bzrlib.add
285
action = bzrlib.add.AddAction(to_file=self.outf,
286
should_print=(not is_quiet()))
288
added, ignored = bzrlib.add.smart_add(file_list, not no_recurse,
292
if file_ids_from is not None:
294
base_tree, base_path = WorkingTree.open_containing(
296
except errors.NoWorkingTree:
297
base_branch, base_path = branch.Branch.open_containing(
299
base_tree = base_branch.basis_tree()
301
action = bzrlib.add.AddFromBaseAction(base_tree, base_path,
302
to_file=self.outf, should_print=(not is_quiet()))
304
action = bzrlib.add.AddAction(to_file=self.outf,
305
should_print=(not is_quiet()))
307
added, ignored = bzrlib.add.smart_add(file_list, not no_recurse,
289
308
action=action, save=not dry_run)
290
309
if len(ignored) > 0:
1933
1952
Option('lsprof-timed',
1934
1953
help='generate lsprof output for benchmarked'
1935
1954
' sections of code.'),
1955
Option('cache-dir', type=str,
1956
help='a directory to cache intermediate'
1957
' benchmark steps'),
1938
1960
def run(self, testspecs_list=None, verbose=None, one=False,
1939
1961
keep_output=False, transport=None, benchmark=None,
1962
lsprof_timed=None, cache_dir=None):
1941
1963
import bzrlib.ui
1942
1964
from bzrlib.tests import selftest
1943
1965
import bzrlib.benchmarks as benchmarks
1966
from bzrlib.benchmarks import tree_creator
1968
if cache_dir is not None:
1969
tree_creator.TreeCreator.CACHE_ROOT = osutils.abspath(cache_dir)
1944
1970
# we don't want progress meters from the tests to go to the
1945
1971
# real output; and we don't want log messages cluttering up
1946
1972
# the real logs.
1959
1985
test_suite_factory = benchmarks.test_suite
1960
1986
if verbose is None:
1988
benchfile = open(".perf_history", "at")
1963
1990
test_suite_factory = None
1964
1991
if verbose is None:
1965
1992
verbose = False
1966
result = selftest(verbose=verbose,
1968
stop_on_failure=one,
1969
keep_output=keep_output,
1970
transport=transport,
1971
test_suite_factory=test_suite_factory,
1972
lsprof_timed=lsprof_timed)
1995
result = selftest(verbose=verbose,
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)
2004
if benchfile is not None:
1974
2007
info('tests passed')
1979
2012
ui.ui_factory = save_ui
1982
def _get_bzr_branch():
1983
"""If bzr is run from a branch, return Branch or None"""
1984
from os.path import dirname
1987
branch = Branch.open(dirname(osutils.abspath(dirname(__file__))))
1989
except errors.BzrError:
1995
print "Bazaar (bzr) %s" % bzrlib.__version__
1996
# is bzrlib itself in a branch?
1997
branch = _get_bzr_branch()
1999
rh = branch.revision_history()
2001
print " bzr checkout, revision %d" % (revno,)
2002
print " nick: %s" % (branch.nick,)
2004
print " revid: %s" % (rh[-1],)
2005
print "Using python interpreter:", sys.executable
2007
print "Using python standard library:", os.path.dirname(site.__file__)
2008
print "Using bzrlib:",
2009
if len(bzrlib.__path__) > 1:
2010
# print repr, which is a good enough way of making it clear it's
2011
# more than one element (eg ['/foo/bar', '/foo/bzr'])
2012
print repr(bzrlib.__path__)
2014
print bzrlib.__path__[0]
2017
print bzrlib.__copyright__
2018
print "http://bazaar-vcs.org/"
2020
print "bzr comes with ABSOLUTELY NO WARRANTY. bzr is free software, and"
2021
print "you may use, modify and redistribute it under the terms of the GNU"
2022
print "General Public License version 2 or later."
2025
2015
class cmd_version(Command):
2026
2016
"""Show version of bzr."""
2028
2018
@display_command
2020
from bzrlib.version import show_version