bzr branch
http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz
53
by Jelmer Vernooij
Add framework for commit dialog |
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
by Jelmer Vernooij
Add GTK+ dialog for commit. Available as 'bzr gcommit' |
54 |
dialog = GCommitDialog(wt) |
53
by Jelmer Vernooij
Add framework for commit dialog |
55 |
dialog.set_title(path + " - Commit") |
54
by Jelmer Vernooij
Add GTK+ dialog for commit. Available as 'bzr gcommit' |
56 |
if dialog.run() != gtk.RESPONSE_CANCEL: |
57 |
Commit().commit(working_tree=wt,message=dialog.message, |
|
53
by Jelmer Vernooij
Add framework for commit dialog |
58 |
specific_files=dialog.specific_files) |
59 |
||
60 |
register_command(cmd_gcommit) |