Fix modifying plot (#3926)

- no error when modifying plot with no props yet
- do not turn into non-plot if all props are unset
This commit is contained in:
Alexander Schepanovski
2020-06-01 16:19:11 +03:00
committed by GitHub
parent 076eadceba
commit 536966f9d1
+5 -1
View File
@@ -18,13 +18,17 @@ class Plots:
(out,) = self.repo.find_outs_by_path(path)
# This out will become a plot unless it is one already
if not out.plot:
if not isinstance(out.plot, dict):
out.plot = {}
for field in unset or ():
out.plot.pop(field, None)
out.plot.update(props or {})
# Empty dict will move it to non-plots
if not out.plot:
out.plot = True
out.verify_metric()
dvcfile = Dvcfile(self.repo, out.stage.path)