diff --git a/dvc/project.py b/dvc/project.py index 0ce183565..be08b2ae8 100644 --- a/dvc/project.py +++ b/dvc/project.py @@ -248,6 +248,10 @@ class Project(object): outs=[f], add=True) + if stage is None: + stages.append(stage) + continue + self._check_output_duplication(stage.outs, all_stages) stage.save() @@ -414,6 +418,9 @@ class Project(object): deps=[url], outs=[out]) + if stage is None: + return None + self._check_output_duplication(stage.outs, self.stages()) self._check_circular_dependency(stage.deps, stage.outs) diff --git a/tests/test_add.py b/tests/test_add.py index 8b9e1af2b..d41d845e0 100644 --- a/tests/test_add.py +++ b/tests/test_add.py @@ -1,5 +1,6 @@ import os import stat +import time import shutil import filecmp @@ -113,6 +114,9 @@ class TestAddModifiedDir(TestDvc): self.assertEqual(len(stages), 1) self.assertTrue(stages[0] is not None) os.unlink(self.DATA) + + time.sleep(2) + stages = self.dvc.add(self.DATA_DIR) self.assertEqual(len(stages), 1) self.assertTrue(stages[0] is not None)