313
312
if parent_id == trans_id:
314
conflicts.append(('parent loop', trans_id))
313
yield ('parent loop', trans_id)
315
314
if parent_id in seen:
319
317
def _improper_versioning(self):
320
318
"""Cannot version a file with no contents, or a bad type.
322
320
However, existing entries with no contents are okay.
325
322
for trans_id in self._versioned:
326
323
kind = self.final_kind(trans_id)
327
324
if kind == 'symlink' and not self._tree.supports_symlinks():
328
325
# Ignore symlinks as they are not supported on this platform
331
conflicts.append(('versioning no contents', trans_id))
328
yield ('versioning no contents', trans_id)
333
330
if not self._tree.versionable_kind(kind):
334
conflicts.append(('versioning bad kind', trans_id, kind))
331
yield ('versioning bad kind', trans_id, kind)
337
333
def _executability_conflicts(self):
338
334
"""Check for bad executability changes.
342
338
2. only files can be executable. (The execute bit on a directory
343
339
does not indicate searchability)
346
341
for trans_id in self._new_executability:
347
342
if not self.final_is_versioned(trans_id):
348
conflicts.append(('unversioned executability', trans_id))
343
yield ('unversioned executability', trans_id)
350
345
if self.final_kind(trans_id) != "file":
351
conflicts.append(('non-file executability', trans_id))
346
yield ('non-file executability', trans_id)
354
348
def _overwrite_conflicts(self):
355
349
"""Check for overwrites (not permitted on Win32)"""
357
350
for trans_id in self._new_contents:
358
351
if self.tree_kind(trans_id) is None:
360
353
if trans_id not in self._removed_contents:
361
conflicts.append(('overwrite', trans_id,
362
self.final_name(trans_id)))
354
yield ('overwrite', trans_id, self.final_name(trans_id))
365
356
def _duplicate_entries(self, by_parent):
366
357
"""No directory may have two entries with the same name."""
368
358
if (self._new_name, self._new_parent) == ({}, {}):
370
359
for children in by_parent.values():
372
361
for child_tid in children:
384
373
if kind is None and not self.final_is_versioned(trans_id):
386
375
if name == last_name:
387
conflicts.append(('duplicate', last_trans_id, trans_id,
376
yield ('duplicate', last_trans_id, trans_id, name)
390
378
last_trans_id = trans_id
393
380
def _parent_type_conflicts(self, by_parent):
394
381
"""Children must have a directory parent"""
396
382
for parent_id, children in by_parent.items():
397
383
if parent_id == ROOT_PARENT:
408
394
kind = self.final_kind(parent_id)
410
396
# The directory will be deleted
411
conflicts.append(('missing parent', parent_id))
397
yield ('missing parent', parent_id)
412
398
elif kind != "directory":
413
399
# Meh, we need a *directory* to put something in it
414
conflicts.append(('non-directory parent', parent_id))
400
yield ('non-directory parent', parent_id)
417
402
def _set_executability(self, path, trans_id):
418
403
"""Set the executability of versioned files """
745
730
"""Cancel the creation of new file contents."""
746
731
raise NotImplementedError(self.cancel_creation)
748
def apply(self, no_conflicts=False, precomputed_delta=None, _mover=None):
733
def apply(self, no_conflicts=False, _mover=None):
749
734
"""Apply all changes to the inventory and filesystem.
751
736
If filesystem or inventory conflicts are present, MalformedTransform
756
741
:param no_conflicts: if True, the caller guarantees there are no
757
742
conflicts, so no check is made.
758
:param precomputed_delta: An inventory delta to use instead of
760
743
:param _mover: Supply an alternate FileMover, for testing
762
745
raise NotImplementedError(self.apply)