~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commands.py

  • Committer: Andrew Bennetts
  • Date: 2008-01-24 03:21:43 UTC
  • mto: This revision was merged to the branch mainline in revision 3200.
  • Revision ID: andrew.bennetts@canonical.com-20080124032143-srxbec60xf9dt3xy
Just use urllib.unquote, as suggested by John's review.

Show diffs side-by-side

added added

removed removed

Lines of Context:
590
590
 
591
591
    return argdict
592
592
 
593
 
def apply_coveraged(dirname, the_callable, *args, **kwargs):
594
 
    # Cannot use "import trace", as that would import bzrlib.trace instead of
595
 
    # the standard library's trace.
596
 
    trace = __import__('trace')
597
 
 
598
 
    tracer = trace.Trace(count=1, trace=0)
599
 
    sys.settrace(tracer.globaltrace)
600
 
 
601
 
    ret = the_callable(*args, **kwargs)
602
 
 
603
 
    sys.settrace(None)
604
 
    results = tracer.results()
605
 
    results.write_results(show_missing=1, summary=False,
606
 
                          coverdir=dirname)
607
593
 
608
594
 
609
595
def apply_profiled(the_callable, *args, **kwargs):
696
682
 
697
683
    --lsprof
698
684
        Run under the Python lsprof profiler.
699
 
 
700
 
    --coverage
701
 
        Generate line coverage report in the specified directory.
702
685
    """
703
686
    argv = list(argv)
704
687
    trace.mutter("bzr arguments: %r", argv)
705
688
 
706
689
    opt_lsprof = opt_profile = opt_no_plugins = opt_builtin =  \
707
690
                opt_no_aliases = False
708
 
    opt_lsprof_file = opt_coverage_dir = None
 
691
    opt_lsprof_file = None
709
692
 
710
693
    # --no-plugins is handled specially at a very early stage. We need
711
694
    # to load plugins before doing other command parsing so that they
729
712
            opt_no_aliases = True
730
713
        elif a == '--builtin':
731
714
            opt_builtin = True
732
 
        elif a == '--coverage':
733
 
            opt_coverage_dir = argv[i + 1]
734
 
            i += 1
735
715
        elif a.startswith('-D'):
736
716
            debug.debug_flags.add(a[2:])
737
717
        else:
775
755
 
776
756
    try:
777
757
        if opt_lsprof:
778
 
            if opt_coverage_dir:
779
 
                trace.warning(
780
 
                    '--coverage ignored, because --lsprof is in use.')
781
758
            ret = apply_lsprofiled(opt_lsprof_file, run, *run_argv)
782
759
        elif opt_profile:
783
 
            if opt_coverage_dir:
784
 
                trace.warning(
785
 
                    '--coverage ignored, because --profile is in use.')
786
760
            ret = apply_profiled(run, *run_argv)
787
 
        elif opt_coverage_dir:
788
 
            ret = apply_coveraged(opt_coverage_dir, run, *run_argv)
789
761
        else:
790
762
            ret = run(*run_argv)
791
763
        return ret or 0