/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: 2006-09-30 10:21:43 UTC
  • Revision ID: jelmer@samba.org-20060930102143-c0ef64d6ca860c21
Merge some files from Olive and bzr-gtk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
from bzrlib.workingtree import WorkingTree
23
23
from bzrlib.bzrdir import BzrDir
24
24
 
25
 
__version__ = '0.13.0'
 
25
__version__ = '0.11.0'
26
26
 
27
27
class cmd_gbranch(Command):
28
28
    """GTK+ branching.
38
38
            if str(e) == "could not open display":
39
39
                raise NoDisplayError
40
40
 
41
 
        from bzrlib.plugins.gtk.olive.branch import BranchDialog
 
41
        from clone import CloneDialog
42
42
 
43
 
        window = BranchDialog('.')
44
 
        window.display()
 
43
        window = CloneDialog()
 
44
        if window.run() == gtk.RESPONSE_OK:
 
45
            bzrdir = BzrDir.open(window.url)
 
46
            bzrdir.sprout(window.dest_path)
45
47
 
46
48
register_command(cmd_gbranch)
47
49
 
71
73
            tree1 = wt
72
74
            tree2 = tree1.basis_tree()
73
75
 
74
 
        from viz.diffwin import DiffWindow
 
76
        from bzrlib.plugins.gtk.viz.diffwin import DiffWindow
75
77
        import gtk
76
78
        window = DiffWindow()
77
79
        window.connect("destroy", lambda w: gtk.main_quit())
78
80
        window.set_diff("Working Tree", tree1, tree2)
79
81
        if filename is not None:
80
 
            tree_filename = wt.relpath(filename)
 
82
            tree_filename = tree1.relpath(filename)
81
83
            try:
82
84
                window.set_file(tree_filename)
83
85
            except NoSuchFile:
143
145
        Option("all", help="show annotations on all lines"),
144
146
        Option("plain", help="don't highlight annotation lines"),
145
147
        Option("line", type=int, argname="lineno",
146
 
               help="jump to specified line number"),
147
 
        "revision",
 
148
               help="jump to specified line number")
148
149
    ]
149
150
    aliases = ["gblame", "gpraise"]
150
151
    
151
 
    def run(self, filename, all=False, plain=False, line='1', revision=None):
 
152
    def run(self, filename, all=False, plain=False, line='1'):
152
153
        import pygtk
153
154
        pygtk.require("2.0")
154
155
 
174
175
 
175
176
        if file_id is None:
176
177
            raise NotVersionedError(filename)
177
 
        if revision is not None:
178
 
            if len(revision) != 1:
179
 
                raise BzrCommandError("Only 1 revion may be specified.")
180
 
            revision_id = revision[0].in_history(branch).rev_id
181
 
        else:
182
 
            revision_id = None
183
178
 
184
179
        window = GAnnotateWindow(all, plain)
185
180
        window.connect("destroy", lambda w: gtk.main_quit())
188
183
        window.show()
189
184
        branch.lock_read()
190
185
        try:
191
 
            window.annotate(branch, file_id, revision_id)
 
186
            window.annotate(branch, file_id)
192
187
        finally:
193
188
            branch.unlock()
194
189
        window.jump_to_line(line)
206
201
    takes_options = []
207
202
 
208
203
    def run(self, filename=None):
209
 
        import os
210
204
        import pygtk
211
205
        pygtk.require("2.0")
212
206
 
216
210
            if str(e) == "could not open display":
217
211
                raise NoDisplayError
218
212
 
219
 
        from olive.commit import CommitDialog
 
213
        from commit import GCommitDialog
220
214
        from bzrlib.commit import Commit
221
 
        from bzrlib.errors import (BzrCommandError,
222
 
                                   NotBranchError,
223
 
                                   NoWorkingTree,
224
 
                                   PointlessCommit,
225
 
                                   ConflictsInTree,
226
 
                                   StrictCommitFailed)
227
 
 
228
 
        wt = None
229
 
        branch = None
230
 
        try:
231
 
            (wt, path) = WorkingTree.open_containing(filename)
232
 
            branch = wt.branch
233
 
        except NotBranchError, e:
234
 
            path = e.path
235
 
        except NoWorkingTree, e:
236
 
            path = e.base
237
 
            try:
238
 
                (branch, path) = Branch.open_containing(path)
239
 
            except NotBranchError, e:
240
 
                path = e.path
241
 
 
242
 
        dialog = CommitDialog(wt, path, not branch)
243
 
        if dialog.display():
244
 
            dialog.window.connect("destroy", lambda w: gtk.main_quit())
245
 
            gtk.main()
 
215
        from bzrlib.errors import (BzrCommandError, PointlessCommit, ConflictsInTree, 
 
216
           StrictCommitFailed)
 
217
 
 
218
        (wt, path) = WorkingTree.open_containing(filename)
 
219
        branch = wt.branch
 
220
 
 
221
        file_id = wt.path2id(path)
 
222
 
 
223
        if file_id is None:
 
224
            raise NotVersionedError(filename)
 
225
 
 
226
        dialog = GCommitDialog(wt)
 
227
        dialog.set_title(path + " - Commit")
 
228
        if dialog.run() != gtk.RESPONSE_CANCEL:
 
229
            Commit().commit(working_tree=wt,message=dialog.message,
 
230
                specific_files=dialog.specific_files)
246
231
 
247
232
register_command(cmd_gcommit)
248
233