/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

Merge Johns' gcommit improvements and fix conflicts against trunk.

Show diffs side-by-side

added added

removed removed

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