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

  • Committer: Szilveszter Farkas (Phanatic)
  • Date: 2006-08-20 13:02:35 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-20060820130235-62c9c5753f5d8774
Gettext support added.

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

    * po/hu.po: added Hungarian traslation
    * Added gettext support to all files.
    * genpot.sh: added olive-gtk.pot generator script

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
 
23
23
from errors import (DirectoryAlreadyExists, MissingArgumentError,
24
24
                    MultipleMoveError, NoFilesSpecified, NoMatchingFiles,
25
 
                    NonExistingSource, NotBranchError, NotVersionedError)
 
25
                    NonExistingSource, NotBranchError, NotSameBranchError,
 
26
                    NotVersionedError)
26
27
 
27
28
def add(file_list, recursive=False):
28
29
    """ Add listed files to the branch. 
61
62
        if e.errno == 17:
62
63
            raise DirectoryAlreadyExists(directory)
63
64
    else:
64
 
        wt, dd = WorkingTree.open_containing(directory)
65
 
        wt.add([dd])
 
65
        try:
 
66
            wt, dd = WorkingTree.open_containing(directory)
 
67
        except errors.NotBranchError:
 
68
            raise NotBranchError
 
69
        else:
 
70
            wt.add([dd])
66
71
 
67
72
def move(names_list):
68
73
    """ Move or rename given files.
73
78
    
74
79
    if len(names_list) < 2:
75
80
        raise MissingArgumentError
76
 
    tree, rel_names = tree_files(names_list)
 
81
    
 
82
    try:
 
83
        tree, rel_names = tree_files(names_list)
 
84
    except errors.NotBranchError:
 
85
        raise NotBranchError
 
86
    except errors.BzrCommandError:
 
87
        # not the same branch presumably
 
88
        raise NotSameBranchError
77
89
        
78
90
    if os.path.isdir(names_list[-1]):
79
91
        # move into existing directory
91
103
    
92
104
    :param new: if True, the 'added' files will be removed
93
105
    """
 
106
    import bzrlib
94
107
    from bzrlib.builtins import tree_files
95
108
    
96
109
    try:
105
118
            raise NoFilesSpecified
106
119
    else:
107
120
        from bzrlib.delta import compare_trees
108
 
        added = [compare_trees(tree.basis_tree(), tree,
109
 
                               specific_files=file_list).added]
 
121
        if (bzrlib.version_info[0] == 0) and (bzrlib.version_info[1] < 9):
 
122
            added = [compare_trees(tree.basis_tree(), tree,
 
123
                                   specific_files=file_list).added]
 
124
        else:
 
125
            added = [tree.changes_from(tree.basis_tree(),
 
126
                                       specific_files=file_list).added]
110
127
        file_list = sorted([f[0] for f in added[0]], reverse=True)
111
128
        if len(file_list) == 0:
112
129
            raise NoMatchingFiles
135
152
    
136
153
    :return: renamed | added | removed | modified | unchanged | unknown
137
154
    """
 
155
    import bzrlib
138
156
    from bzrlib.delta import compare_trees
139
157
    from bzrlib.workingtree import WorkingTree
140
158
    
163
181
    rel = '/'.join(fpcopy)
164
182
    #print "DEBUG: rel =", rel
165
183
    
166
 
    delta = compare_trees(old_tree=tree2,
167
 
                          new_tree=tree1,
168
 
                          want_unchanged=True,
169
 
                          specific_files=[rel])
 
184
    if bzrlib.version_info[1] < 9:
 
185
        delta = compare_trees(old_tree=tree2,
 
186
                              new_tree=tree1,
 
187
                              want_unchanged=True,
 
188
                              specific_files=[rel])
 
189
    else:
 
190
        delta = tree1.changes_from(tree2,
 
191
                                   want_unchanged=True,
 
192
                                   specific_files=[rel])
170
193
    
171
194
    """ Debug information (could be usable in the future, so didn't cut out)
172
195
    print "DEBUG: delta.renamed:"