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

Function commit

dvc/repo/commit.py:46–87  ·  view source on GitHub ↗
(
    self,
    target=None,
    with_deps=False,
    recursive=False,
    force=False,
    allow_missing=False,
    data_only=False,
    relink=True,
)

Source from the content-addressed store, hash-verified

44
45@locked
46def commit(
47 self,
48 target=None,
49 with_deps=False,
50 recursive=False,
51 force=False,
52 allow_missing=False,
53 data_only=False,
54 relink=True,
55):
56 committed_stages = []
57 groups = groupby(
58 [
59 info
60 for info in self.stage.collect_granular(
61 target, with_deps=with_deps, recursive=recursive
62 )
63 if not data_only or info.stage.is_data_source
64 ],
65 key=lambda info: info.stage.dvcfile,
66 )
67
68 for dvcfile, stages_info_group in groups:
69 to_dump = []
70 for stage_info in stages_info_group:
71 stage = stage_info.stage
72 if force:
73 stage.save(allow_missing=allow_missing)
74 else:
75 changes = stage.changed_entries()
76 if any(changes):
77 prompt_to_commit(stage, changes, force=force)
78 stage.save(allow_missing=allow_missing)
79 stage.commit(
80 filter_info=stage_info.filter_info,
81 allow_missing=allow_missing,
82 relink=relink,
83 )
84 to_dump.append(stage)
85 dvcfile.dump_stages(to_dump, update_pipeline=False)
86 committed_stages.extend(to_dump)
87 return committed_stages
88
89
90@locked

Callers

nothing calls this directly

Calls 8

prompt_to_commitFunction · 0.85
collect_granularMethod · 0.80
changed_entriesMethod · 0.80
appendMethod · 0.80
extendMethod · 0.80
saveMethod · 0.45
commitMethod · 0.45
dump_stagesMethod · 0.45

Tested by

no test coverage detected