From 464ad54b3591f5db13004b44164f430a13ce5b2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Saugat=20Pachhai=20=28=E0=A4=B8=E0=A5=8C=E0=A4=97=E0=A4=BE?= =?UTF-8?q?=E0=A4=A4=29?= Date: Mon, 8 Jun 2020 19:03:07 +0545 Subject: [PATCH] log: show modifying if entry already exists in dvcfile --- dvc/dvcfile.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/dvc/dvcfile.py b/dvc/dvcfile.py index 1f9e25bbd9..298fe1bdff 100644 --- a/dvc/dvcfile.py +++ b/dvc/dvcfile.py @@ -201,15 +201,17 @@ def _dump_pipeline_file(self, stage): data["stages"] = data.get("stages", {}) stage_data = serialize.to_pipeline_file(stage) - if data["stages"].get(stage.name): + existing_entry = stage.name in data["stages"] + + action = "Modifying" if existing_entry else "Adding" + logger.info("%s stage '%s' in '%s'", action, stage.name, self.relpath) + + if existing_entry: orig_stage_data = data["stages"][stage.name] apply_diff(stage_data[stage.name], orig_stage_data) else: data["stages"].update(stage_data) - logger.info( - "Adding stage '%s' to '%s'", stage.name, self.relpath, - ) dump_yaml(self.path, data) self.repo.scm.track_file(self.relpath)