mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-22 23:11:20 +01:00
exp init: autostage .gitignores, dvc.yaml and params file
This commit is contained in:
committed by
Saugat Pachhai
parent
97e97c7f24
commit
208ccb2430
@@ -224,13 +224,13 @@ def init(
|
||||
assert "cmd" in context
|
||||
|
||||
params_kv = []
|
||||
if context.get("params"):
|
||||
params = context.get("params")
|
||||
if params:
|
||||
from dvc.utils.serialize import LOADERS
|
||||
|
||||
path = context["params"]
|
||||
assert isinstance(path, str)
|
||||
_, ext = os.path.splitext(path)
|
||||
params_kv = [{path: list(LOADERS[ext](path))}]
|
||||
assert isinstance(params, str)
|
||||
_, ext = os.path.splitext(params)
|
||||
params_kv = [{params: list(LOADERS[ext](params))}]
|
||||
|
||||
checkpoint_out = bool(context.get("live"))
|
||||
models = context.get("models")
|
||||
@@ -255,9 +255,11 @@ def init(
|
||||
if not interactive or ui.confirm(
|
||||
"Do you want to add the above contents to dvc.yaml?"
|
||||
):
|
||||
with _disable_logging():
|
||||
scm = repo.scm
|
||||
with _disable_logging(), scm.track_file_changes(autostage=True):
|
||||
stage.dump(update_lock=False)
|
||||
stage.ignore_outs()
|
||||
stage.ignore_outs()
|
||||
scm.track_file(params)
|
||||
else:
|
||||
raise DvcException("Aborting ...")
|
||||
return stage
|
||||
|
||||
+4
-2
@@ -183,8 +183,10 @@ class Base:
|
||||
"""
|
||||
|
||||
@contextmanager
|
||||
def track_file_changes(self, config=None):
|
||||
autostage = get_in(config or {}, ["core", "autostage"])
|
||||
def track_file_changes(self, config=None, autostage=False):
|
||||
autostage = get_in(
|
||||
config or {}, ["core", "autostage"], default=autostage
|
||||
)
|
||||
|
||||
try:
|
||||
yield
|
||||
|
||||
Reference in New Issue
Block a user