/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: Vincent Ladeuil
  • Date: 2009-05-06 11:51:38 UTC
  • mfrom: (628.1.2 gtk)
  • Revision ID: v.ladeuil+lp@free.fr-20090506115138-7abxvg2qz4gzraup
UpgradeĀ COMPATIBLE_BZR_VERSIONS

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
visualise         Graphically visualise this branch. 
35
35
"""
36
36
 
37
 
import os
38
 
import sys
39
 
 
40
 
if getattr(sys, "frozen", None) is not None: # we run bzr.exe
41
 
 
42
 
    # FIXME: Unless a better packaging solution is found, the following
43
 
    # provides a workaround for https://bugs.launchpad.net/bzr/+bug/388790 Also
44
 
    # see https://code.edge.launchpad.net/~vila/bzr-gtk/388790-windows-setup
45
 
    # for more details about while it's needed.
46
 
 
47
 
    # NOTE: _lib must be ahead of bzrlib or sax.saxutils (in olive) fails
48
 
    here = os.path.dirname(__file__)
49
 
    sys.path.insert(0, os.path.join(here, '_lib'))
50
 
    sys.path.append(os.path.join(here, '_lib/gtk-2.0'))
51
 
 
52
 
 
53
37
import bzrlib
54
38
import bzrlib.api
55
 
from bzrlib import (
56
 
    branch,
57
 
    config,
58
 
    errors,
59
 
    )
 
39
from bzrlib import errors
60
40
from bzrlib.commands import plugin_cmds
61
41
 
 
42
import os.path
62
43
 
63
 
version_info = (0, 99, 0, 'dev', 1)
 
44
version_info = (0, 96, 0, 'dev', 1)
64
45
 
65
46
if version_info[3] == 'final':
66
47
    version_string = '%d.%d.%d' % version_info[:3]
70
51
 
71
52
COMPATIBLE_BZR_VERSIONS = [(1, 6, 0), (1, 7, 0), (1, 8, 0), (1, 9, 0),
72
53
                           (1, 10, 0), (1, 11, 0), (1, 12, 0), (1, 13, 0),
73
 
                           (1, 15, 0),
74
 
                           (1, 17, 0),
75
 
                           (2, 1, 0),
76
 
                           (2, 2, 0),
77
 
                           ]
 
54
                           (1, 15, 0),]
78
55
 
79
56
bzrlib.api.require_any_api(bzrlib, COMPATIBLE_BZR_VERSIONS)
80
57
 
125
102
            raise NoDisplayError
126
103
    set_ui_factory()
127
104
    return gtk
128
 
 
 
105
 
129
106
 
130
107
commands = {
131
108
    "gannotate": ["gblame", "gpraise"],
132
109
    "gbranch": [],
133
 
    "gcheckout": [],
134
 
    "gcommit": ["gci"],
135
 
    "gconflicts": [],
 
110
    "gcheckout": [], 
 
111
    "gcommit": ["gci"], 
 
112
    "gconflicts": [], 
136
113
    "gdiff": [],
137
114
    "ginit": [],
138
115
    "ginfo": [],
139
116
    "gmerge": [],
140
 
    "gmissing": [],
141
 
    "gpreferences": [],
142
 
    "gpush": [],
 
117
    "gmissing": [], 
 
118
    "gpreferences": [], 
 
119
    "gpush": [], 
143
120
    "gselftest": [],
144
121
    "gsend": [],
145
122
    "gstatus": ["gst"],
146
123
    "gtags": [],
147
 
    "visualise": ["visualize", "vis", "viz", 'glog'],
 
124
    "visualise": ["visualize", "vis", "viz"],
148
125
    }
149
126
 
150
127
try:
155
132
    commands["gloom"] = []
156
133
 
157
134
for cmd, aliases in commands.iteritems():
158
 
    plugin_cmds.register_lazy("cmd_%s" % cmd, aliases,
159
 
                              "bzrlib.plugins.gtk.commands")
160
 
 
161
 
def save_commit_messages(*args):
162
 
    from bzrlib.plugins.gtk import commit
163
 
    commit.save_commit_messages(*args)
164
 
 
165
 
branch.Branch.hooks.install_named_hook('post_uncommit',
166
 
                                       save_commit_messages,
167
 
                                       "Saving commit messages for gcommit")
 
135
    plugin_cmds.register_lazy("cmd_%s" % cmd, aliases, "bzrlib.plugins.gtk.commands")
 
136
 
168
137
 
169
138
import gettext
170
139
gettext.install('olive-gtk')
180
149
        return "No DISPLAY. Unable to run GTK+ application."
181
150
 
182
151
 
183
 
credential_store_registry = getattr(config, "credential_store_registry", None)
184
 
if credential_store_registry is not None:
185
 
    try:
186
 
        credential_store_registry.register_lazy(
187
 
            "gnome-keyring", "bzrlib.plugins.gtk.keyring", "GnomeKeyringCredentialStore",
188
 
            help="The GNOME Keyring.", fallback=True)
189
 
    except TypeError:
190
 
    # Fallback credentials stores were introduced in Bazaar 1.15
191
 
        credential_store_registry.register_lazy(
192
 
            "gnome-keyring", "bzrlib.plugins.gtk.keyring", "GnomeKeyringCredentialStore",
193
 
            help="The GNOME Keyring.")
194
 
 
195
 
 
196
 
def load_tests(basic_tests, module, loader):
197
 
    testmod_names = [
198
 
        'tests',
199
 
        ]
 
152
def test_suite():
 
153
    from unittest import TestSuite
 
154
    import tests
200
155
    import sys
201
156
    default_encoding = sys.getdefaultencoding()
202
157
    try:
203
 
        result = basic_tests
 
158
        result = TestSuite()
204
159
        try:
205
160
            import_pygtk()
206
161
        except errors.BzrCommandError:
207
 
            return basic_tests
208
 
        basic_tests.addTest(loader.loadTestsFromModuleNames(
209
 
                ["%s.%s" % (__name__, tmn) for tmn in testmod_names]))
 
162
            return result
 
163
        result.addTest(tests.test_suite())
210
164
    finally:
211
165
        if sys.getdefaultencoding() != default_encoding:
212
166
            reload(sys)
213
167
            sys.setdefaultencoding(default_encoding)
214
 
    return basic_tests
 
168
    return result