From 4daa9e7a31b6b9cacb9c11035d9d78afe66181a4 Mon Sep 17 00:00:00 2001 From: Yves Noirjean <ynoir@bsse-vpn-206.ethz.ch> Date: Tue, 31 Oct 2017 14:20:00 +0100 Subject: [PATCH] added method to get the state of a repository --- src/python/OBis/obis/dm/data_mgmt.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/python/OBis/obis/dm/data_mgmt.py b/src/python/OBis/obis/dm/data_mgmt.py index 2f9c280d1b2..2a4aa522df8 100644 --- a/src/python/OBis/obis/dm/data_mgmt.py +++ b/src/python/OBis/obis/dm/data_mgmt.py @@ -221,6 +221,17 @@ class GitDataMgmt(AbstractDataMgmt): self.config_resolver.set_value_for_parameter(key, value, 'local') + def check_repository_state(self, path): + """Checks if the repo already exists and has uncommitted files.""" + with cd(path): + git_status = self.git_wrapper.git_status() + if git_status.failure(): + return 'NOT_INITIALIZED' + if git_status.output is not None and len(git_status.output) > 0: + return 'PENDING_CHANGES' + return 'SYNCHRONIZED' + + def get_data_set_id(self, path): with cd(path): return self.config_resolver.config_dict().get('data_set_id') -- GitLab