/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: 2018-05-06 11:48:54 UTC
  • mto: This revision was merged to the branch mainline in revision 6960.
  • Revision ID: jelmer@jelmer.uk-20180506114854-h4qd9ojaqy8wxjsd
Move .mailmap to root.

Show diffs side-by-side

added added

removed removed

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