MCPcopy
hub / github.com/treeverse/dvc / run

Method run

dvc/commands/checkout.py:26–59  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

24
25class 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
62def add_parser(subparsers, parent_parser):

Callers

nothing calls this directly

Calls 5

get_summaryFunction · 0.90
log_changesFunction · 0.85
itemsMethod · 0.80
writeMethod · 0.80
checkoutMethod · 0.45

Tested by

no test coverage detected