/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_helper.py

  • Committer: Szilveszter Farkas (Phanatic)
  • Date: 2006-08-10 11:49:24 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-20060810114924-d1e0acc313c07d2b
Implemented Informations functionality; some bzrlib API changes handled.

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

    * olive/backend/info_helper.py: made it 0.9 API compatible
    * olive/backend/info.py: small bug fixed
    * olive/frontend/gtk/info.py: implemented Information window
    * olive.glade: added Informations window
    * Olive is two months old!

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
18
18
 
19
19
import time
20
20
 
21
 
import bzrlib.diff as diff
 
21
import bzrlib
 
22
 
22
23
import bzrlib.osutils as osutils
23
24
 
24
25
from bzrlib.info import _repo_relpath
145
146
    if master:
146
147
        local_extra, remote_extra = find_unmerged(branch, master)
147
148
        if remote_extra:
148
 
            ret['missing'] = len(remote_extra)
 
149
            ret = len(remote_extra)
149
150
    
150
151
    return ret
151
152
 
155
156
    
156
157
    :return: a dictionary containing the needed infos
157
158
    """
 
159
    if (bzrlib.version_info[0] == 0) and (bzrlib.version_info[1] < 9):
 
160
        # function deprecated after 0.9
 
161
        from bzrlib.delta import compare_trees
 
162
 
158
163
    ret = {}
159
164
    branch = working.branch
160
165
    basis = working.basis_tree()
161
166
    work_inv = working.inventory
162
 
    delta = diff.compare_trees(basis, working, want_unchanged=True)
 
167
    
 
168
    if (bzrlib.version_info[0] == 0) and (bzrlib.version_info[1] < 9):
 
169
        delta = compare_trees(basis, working, want_unchanged=True)
 
170
    else:
 
171
        delta = working.changes_from(basis, want_unchanged=True)
 
172
 
163
173
    history = branch.revision_history()
164
174
    tree_last_id = working.last_revision()
165
175
 
166
176
    if len(history) and tree_last_id != history[-1]:
167
177
        tree_last_revno = branch.revision_id_to_revno(tree_last_id)
168
178
        missing_count = len(history) - tree_last_revno
169
 
        ret['missing'] = missing_count
 
179
        ret = missing_count
170
180
    
171
181
    return ret
172
182
 
176
186
    
177
187
    :return: a dictionary containing the needed infos
178
188
    """
 
189
    if (bzrlib.version_info[0] == 0) and (bzrlib.version_info[1] < 9):
 
190
        # function deprecated after 0.9
 
191
        from bzrlib.delta import compare_trees
 
192
    
179
193
    ret = {}
180
194
    basis = working.basis_tree()
181
195
    work_inv = working.inventory
182
 
    delta = diff.compare_trees(basis, working, want_unchanged=True)
 
196
    
 
197
    if (bzrlib.version_info[0] == 0) and (bzrlib.version_info[1] < 9):
 
198
        delta = compare_trees(basis, working, want_unchanged=True)
 
199
    else:
 
200
        delta = working.changes_from(basis, want_unchanged=True)
183
201
 
184
202
    ret['unchanged'] = len(delta.unchanged)
185
203
    ret['modified'] = len(delta.modified)