(self)
| 24 | |
| 25 | class CmdCheckout(CmdBase): |
| 26 | def run(self): |
| 27 | from dvc.utils.humanize import get_summary |
| 28 | |
| 29 | stats, exc = None, None |
| 30 | try: |
| 31 | result = self.repo.checkout( |
| 32 | targets=self.args.targets, |
| 33 | with_deps=self.args.with_deps, |
| 34 | force=self.args.force, |
| 35 | relink=self.args.relink, |
| 36 | recursive=self.args.recursive, |
| 37 | allow_missing=self.args.allow_missing, |
| 38 | ) |
| 39 | except CheckoutError as _exc: |
| 40 | exc = _exc |
| 41 | result = exc.result |
| 42 | |
| 43 | if self.args.summary: |
| 44 | default_message = "No changes." |
| 45 | stats = result["stats"] |
| 46 | assert isinstance(stats, dict) |
| 47 | msg = get_summary(stats.items()) |
| 48 | ui.write(msg or default_message) |
| 49 | else: |
| 50 | result.pop("stats", {}) |
| 51 | log_changes(result) |
| 52 | |
| 53 | if exc: |
| 54 | raise exc |
| 55 | |
| 56 | if self.args.relink: |
| 57 | msg = "Relinked successfully" |
| 58 | ui.write(msg) |
| 59 | return 0 |
| 60 | |
| 61 | |
| 62 | def add_parser(subparsers, parent_parser): |
nothing calls this directly
no test coverage detected