From 0525caf229a4ad729bc5e0d38ee26dcb709da067 Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Sun, 26 Mar 2017 17:43:27 -0700 Subject: [PATCH] Propagate sumbit_id_needed() to all commands --- dvc/command/data_import.py | 6 +----- dvc/command/init.py | 7 +------ dvc/command/repro.py | 7 +------ dvc/command/run.py | 6 +----- 4 files changed, 4 insertions(+), 22 deletions(-) diff --git a/dvc/command/data_import.py b/dvc/command/data_import.py index c03e33950..228def2d4 100644 --- a/dvc/command/data_import.py +++ b/dvc/command/data_import.py @@ -51,12 +51,8 @@ class CmdDataImport(CmdBase): for file in self.args.input: self.import_file(file, output, self.args.is_reproducible) - if self.skip_git_actions: - self.not_committed_changes_warning() - return 0 - message = 'DVC data import: {} {}'.format(' '.join(self.args.input), self.args.output) - self.git.commit_all_changes_and_log_status(message) + return self.commit_if_needed(message) finally: lock.release() pass diff --git a/dvc/command/init.py b/dvc/command/init.py index 2f45dfc8a..f6e72eae9 100644 --- a/dvc/command/init.py +++ b/dvc/command/init.py @@ -91,17 +91,12 @@ SecurityGroup = dvc-group''' self.modify_gitignore(cache_dir_path.name) - if self.skip_git_actions: - self.not_committed_changes_warning() - return 0 - message = 'DVC init. data dir {}, cache dir {}, state dir {}'.format( data_dir_path.name, cache_dir_path.name, state_dir_path.name ) - self.git.commit_all_changes_and_log_status(message) - pass + return self.commit_if_needed(message) def modify_gitignore(self, cache_dir_name): gitignore_file = os.path.join(self.git.git_dir, '.gitignore') diff --git a/dvc/command/repro.py b/dvc/command/repro.py index 5095a09a2..89493cfde 100644 --- a/dvc/command/repro.py +++ b/dvc/command/repro.py @@ -88,12 +88,7 @@ class CmdRepro(CmdRun): return 1 if changed: - if self.skip_git_actions: - self.not_committed_changes_warning() - return 1 - - message = 'DVC repro: {}'.format(' '.join(self.args.target)) - self.git.commit_all_changes_and_log_status(message) + self.commit_if_needed('DVC repro: {}'.format(' '.join(self.args.target))) finally: lock.release() return 0 diff --git a/dvc/command/run.py b/dvc/command/run.py index c4f9fe435..6f2e1ccd8 100644 --- a/dvc/command/run.py +++ b/dvc/command/run.py @@ -67,12 +67,8 @@ class CmdRun(CmdBase): if not self.run_command(self._args_unkn, self.args.stdout, self.args.stderr): return 1 - if self.skip_git_actions: - self.not_committed_changes_warning() - return 0 - message = 'DVC run: {}'.format(' '.join(sys.argv)) - self.git.commit_all_changes_and_log_status(message) + self.commit_if_needed(message) finally: lock.release()