/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 olive/backend/info.py

  • Committer: Szilveszter Farkas (Phanatic)
  • Date: 2006-08-02 20:35:25 UTC
  • mto: (0.14.1 main) (93.1.1 win32.bialix)
  • mto: This revision was merged to the branch mainline in revision 83.
  • Revision ID: Szilveszter.Farkas@gmail.com-20060802203525-9cb57147463c2672
Implemented context menu for the file list.

2006-08-02  Szilveszter Farkas <Szilveszter.Farkas@gmail.com>

    * cmenu.ui: context menu UIManager description added
    * setup.py: install cmenu.ui to the appropriate place
    * olive/frontend/gtk/menu.py: implement the context menus
    * olive/frontend/gtk/__init__.py: added button_press_event for file list
    * olive/frontend/gtk/handler.py: handling that even (show popup menu)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# Copyright (C) 2006 by Szilveszter Farkas (Phanatic) <szilveszter.farkas@gmail.com>
2
2
# Some parts of the code are:
3
3
# Copyright (C) 2005, 2006 by Canonical Ltd
4
 
#
 
4
 
5
5
# This program is free software; you can redistribute it and/or modify
6
6
# it under the terms of the GNU General Public License as published by
7
7
# the Free Software Foundation; either version 2 of the License, or
8
8
# (at your option) any later version.
9
 
#
 
9
 
10
10
# This program is distributed in the hope that it will be useful,
11
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
13
# GNU General Public License for more details.
14
 
#
 
14
 
15
15
# You should have received a copy of the GNU General Public License
16
16
# along with this program; if not, write to the Free Software
17
17
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22
22
from bzrlib.branch import Branch
23
23
from bzrlib.workingtree import WorkingTree
24
24
 
25
 
from errors import (DifferentBranchesError, NotBranchError, PermissionDenied,
26
 
                    PrefixFormatError, RevisionValueError)
 
25
from errors import (DifferentBranchesError, NotBranchError, PrefixFormatError,
 
26
                    RevisionValueError)
27
27
 
28
28
def diff(revision=None, file_list=None, diff_options=None, prefix=None):
29
29
    """ Save the diff into a temporary file.
118
118
    else:
119
119
        return tmpfile[1]
120
120
 
121
 
def get_push_location(location):
122
 
    """ Get the stored push location of a branch.
123
 
    
124
 
    :param location: the path to the branch
125
 
    
126
 
    :return: the stored location
127
 
    """
128
 
    from bzrlib.branch import Branch
129
 
    
130
 
    try:
131
 
        branch = Branch.open_containing(location)[0]
132
 
    except errors.NotBranchError:
133
 
        raise NotBranchError(location)
134
 
    except:
135
 
        raise
136
 
    
137
 
    return branch.get_push_location()
138
 
 
139
121
def info(location):
140
122
    """ Get info about branch, working tree, and repository
141
123
    
160
142
    ret['locking']['workingtree']: Working tree lock status
161
143
    ret['locking']['branch']: Branch lock status
162
144
    ret['locking']['repository']: Repository lock status
163
 
    ret['missing']['branch']: Missing revisions in branch
164
 
    ret['missing']['workingtree']: Missing revisions in working tree
 
145
    ret['mrevbranch']['missing']: Missing revisions in branch
 
146
    ret['mrevworking']['missing']: Missing revisions in working tree
165
147
    ret['wtstats']['unchanged']: Unchanged files
166
148
    ret['wtstats']['modified']: Modified files
167
149
    ret['wtstats']['added']: Added files
183
165
    import info_helper
184
166
    
185
167
    ret = {}
186
 
    try:
187
 
        a_bzrdir = bzrdir.BzrDir.open_containing(location)[0]
188
 
    except errors.NotBranchError:
189
 
        raise NotBranchError(location)
190
 
 
 
168
    a_bzrdir = bzrdir.BzrDir.open_containing(location)[0]
191
169
    try:
192
170
        working = a_bzrdir.open_workingtree()
193
171
        working.lock_read()
195
173
            branch = working.branch
196
174
            repository = branch.repository
197
175
            control = working.bzrdir
198
 
            
 
176
 
199
177
            ret['location'] = info_helper.get_location_info(repository, branch, working)
200
178
            ret['related'] = info_helper.get_related_info(branch)
201
179
            ret['format'] = info_helper.get_format_info(control, repository, branch, working)
202
180
            ret['locking'] = info_helper.get_locking_info(repository, branch, working)
203
 
            ret['missing'] = {}
204
 
            ret['missing']['branch'] = info_helper.get_missing_revisions_branch(branch)
205
 
            ret['missing']['workingtree'] = info_helper.get_missing_revisions_working(working)
 
181
            ret['mrevbranch'] = info_helper.get_missing_revisions_branch(branch)
 
182
            ret['mrevworking'] = info_helper.get_missing_revisions_working(working)
206
183
            ret['wtstats'] = info_helper.get_working_stats(working)
207
184
            ret['brstats'] = info_helper.get_branch_stats(branch)
208
185
            ret['repstats'] = info_helper.get_repository_stats(repository)
221
198
            ret['related'] = info_helper.get_related_info(branch)
222
199
            ret['format'] = info_helper.get_format_info(control, repository, branch)
223
200
            ret['locking'] = info_helper.get_locking_info(repository, branch)
224
 
            ret['missing']['branch'] = info_helper.get_missing_revisions_branch(branch)
 
201
            ret['mrevbranch'] = info_helper.get_missing_revisions_branch(branch)
225
202
            ret['brstats'] = info_helper.get_branch_stats(branch)
226
203
            ret['repstats'] = info_helper.get_repository_stats(repository)
227
204
        finally:
246
223
    except errors.NoRepositoryPresent:
247
224
        pass
248
225
 
249
 
def is_branch(location):
250
 
    """ Check if the location is a branch.
251
 
    
252
 
    :param location: the location you want to check
253
 
    
254
 
    :return: True or False respectively
255
 
    """
256
 
    try:
257
 
        branch = Branch.open_containing(location)[0]
258
 
    except errors.NotBranchError:
259
 
        return False
260
 
    except errors.PermissionDenied:
261
 
        raise PermissionDenied(location)
262
 
    else:
263
 
        return True
264
 
        
265
 
 
266
226
def is_checkout(location):
267
227
    """ Check if the location is a checkout.
268
228
    
292
252
    else:
293
253
        return False
294
254
 
 
255
 
295
256
def log(location, timezone='original', verbose=False, show_ids=False,
296
257
        forward=False, revision=None, log_format=None, message=None,
297
258
        long=False, short=False, line=False):