/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/add.py

  • Committer: Jelmer Vernooij
  • Date: 2019-03-04 00:16:27 UTC
  • mfrom: (7293 work)
  • mto: This revision was merged to the branch mainline in revision 7318.
  • Revision ID: jelmer@jelmer.uk-20190304001627-v6u7o6pf97tukhek
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
    )
29
29
from .i18n import gettext
30
30
 
 
31
 
31
32
class AddAction(object):
32
33
    """A class which defines what action to take when adding a file."""
33
34
 
58
59
            self._to_file.write('adding %s\n' % _quote(path))
59
60
        return None
60
61
 
61
 
    def skip_file(self, tree, path, kind, stat_value = None):
 
62
    def skip_file(self, tree, path, kind, stat_value=None):
62
63
        """Test whether the given file should be skipped or not.
63
 
        
 
64
 
64
65
        The default action never skips. Note this is only called during
65
66
        recursive adds
66
 
        
 
67
 
67
68
        :param tree: The tree we are working in
68
69
        :param path: The path being added
69
70
        :param kind: The kind of object being added.
78
79
 
79
80
    _maxSize = None
80
81
 
81
 
    def skip_file(self, tree, path, kind, stat_value = None):
 
82
    def skip_file(self, tree, path, kind, stat_value=None):
82
83
        if kind != 'file':
83
84
            return False
84
85
        opt_name = 'add.maximum_file_size'
86
87
            config = tree.get_config_stack()
87
88
            self._maxSize = config.get(opt_name)
88
89
        if stat_value is None:
89
 
            file_size = os.path.getsize(path);
 
90
            file_size = os.path.getsize(path)
90
91
        else:
91
 
            file_size = stat_value.st_size;
 
92
            file_size = stat_value.st_size
92
93
        if self._maxSize > 0 and file_size > self._maxSize:
93
94
            ui.ui_factory.show_warning(gettext(
94
95
                "skipping {0} (larger than {1} of {2} bytes)").format(
95
 
                path, opt_name,  self._maxSize))
 
96
                path, opt_name, self._maxSize))
96
97
            return True
97
98
        return False
98
99
 
118
119
            # we aren't doing anything special, so let the default
119
120
            # reporter happen
120
121
            file_id = super(AddFromBaseAction, self).__call__(
121
 
                        inv, parent_ie, path, kind)
 
122
                inv, parent_ie, path, kind)
122
123
        return file_id
123
124
 
124
125
    def _get_base_file_id(self, path, parent_ie):