Rev 3194: (andrew) Turn --coverage into a global option. in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Mon Jan 21 07:20:32 GMT 2008
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 3194
revision-id:pqm at pqm.ubuntu.com-20080121072020-0eye263yx2bmir2b
parent: pqm at pqm.ubuntu.com-20080118055224-sskoia4bcpxd8wzu
parent: andrew.bennetts at canonical.com-20080121054429-h0opjtumr11boy2w
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Mon 2008-01-21 07:20:20 +0000
message:
(andrew) Turn --coverage into a global option.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/commands.py bzr.py-20050309040720-d10f4714595cf8c3
bzrlib/help_topics/__init__.py help_topics.py-20060920210027-rnim90q9e0bwxvy4-1
bzrlib/tests/__init__.py selftest.py-20050531073622-8d0e3c8845c97a64
------------------------------------------------------------
revno: 3169.3.4
revision-id:andrew.bennetts at canonical.com-20080121054429-h0opjtumr11boy2w
parent: andrew.bennetts at canonical.com-20080121010630-2dn84x018azaace2
committer: Andrew Bennetts <andrew.bennetts at canonical.com>
branch nick: global-coverage
timestamp: Mon 2008-01-21 16:44:29 +1100
message:
Warn if --coverage is used with a conflicting global option.
modified:
bzrlib/commands.py bzr.py-20050309040720-d10f4714595cf8c3
------------------------------------------------------------
revno: 3169.3.3
revision-id:andrew.bennetts at canonical.com-20080121010630-2dn84x018azaace2
parent: andrew.bennetts at canonical.com-20080121004632-wvpox6g9j7czn4vk
committer: Andrew Bennetts <andrew.bennetts at canonical.com>
branch nick: global-coverage
timestamp: Mon 2008-01-21 12:06:30 +1100
message:
Move NEWS entry to right location.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
------------------------------------------------------------
revno: 3169.3.2
revision-id:andrew.bennetts at canonical.com-20080121004632-wvpox6g9j7czn4vk
parent: andrew.bennetts at canonical.com-20080107120712-06hptn3zo84exauj
parent: pqm at pqm.ubuntu.com-20080118055224-sskoia4bcpxd8wzu
committer: Andrew Bennetts <andrew.bennetts at canonical.com>
branch nick: global-coverage
timestamp: Mon 2008-01-21 11:46:32 +1100
message:
Merge from bzr.dev.
added:
bzrlib/tests/repository_implementations/test_has_revisions.py test_has_revisions.p-20080111035443-xaupgdsx5fw1q54b-1
doc/en/user-guide/revnos.txt revnos.txt-20080111231928-pbntxea0ynh9ww1t-1
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzr bzr.py-20050313053754-5485f144c7006fa6
bzrlib/__init__.py __init__.py-20050309040759-33e65acf91bbcd5d
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/bzrdir.py bzrdir.py-20060131065624-156dfea39c4387cb
bzrlib/debug.py debug.py-20061102062349-vdhrw9qdpck8cl35-1
bzrlib/fetch.py fetch.py-20050818234941-26fea6105696365d
bzrlib/graph.py graph_walker.py-20070525030359-y852guab65d4wtn0-1
bzrlib/help_topics/__init__.py help_topics.py-20060920210027-rnim90q9e0bwxvy4-1
bzrlib/knit.py knit.py-20051212171256-f056ac8f0fbe1bd9
bzrlib/merge.py merge.py-20050513021216-953b65a438527106
bzrlib/reconfigure.py reconfigure.py-20070908040425-6ykgo7escxhyrg9p-1
bzrlib/remote.py remote.py-20060720103555-yeeg2x51vn0rbtdp-1
bzrlib/repofmt/knitrepo.py knitrepo.py-20070206081537-pyy4a00xdas0j4pf-1
bzrlib/repofmt/pack_repo.py pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
bzrlib/repofmt/weaverepo.py presplitout.py-20070125045333-wfav3tsh73oxu3zk-1
bzrlib/repository.py rev_storage.py-20051111201905-119e9401e46257e3
bzrlib/revisiontree.py revisiontree.py-20060724012533-bg8xyryhxd0o0i0h-1
bzrlib/smart/client.py client.py-20061116014825-2k6ada6xgulslami-1
bzrlib/smart/medium.py medium.py-20061103051856-rgu2huy59fkz902q-1
bzrlib/smart/protocol.py protocol.py-20061108035435-ot0lstk2590yqhzr-1
bzrlib/smart/repository.py repository.py-20061128022038-vr5wy5bubyb8xttk-1
bzrlib/smart/request.py request.py-20061108095550-gunadhxmzkdjfeek-1
bzrlib/symbol_versioning.py symbol_versioning.py-20060105104851-9ecf8af605d15a80
bzrlib/tests/TestUtil.py TestUtil.py-20050824080200-5f70140a2d938694
bzrlib/tests/blackbox/test_log.py test_log.py-20060112090212-78f6ea560c868e24
bzrlib/tests/blackbox/test_merge.py test_merge.py-20060323225809-9bc0459c19917f41
bzrlib/tests/interrepository_implementations/test_interrepository.py test_interrepository.py-20060220061411-1ec13fa99e5e3eee
bzrlib/tests/repository_implementations/__init__.py __init__.py-20060131092037-9564957a7d4a841b
bzrlib/tests/repository_implementations/test_repository.py test_repository.py-20060131092128-ad07f494f5c9d26c
bzrlib/tests/test_annotate.py test_annotate.py-20061213215015-sttc9agsxomls7q0-1
bzrlib/tests/test_graph.py test_graph_walker.py-20070525030405-enq4r60hhi9xrujc-1
bzrlib/tests/test_log.py testlog.py-20050728115707-1a514809d7d49309
bzrlib/tests/test_merge.py testmerge.py-20050905070950-c1b5aa49ff911024
bzrlib/tests/test_merge_core.py test_merge_core.py-20050824132511-eb99b23a0eec641b
bzrlib/tests/test_osutils.py test_osutils.py-20051201224856-e48ee24c12182989
bzrlib/tests/test_reconfigure.py test_reconfigure.py-20070908040425-6ykgo7escxhyrg9p-2
bzrlib/tests/test_remote.py test_remote.py-20060720103555-yeeg2x51vn0rbtdp-2
bzrlib/tests/test_repository.py test_repository.py-20060131075918-65c555b881612f4d
bzrlib/tests/test_smart.py test_smart.py-20061122024551-ol0l0o0oofsu9b3t-2
bzrlib/tests/test_smart_transport.py test_ssh_transport.py-20060608202016-c25gvf1ob7ypbus6-2
bzrlib/tests/test_transform.py test_transaction.py-20060105172520-b3ffb3946550e6c4
bzrlib/tests/test_tsort.py testtsort.py-20051025073946-27da871c394d5be4
bzrlib/trace.py trace.py-20050309040759-c8ed824bdcd4748a
bzrlib/transform.py transform.py-20060105172343-dd99e54394d91687
bzrlib/transport/__init__.py transport.py-20050711165921-4978aa7ce1285ad5
bzrlib/transport/remote.py ssh.py-20060608202016-c25gvf1ob7ypbus6-1
bzrlib/tsort.py tsort.py-20051025073946-7808f6aaf7d07208
bzrlib/xml_serializer.py xml.py-20050309040759-57d51586fdec365d
doc/developers/HACKING.txt HACKING-20050805200004-2a5dc975d870f78c
doc/en/tutorials/using_bazaar_with_launchpad.txt using_bazaar_with_lp-20071211073140-7msh8uf9a9h4y9hb-1
doc/en/user-guide/controlling_registration.txt controlling_registra-20071121073725-0corxykv5irjal00-3
doc/en/user-guide/core_concepts.txt core_concepts.txt-20071114035000-q36a9h57ps06uvnl-2
doc/en/user-guide/index.txt index.txt-20060622101119-tgwtdci8z769bjb9-2
------------------------------------------------------------
revno: 3169.3.1
revision-id:andrew.bennetts at canonical.com-20080107120712-06hptn3zo84exauj
parent: pqm at pqm.ubuntu.com-20080105015401-67wgbytv81394cl1
committer: Andrew Bennetts <andrew.bennetts at canonical.com>
branch nick: global-coverage
timestamp: Mon 2008-01-07 23:07:12 +1100
message:
Make --coverage a global option.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/commands.py bzr.py-20050309040720-d10f4714595cf8c3
bzrlib/help_topics/__init__.py help_topics.py-20060920210027-rnim90q9e0bwxvy4-1
bzrlib/tests/__init__.py selftest.py-20050531073622-8d0e3c8845c97a64
=== modified file 'NEWS'
--- a/NEWS 2008-01-17 23:45:03 +0000
+++ b/NEWS 2008-01-21 01:06:30 +0000
@@ -36,6 +36,9 @@
* Fetching between different repository formats with compatible models now
takes advantage of the smart method to stream revisions. (Andrew Bennetts)
+ * The ``--coverage`` option is now global, rather specific to ``bzr
+ selftest``. (Andrew Bennetts)
+
BUGFIXES:
* Calculate remote path relative to the shared medium in _SmartClient. This
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py 2008-01-16 12:47:54 +0000
+++ b/bzrlib/builtins.py 2008-01-21 00:46:32 +0000
@@ -2598,9 +2598,6 @@
' expression.'),
Option('strict', help='Fail on missing dependencies or '
'known failures.'),
- Option('coverage', type=str, argname="DIRECTORY",
- help='Generate line coverage report in this '
- 'directory.'),
]
encoding_type = 'replace'
@@ -2608,7 +2605,7 @@
transport=None, benchmark=None,
lsprof_timed=None, cache_dir=None,
first=False, list_only=False,
- randomize=None, exclude=None, strict=False, coverage=None):
+ randomize=None, exclude=None, strict=False):
import bzrlib.ui
from bzrlib.tests import selftest
import bzrlib.benchmarks as benchmarks
@@ -2650,7 +2647,6 @@
random_seed=randomize,
exclude_pattern=exclude,
strict=strict,
- coverage_dir=coverage,
)
finally:
if benchfile is not None:
=== modified file 'bzrlib/commands.py'
--- a/bzrlib/commands.py 2007-12-27 02:28:14 +0000
+++ b/bzrlib/commands.py 2008-01-21 05:44:29 +0000
@@ -590,6 +590,20 @@
return argdict
+def apply_coveraged(dirname, the_callable, *args, **kwargs):
+ # Cannot use "import trace", as that would import bzrlib.trace instead of
+ # the standard library's trace.
+ trace = __import__('trace')
+
+ tracer = trace.Trace(count=1, trace=0)
+ sys.settrace(tracer.globaltrace)
+
+ ret = the_callable(*args, **kwargs)
+
+ sys.settrace(None)
+ results = tracer.results()
+ results.write_results(show_missing=1, summary=False,
+ coverdir=dirname)
def apply_profiled(the_callable, *args, **kwargs):
@@ -682,13 +696,16 @@
--lsprof
Run under the Python lsprof profiler.
+
+ --coverage
+ Generate line coverage report in the specified directory.
"""
argv = list(argv)
trace.mutter("bzr arguments: %r", argv)
opt_lsprof = opt_profile = opt_no_plugins = opt_builtin = \
opt_no_aliases = False
- opt_lsprof_file = None
+ opt_lsprof_file = opt_coverage_dir = None
# --no-plugins is handled specially at a very early stage. We need
# to load plugins before doing other command parsing so that they
@@ -712,6 +729,9 @@
opt_no_aliases = True
elif a == '--builtin':
opt_builtin = True
+ elif a == '--coverage':
+ opt_coverage_dir = argv[i + 1]
+ i += 1
elif a.startswith('-D'):
debug.debug_flags.add(a[2:])
else:
@@ -755,9 +775,17 @@
try:
if opt_lsprof:
+ if opt_coverage_dir:
+ trace.warning(
+ '--coverage ignored, because --lsprof is in use.')
ret = apply_lsprofiled(opt_lsprof_file, run, *run_argv)
elif opt_profile:
+ if opt_coverage_dir:
+ trace.warning(
+ '--coverage ignored, because --profile is in use.')
ret = apply_profiled(run, *run_argv)
+ elif opt_coverage_dir:
+ ret = apply_coveraged(opt_coverage_dir, run, *run_argv)
else:
ret = run(*run_argv)
return ret or 0
=== modified file 'bzrlib/help_topics/__init__.py'
--- a/bzrlib/help_topics/__init__.py 2008-01-11 04:55:53 +0000
+++ b/bzrlib/help_topics/__init__.py 2008-01-21 00:46:32 +0000
@@ -271,6 +271,7 @@
"callgrind.out" or end with ".callgrind", the output will be
formatted for use with KCacheGrind. Otherwise, the output
will be a pickle.
+--coverage Generate line coverage report in the specified directory.
See doc/developers/profiling.txt for more information on profiling.
A number of debug flags are also available to assist troubleshooting and
=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py 2008-01-11 05:08:20 +0000
+++ b/bzrlib/tests/__init__.py 2008-01-21 00:46:32 +0000
@@ -43,7 +43,6 @@
import sys
import tempfile
import time
-import trace
import unittest
import warnings
@@ -2425,9 +2424,7 @@
list_only=False,
random_seed=None,
exclude_pattern=None,
- strict=False,
- coverage_dir=None,
- ):
+ strict=False):
TestCase._gather_lsprof_in_benchmarks = lsprof_timed
if verbose:
verbosity = 2
@@ -2470,19 +2467,8 @@
else:
suite = order_changer(filter_suite_by_re(suite, pattern))
- # Activate code coverage.
- if coverage_dir is not None:
- tracer = trace.Trace(count=1, trace=0)
- sys.settrace(tracer.globaltrace)
-
result = runner.run(suite)
- if coverage_dir is not None:
- sys.settrace(None)
- results = tracer.results()
- results.write_results(show_missing=1, summary=False,
- coverdir=coverage_dir)
-
if strict:
return result.wasStrictlySuccessful()
@@ -2499,7 +2485,6 @@
random_seed=None,
exclude_pattern=None,
strict=False,
- coverage_dir=None,
):
"""Run the whole test suite under the enhanced runner"""
# XXX: Very ugly way to do this...
@@ -2527,8 +2512,7 @@
list_only=list_only,
random_seed=random_seed,
exclude_pattern=exclude_pattern,
- strict=strict,
- coverage_dir=coverage_dir)
+ strict=strict)
finally:
default_transport = old_transport
More information about the bazaar-commits
mailing list