/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/git/transform.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2020-11-19 19:46:23 UTC
  • mfrom: (7524.2.5 merge-3.1)
  • Revision ID: breezy.the.bot@gmail.com-20201119194623-5tfi4z6ktdzo0z3y
Merge lp:brz/3.1.

Merged from https://code.launchpad.net/~jelmer/brz/merge-3.1/+merge/394038

Show diffs side-by-side

added added

removed removed

Lines of Context:
300
300
 
301
301
    def _parent_loops(self):
302
302
        """No entry should be its own ancestor"""
303
 
        conflicts = []
304
303
        for trans_id in self._new_parent:
305
304
            seen = set()
306
305
            parent_id = trans_id
311
310
                except KeyError:
312
311
                    break
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:
316
315
                    break
317
 
        return conflicts
318
316
 
319
317
    def _improper_versioning(self):
320
318
        """Cannot version a file with no contents, or a bad type.
321
319
 
322
320
        However, existing entries with no contents are okay.
323
321
        """
324
 
        conflicts = []
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
329
326
                continue
330
327
            if kind is None:
331
 
                conflicts.append(('versioning no contents', trans_id))
 
328
                yield ('versioning no contents', trans_id)
332
329
                continue
333
330
            if not self._tree.versionable_kind(kind):
334
 
                conflicts.append(('versioning bad kind', trans_id, kind))
335
 
        return conflicts
 
331
                yield ('versioning bad kind', trans_id, kind)
336
332
 
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)
344
340
        """
345
 
        conflicts = []
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)
349
344
            else:
350
345
                if self.final_kind(trans_id) != "file":
351
 
                    conflicts.append(('non-file executability', trans_id))
352
 
        return conflicts
 
346
                    yield ('non-file executability', trans_id)
353
347
 
354
348
    def _overwrite_conflicts(self):
355
349
        """Check for overwrites (not permitted on Win32)"""
356
 
        conflicts = []
357
350
        for trans_id in self._new_contents:
358
351
            if self.tree_kind(trans_id) is None:
359
352
                continue
360
353
            if trans_id not in self._removed_contents:
361
 
                conflicts.append(('overwrite', trans_id,
362
 
                                  self.final_name(trans_id)))
363
 
        return conflicts
 
354
                yield ('overwrite', trans_id, self.final_name(trans_id))
364
355
 
365
356
    def _duplicate_entries(self, by_parent):
366
357
        """No directory may have two entries with the same name."""
367
 
        conflicts = []
368
358
        if (self._new_name, self._new_parent) == ({}, {}):
369
 
            return conflicts
 
359
            return
370
360
        for children in by_parent.values():
371
361
            name_ids = []
372
362
            for child_tid in children:
384
374
                if kind is None and not self.final_is_versioned(trans_id):
385
375
                    continue
386
376
                if name == last_name:
387
 
                    conflicts.append(('duplicate', last_trans_id, trans_id,
388
 
                                      name))
 
377
                    yield ('duplicate', last_trans_id, trans_id, name)
389
378
                last_name = name
390
379
                last_trans_id = trans_id
391
 
        return conflicts
392
380
 
393
381
    def _parent_type_conflicts(self, by_parent):
394
382
        """Children must have a directory parent"""
395
 
        conflicts = []
396
383
        for parent_id, children in by_parent.items():
397
384
            if parent_id == ROOT_PARENT:
398
385
                continue
408
395
            kind = self.final_kind(parent_id)
409
396
            if kind is None:
410
397
                # The directory will be deleted
411
 
                conflicts.append(('missing parent', parent_id))
 
398
                yield ('missing parent', parent_id)
412
399
            elif kind != "directory":
413
400
                # Meh, we need a *directory* to put something in it
414
 
                conflicts.append(('non-directory parent', parent_id))
415
 
        return conflicts
 
401
                yield ('non-directory parent', parent_id)
416
402
 
417
403
    def _set_executability(self, path, trans_id):
418
404
        """Set the executability of versioned files """
745
731
        """Cancel the creation of new file contents."""
746
732
        raise NotImplementedError(self.cancel_creation)
747
733
 
748
 
    def apply(self, no_conflicts=False, precomputed_delta=None, _mover=None):
 
734
    def apply(self, no_conflicts=False, _mover=None):
749
735
        """Apply all changes to the inventory and filesystem.
750
736
 
751
737
        If filesystem or inventory conflicts are present, MalformedTransform
755
741
 
756
742
        :param no_conflicts: if True, the caller guarantees there are no
757
743
            conflicts, so no check is made.
758
 
        :param precomputed_delta: An inventory delta to use instead of
759
 
            calculating one.
760
744
        :param _mover: Supply an alternate FileMover, for testing
761
745
        """
762
746
        raise NotImplementedError(self.apply)