From a9cd69f9803948c8c33d568b36dbcc3be084df2a Mon Sep 17 00:00:00 2001 From: Miguel Angel Fernandez Date: Fri, 21 Apr 2017 11:11:54 +0200 Subject: [PATCH 1/2] [logs] Add new log messages New log messages: inform if a git log file has been specified or not, and inform if the repository has been found locally or it has to be cloned --- perceval/backends/core/git.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/perceval/backends/core/git.py b/perceval/backends/core/git.py index c4c187e40..786b1fb59 100644 --- a/perceval/backends/core/git.py +++ b/perceval/backends/core/git.py @@ -125,18 +125,21 @@ def fetch(self, from_date=DEFAULT_DATETIME, branches=None): def __fetch_and_parse_log(self, from_date, branches): if os.path.isfile(self.gitpath): + logger.info("Fetching commits from the given log file %s", self.gitpath) return self.parse_git_log_from_file(self.gitpath) else: + logger.info("Log file not specified, retrieving from repository.") repo = self.__create_and_update_git_repository() gitlog = repo.log(from_date, branches) return self.parse_git_log_from_iter(gitlog) def __create_and_update_git_repository(self): if not os.path.exists(self.gitpath): + logger.info("Git repository not found in %s", self.gitpath) repo = GitRepository.clone(self.uri, self.gitpath) elif os.path.isdir(self.gitpath): + logger.info("Found Git repository in %s", self.gitpath) repo = GitRepository(self.uri, self.gitpath) - try: repo.pull() except EmptyRepositoryError: @@ -664,10 +667,10 @@ def clone(cls, uri, dirpath): :raises RepositoryError: when an error occurs cloning the given repository """ + logger.info("Cloning repository %s", uri) cmd = ['git', 'clone', uri, dirpath] cls._exec(cmd, env={'LANG': 'C'}) - - logger.debug("Git %s repository cloned into %s", + logger.info("Git repository %s cloned into %s", uri, dirpath) return cls(uri, dirpath) From b6b693894b2658be02dc2ef8400b97c9b01bc1a6 Mon Sep 17 00:00:00 2001 From: Miguel Angel Fernandez Date: Wed, 26 Apr 2017 10:55:22 +0200 Subject: [PATCH 2/2] Fixed flake8 errors --- perceval/backends/core/git.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/perceval/backends/core/git.py b/perceval/backends/core/git.py index 786b1fb59..208626392 100644 --- a/perceval/backends/core/git.py +++ b/perceval/backends/core/git.py @@ -671,7 +671,7 @@ def clone(cls, uri, dirpath): cmd = ['git', 'clone', uri, dirpath] cls._exec(cmd, env={'LANG': 'C'}) logger.info("Git repository %s cloned into %s", - uri, dirpath) + uri, dirpath) return cls(uri, dirpath)