/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 commit/__init__.py

  • Committer: Jelmer Vernooij
  • Date: 2006-05-20 19:24:12 UTC
  • mto: This revision was merged to the branch mainline in revision 58.
  • Revision ID: jelmer@samba.org-20060520192412-d71ad24912cb3fad
Move commands to top-level __init__

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006 Jelmer Vernooij <jelmer@samba.org>
2
 
 
3
 
# This program is free software; you can redistribute it and/or modify
4
 
# it under the terms of the GNU General Public License as published by
5
 
# the Free Software Foundation; either version 2 of the License, or
6
 
# (at your option) any later version.
7
 
 
8
 
# This program is distributed in the hope that it will be useful,
9
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
 
# GNU General Public License for more details.
12
 
 
13
 
# You should have received a copy of the GNU General Public License
14
 
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
 
 
17
 
__version__ = "0.8"
18
 
__author__ = "Jelmer Vernooij <jelmer@samba.org>"
19
 
 
20
 
from bzrlib.workingtree import WorkingTree
21
 
from bzrlib.commands import Command, register_command
22
 
from bzrlib.commit import Commit
23
 
from bzrlib.errors import (BzrCommandError, PointlessCommit, ConflictsInTree, 
24
 
           StrictCommitFailed)
25
 
 
26
 
class cmd_gcommit(Command):
27
 
    """GTK+ commit dialog
28
 
 
29
 
    Graphical user interface for committing revisions"""
30
 
    
31
 
    takes_args = []
32
 
    takes_options = []
33
 
 
34
 
    def run(self, filename=None):
35
 
        import pygtk
36
 
        pygtk.require("2.0")
37
 
 
38
 
        try:
39
 
            import gtk
40
 
        except RuntimeError, e:
41
 
            if str(e) == "could not open display":
42
 
                raise NoDisplayError
43
 
 
44
 
        from gcommit import GCommitDialog
45
 
 
46
 
        (wt, path) = WorkingTree.open_containing(filename)
47
 
        branch = wt.branch
48
 
 
49
 
        file_id = wt.path2id(path)
50
 
 
51
 
        if file_id is None:
52
 
            raise NotVersionedError(filename)
53
 
 
54
 
        dialog = GCommitDialog(wt)
55
 
        dialog.set_title(path + " - Commit")
56
 
        if dialog.run() != gtk.RESPONSE_CANCEL:
57
 
            Commit().commit(working_tree=wt,message=dialog.message,
58
 
                specific_files=dialog.specific_files)
59
 
 
60
 
register_command(cmd_gcommit)