(self)
| 116 | ui.write("files summary:", states_summary) |
| 117 | |
| 118 | def run(self): |
| 119 | from dvc.exceptions import DvcException |
| 120 | |
| 121 | try: |
| 122 | diff = self.repo.diff(self.args.a_rev, self.args.b_rev, self.args.targets) |
| 123 | show_hash = self.args.show_hash |
| 124 | hide_missing = self.args.b_rev or self.args.hide_missing |
| 125 | if hide_missing: |
| 126 | diff.pop("not in cache", None) |
| 127 | |
| 128 | for key, entries in diff.items(): |
| 129 | entries = sorted( |
| 130 | entries, |
| 131 | key=lambda entry: ( |
| 132 | entry["path"]["old"] |
| 133 | if isinstance(entry["path"], dict) |
| 134 | else entry["path"] |
| 135 | ), |
| 136 | ) |
| 137 | if not show_hash: |
| 138 | for entry in entries: |
| 139 | del entry["hash"] |
| 140 | diff[key] = entries |
| 141 | |
| 142 | if self.args.json: |
| 143 | ui.write_json(diff) |
| 144 | elif self.args.markdown: |
| 145 | _show_markdown(diff, show_hash, hide_missing) |
| 146 | elif diff: |
| 147 | self._show_diff(diff, hide_missing) |
| 148 | |
| 149 | except DvcException: |
| 150 | logger.exception("failed to get diff") |
| 151 | return 1 |
| 152 | return 0 |
| 153 | |
| 154 | |
| 155 | def add_parser(subparsers, parent_parser): |
nothing calls this directly
no test coverage detected