| 680 | self.repo.scm_context.ignore_remove(self.fspath) |
| 681 | |
| 682 | def save(self) -> None: |
| 683 | if self.use_cache and not self.is_in_repo: |
| 684 | raise DvcException( |
| 685 | f"Saving cached external output {self!s} is not supported " |
| 686 | "since DVC 3.0. See " |
| 687 | f"{format_link('https://dvc.org/doc/user-guide/upgrade')} " |
| 688 | "for more info." |
| 689 | ) |
| 690 | |
| 691 | if not self.exists: |
| 692 | raise self.DoesNotExistError(self) |
| 693 | |
| 694 | if not self.isfile() and not self.isdir(): |
| 695 | raise self.IsNotFileOrDirError(self) |
| 696 | |
| 697 | if self.is_empty: |
| 698 | logger.warning("'%s' is empty.", self) |
| 699 | |
| 700 | self.ignore() |
| 701 | |
| 702 | if self.metric: |
| 703 | self.verify_metric() |
| 704 | |
| 705 | self.update_legacy_hash_name() |
| 706 | if self.use_cache: |
| 707 | _, self.meta, self.obj = self._build( |
| 708 | self.cache, |
| 709 | self.fs_path, |
| 710 | self.fs, |
| 711 | self.hash_name, |
| 712 | ignore=self.dvcignore, |
| 713 | ) |
| 714 | else: |
| 715 | _, self.meta, self.obj = self._build( |
| 716 | self.local_cache, |
| 717 | self.fs_path, |
| 718 | self.fs, |
| 719 | self.hash_name, |
| 720 | ignore=self.dvcignore, |
| 721 | dry_run=True, |
| 722 | ) |
| 723 | if not self.IS_DEPENDENCY: |
| 724 | logger.debug("Output '%s' doesn't use cache. Skipping saving.", self) |
| 725 | |
| 726 | self.hash_info = self.obj.hash_info |
| 727 | self.files = None |
| 728 | |
| 729 | def update_legacy_hash_name(self, force: bool = False): |
| 730 | if self.hash_name == "md5-dos2unix" and (force or self.changed_checksum()): |