/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to __init__.py

  • Committer: Jelmer Vernooij
  • Date: 2007-11-03 16:27:35 UTC
  • mfrom: (278.1.45 j-gtk)
  • mto: (330.6.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 368.
  • Revision ID: jelmer@samba.org-20071103162735-a0ox9cw53kax4sa2
Merge John's gcommit changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
visualise         Graphically visualise this branch. 
33
33
"""
34
34
 
 
35
import sys
 
36
 
35
37
import bzrlib
36
38
 
37
39
version_info = (0, 92, 0, 'dev', 0)
336
338
    """GTK+ commit dialog
337
339
 
338
340
    Graphical user interface for committing revisions"""
339
 
    
 
341
 
340
342
    aliases = [ "gci" ]
341
343
    takes_args = []
342
344
    takes_options = []
355
357
            (wt, path) = workingtree.WorkingTree.open_containing(filename)
356
358
            br = wt.branch
357
359
        except NoWorkingTree, e:
358
 
            path = e.base
359
 
            (br, path) = branch.Branch.open_containing(path)
360
 
 
361
 
        commit = CommitDialog(wt, path, not br)
362
 
        commit.run()
363
 
 
 
360
            from dialog import error_dialog
 
361
            error_dialog(_('Directory does not have a working tree'),
 
362
                         _('Operation aborted.'))
 
363
            return 1 # should this be retval=3?
 
364
 
 
365
        # It is a good habit to keep things locked for the duration, but it
 
366
        # could cause difficulties if someone wants to do things in another
 
367
        # window... We could lock_read() until we actually go to commit
 
368
        # changes... Just a thought.
 
369
        wt.lock_write()
 
370
        try:
 
371
            dlg = CommitDialog(wt)
 
372
            return dlg.run()
 
373
        finally:
 
374
            wt.unlock()
364
375
 
365
376
 
366
377
class cmd_gstatus(GTKCommand):
612
623
register_command(cmd_gselftest)
613
624
 
614
625
 
 
626
class cmd_test_gtk(GTKCommand):
 
627
    """Version of selftest that just runs the gtk test suite."""
 
628
 
 
629
    takes_options = ['verbose',
 
630
                     Option('one', short_name='1',
 
631
                            help='stop when one test fails'),
 
632
                     Option('benchmark', help='run the benchmarks.'),
 
633
                     Option('lsprof-timed',
 
634
                     help='generate lsprof output for benchmarked'
 
635
                          ' sections of code.'),
 
636
                     Option('list-only',
 
637
                     help='list the tests instead of running them'),
 
638
                     Option('randomize', type=str, argname="SEED",
 
639
                     help='randomize the order of tests using the given'
 
640
                          ' seed or "now" for the current time'),
 
641
                    ]
 
642
    takes_args = ['testspecs*']
 
643
 
 
644
    def run(self, verbose=None, one=False, benchmark=None,
 
645
            lsprof_timed=None, list_only=False, randomize=None,
 
646
            testspecs_list=None):
 
647
        from bzrlib import __path__ as bzrlib_path
 
648
        from bzrlib.tests import selftest
 
649
 
 
650
        print '%10s: %s' % ('bzrlib', bzrlib_path[0])
 
651
        if benchmark:
 
652
            print 'No benchmarks yet'
 
653
            return 3
 
654
 
 
655
            test_suite_factory = bench_suite
 
656
            if verbose is None:
 
657
                verbose = True
 
658
            # TODO: should possibly lock the history file...
 
659
            benchfile = open(".perf_history", "at", buffering=1)
 
660
        else:
 
661
            test_suite_factory = test_suite
 
662
            if verbose is None:
 
663
                verbose = False
 
664
            benchfile = None
 
665
 
 
666
        if testspecs_list is not None:
 
667
            pattern = '|'.join(testspecs_list)
 
668
        else:
 
669
            pattern = ".*"
 
670
 
 
671
        try:
 
672
            result = selftest(verbose=verbose,
 
673
                              pattern=pattern,
 
674
                              stop_on_failure=one,
 
675
                              test_suite_factory=test_suite_factory,
 
676
                              lsprof_timed=lsprof_timed,
 
677
                              bench_history=benchfile,
 
678
                              list_only=list_only,
 
679
                              random_seed=randomize,
 
680
                             )
 
681
        finally:
 
682
            if benchfile is not None:
 
683
                benchfile.close()
 
684
 
 
685
register_command(cmd_test_gtk)
 
686
 
 
687
 
615
688
import gettext
616
689
gettext.install('olive-gtk')
617
690