~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transform.py

Added conflicts for setting executability on unversioned/non-file entries

Show diffs side-by-side

added added

removed removed

Lines of Context:
109
109
 
110
110
    def set_executability(self, executability, trans_id):
111
111
        """Schedule setting of the 'execute' bit"""
112
 
        unique_add(self._new_executability, trans_id, executability)
 
112
        if executability is None:
 
113
            del self._new_executability[trans_id]
 
114
        else:
 
115
            unique_add(self._new_executability, trans_id, executability)
113
116
 
114
117
    def version_file(self, file_id, trans_id):
115
118
        """Schedule a file to become versioned."""
192
195
        conflicts.extend(self._duplicate_entries(by_parent))
193
196
        conflicts.extend(self._parent_type_conflicts(by_parent))
194
197
        conflicts.extend(self._improper_versioning())
 
198
        conflicts.extend(self._executability_conflicts())
195
199
        return conflicts
196
200
 
197
201
    def _parent_loops(self):
238
242
                conflicts.append(('versioning bad kind', trans_id, kind))
239
243
        return conflicts
240
244
 
 
245
    def _executability_conflicts(self):
 
246
        conflicts = []
 
247
        for trans_id in self._new_executability:
 
248
            if self.final_file_id(trans_id) is None:
 
249
                conflicts.append(('unversioned executability', trans_id))
 
250
            elif self.final_kind(trans_id) != "file":
 
251
                conflicts.append(('non-file executability', trans_id))
 
252
        return conflicts
 
253
 
241
254
    def _duplicate_entries(self, by_parent):
242
255
        """No directory may have two entries with the same name."""
243
256
        conflicts = []