From dc582fbec8ca968144191830817bd3838124b5ed Mon Sep 17 00:00:00 2001 From: Kelly Brazil Date: Fri, 13 May 2022 12:44:01 -0700 Subject: [PATCH] fix for git-log coner cases --- jc/parsers/git_log.py | 6 +- jc/parsers/git_log_s.py | 6 +- ...git-log-hash-in-message-fix-streaming.json | 1 + .../generic/git-log-hash-in-message-fix.json | 1 + .../generic/git-log-hash-in-message-fix.out | 38 ++++++ .../git-log-is-hash-regex-fix-streaming.json | 1 + .../generic/git-log-is-hash-regex-fix.json | 1 + .../generic/git-log-is-hash-regex-fix.out | 124 ++++++++++++++++++ tests/test_git_log.py | 26 ++++ tests/test_git_log_s.py | 28 +++- 10 files changed, 225 insertions(+), 7 deletions(-) create mode 100644 tests/fixtures/generic/git-log-hash-in-message-fix-streaming.json create mode 100644 tests/fixtures/generic/git-log-hash-in-message-fix.json create mode 100644 tests/fixtures/generic/git-log-hash-in-message-fix.out create mode 100644 tests/fixtures/generic/git-log-is-hash-regex-fix-streaming.json create mode 100644 tests/fixtures/generic/git-log-is-hash-regex-fix.json create mode 100644 tests/fixtures/generic/git-log-is-hash-regex-fix.out diff --git a/jc/parsers/git_log.py b/jc/parsers/git_log.py index e72a5e88..bfadcf08 100644 --- a/jc/parsers/git_log.py +++ b/jc/parsers/git_log.py @@ -148,12 +148,12 @@ import re from typing import List, Dict import jc.utils -hash_pattern = re.compile(r'([0-9]|[a-f])+') +hash_pattern = re.compile(r'(?:[0-9]|[a-f]){40}') changes_pattern = re.compile(r'\s(?P\d+)\s+(files? changed),\s+(?P\d+)\s(insertions?\(\+\))?(,\s+)?(?P\d+)?(\s+deletions?\(\-\))?') class info(): """Provides parser metadata (version, author, etc.)""" - version = '1.0' + version = '1.1' description = '`git log` command parser' author = 'Kelly Brazil' author_email = 'kellyjonbrazil@gmail.com' @@ -234,7 +234,7 @@ def parse( line_list = line.split(maxsplit=1) # oneline style - if line_list and _is_commit_hash(line_list[0]): + if not line.startswith(' ') and line_list and _is_commit_hash(line_list[0]): if output_line: if file_list: output_line['stats']['files'] = file_list diff --git a/jc/parsers/git_log_s.py b/jc/parsers/git_log_s.py index 0687a9cd..66fa2d4f 100644 --- a/jc/parsers/git_log_s.py +++ b/jc/parsers/git_log_s.py @@ -81,13 +81,13 @@ from jc.streaming import ( from jc.exceptions import ParseError -hash_pattern = re.compile(r'([0-9]|[a-f])+') +hash_pattern = re.compile(r'(?:[0-9]|[a-f]){40}') changes_pattern = re.compile(r'\s(?P\d+)\s+(files? changed),\s+(?P\d+)\s(insertions?\(\+\))?(,\s+)?(?P\d+)?(\s+deletions?\(\-\))?') class info(): """Provides parser metadata (version, author, etc.)""" - version = '1.0' + version = '1.1' description = '`git log` command streaming parser' author = 'Kelly Brazil' author_email = 'kellyjonbrazil@gmail.com' @@ -177,7 +177,7 @@ def parse( line_list = line.rstrip().split(maxsplit=1) # oneline style - if line_list and _is_commit_hash(line_list[0]): + if not line.startswith(' ') and line_list and _is_commit_hash(line_list[0]): if output_line: if file_list: output_line['stats']['files'] = file_list diff --git a/tests/fixtures/generic/git-log-hash-in-message-fix-streaming.json b/tests/fixtures/generic/git-log-hash-in-message-fix-streaming.json new file mode 100644 index 00000000..64ce338e --- /dev/null +++ b/tests/fixtures/generic/git-log-hash-in-message-fix-streaming.json @@ -0,0 +1 @@ +[{"commit":"e05824a36ca62aa9f3a21854ec8b40a3e0f7a68d","author":"Benedikt Heine","author_email":"bebe@bebehei.de","date":"Mon Oct 28 12:42:22 2019 +0100","commit_by":"Benedikt Heine","commit_by_email":"bebe@bebehei.de","commit_by_date":"Sun Apr 12 17:27:16 2020 +0200","stats":{"files_changed":1,"insertions":13,"deletions":3,"files":["salt/modules/monit.py"]},"message":"Split monit status fields on monit version\n\nWith the commit [0] on monit, the field size changed. So splitting hard\nafter 35 chars, new versions of monit break when using monit.status.\n\n[0] https://bitbucket.org/tildeslash/monit/commits/\n471c4bbc388c1c536f07ce1dd26b811bd39a9467","epoch":1572291742,"epoch_utc":null},{"commit":"910a2ac4809bb05b886adfe75f4857eb53fdfbb1","merge":"6c3964ce30 f0a1e923e3","author":"Daniel Wozniak","author_email":"dwozniak@saltstack.com","date":"Sun Apr 12 00:09:37 2020 -0700","commit_by":"GitHub","commit_by_email":"noreply@github.com","commit_by_date":"Sun Apr 12 00:09:37 2020 -0700","message":"Merge pull request #53911 from terminalmage/squelch-log\n\nalternatives: Don't log error when running \"alternatives --display\" on nonexistant target","epoch":1586675377,"epoch_utc":null},{"commit":"6c3964ce30929e749c0965bc0d60527e9fe8dbb1","merge":"3026c25faf 2ac4da54e3","author":"Daniel Wozniak","author_email":"dwozniak@saltstack.com","date":"Sun Apr 12 00:09:16 2020 -0700","commit_by":"GitHub","commit_by_email":"noreply@github.com","commit_by_date":"Sun Apr 12 00:09:16 2020 -0700","message":"Merge pull request #54199 from driskell/patch-2\n\nFix broken sdb.get_or_set_hash for Hashicorp Vault","epoch":1586675356,"epoch_utc":null}] diff --git a/tests/fixtures/generic/git-log-hash-in-message-fix.json b/tests/fixtures/generic/git-log-hash-in-message-fix.json new file mode 100644 index 00000000..64ce338e --- /dev/null +++ b/tests/fixtures/generic/git-log-hash-in-message-fix.json @@ -0,0 +1 @@ +[{"commit":"e05824a36ca62aa9f3a21854ec8b40a3e0f7a68d","author":"Benedikt Heine","author_email":"bebe@bebehei.de","date":"Mon Oct 28 12:42:22 2019 +0100","commit_by":"Benedikt Heine","commit_by_email":"bebe@bebehei.de","commit_by_date":"Sun Apr 12 17:27:16 2020 +0200","stats":{"files_changed":1,"insertions":13,"deletions":3,"files":["salt/modules/monit.py"]},"message":"Split monit status fields on monit version\n\nWith the commit [0] on monit, the field size changed. So splitting hard\nafter 35 chars, new versions of monit break when using monit.status.\n\n[0] https://bitbucket.org/tildeslash/monit/commits/\n471c4bbc388c1c536f07ce1dd26b811bd39a9467","epoch":1572291742,"epoch_utc":null},{"commit":"910a2ac4809bb05b886adfe75f4857eb53fdfbb1","merge":"6c3964ce30 f0a1e923e3","author":"Daniel Wozniak","author_email":"dwozniak@saltstack.com","date":"Sun Apr 12 00:09:37 2020 -0700","commit_by":"GitHub","commit_by_email":"noreply@github.com","commit_by_date":"Sun Apr 12 00:09:37 2020 -0700","message":"Merge pull request #53911 from terminalmage/squelch-log\n\nalternatives: Don't log error when running \"alternatives --display\" on nonexistant target","epoch":1586675377,"epoch_utc":null},{"commit":"6c3964ce30929e749c0965bc0d60527e9fe8dbb1","merge":"3026c25faf 2ac4da54e3","author":"Daniel Wozniak","author_email":"dwozniak@saltstack.com","date":"Sun Apr 12 00:09:16 2020 -0700","commit_by":"GitHub","commit_by_email":"noreply@github.com","commit_by_date":"Sun Apr 12 00:09:16 2020 -0700","message":"Merge pull request #54199 from driskell/patch-2\n\nFix broken sdb.get_or_set_hash for Hashicorp Vault","epoch":1586675356,"epoch_utc":null}] diff --git a/tests/fixtures/generic/git-log-hash-in-message-fix.out b/tests/fixtures/generic/git-log-hash-in-message-fix.out new file mode 100644 index 00000000..a4ceda86 --- /dev/null +++ b/tests/fixtures/generic/git-log-hash-in-message-fix.out @@ -0,0 +1,38 @@ +commit e05824a36ca62aa9f3a21854ec8b40a3e0f7a68d +Author: Benedikt Heine +AuthorDate: Mon Oct 28 12:42:22 2019 +0100 +Commit: Benedikt Heine +CommitDate: Sun Apr 12 17:27:16 2020 +0200 + + Split monit status fields on monit version + + With the commit [0] on monit, the field size changed. So splitting hard + after 35 chars, new versions of monit break when using monit.status. + + [0] https://bitbucket.org/tildeslash/monit/commits/ + 471c4bbc388c1c536f07ce1dd26b811bd39a9467 + + salt/modules/monit.py | 16 +++++++++++++--- + 1 file changed, 13 insertions(+), 3 deletions(-) + +commit 910a2ac4809bb05b886adfe75f4857eb53fdfbb1 +Merge: 6c3964ce30 f0a1e923e3 +Author: Daniel Wozniak +AuthorDate: Sun Apr 12 00:09:37 2020 -0700 +Commit: GitHub +CommitDate: Sun Apr 12 00:09:37 2020 -0700 + + Merge pull request #53911 from terminalmage/squelch-log + + alternatives: Don't log error when running "alternatives --display" on nonexistant target + +commit 6c3964ce30929e749c0965bc0d60527e9fe8dbb1 +Merge: 3026c25faf 2ac4da54e3 +Author: Daniel Wozniak +AuthorDate: Sun Apr 12 00:09:16 2020 -0700 +Commit: GitHub +CommitDate: Sun Apr 12 00:09:16 2020 -0700 + + Merge pull request #54199 from driskell/patch-2 + + Fix broken sdb.get_or_set_hash for Hashicorp Vault diff --git a/tests/fixtures/generic/git-log-is-hash-regex-fix-streaming.json b/tests/fixtures/generic/git-log-is-hash-regex-fix-streaming.json new file mode 100644 index 00000000..63d03a3e --- /dev/null +++ b/tests/fixtures/generic/git-log-is-hash-regex-fix-streaming.json @@ -0,0 +1 @@ +[{"commit":"6170eac439e590d774eb2e448c68eec90ea3fac0","author":"Jasper Lievisse Adriaanse","author_email":"j@jasper.la","date":"Fri Jul 3 15:19:49 2020 +0200","commit_by":"Daniel Wozniak","commit_by_email":"dan.woz@gmail.com","commit_by_date":"Fri Aug 28 12:16:13 2020 -0700","stats":{"files_changed":1,"insertions":11,"deletions":12,"files":["doc/topics/installation/openbsd.rst"]},"message":"Sync OpenBSD installation documentation with reality\n\nOpenBSD's salt package moved to python3 a while ago and dependencies\nhave changed since this page was last updated.\n\nWhile here tweak a reference to the OpenBSD package, not pkg, repo.","epoch":1593814789,"epoch_utc":null},{"commit":"2d684bd506d473379670ff8905db689d051ff7db","author":"Bryce Larson","author_email":"blarson@saltstack.com","date":"Thu Aug 13 18:04:22 2020 +0000","commit_by":"Daniel Wozniak","commit_by_email":"dan.woz@gmail.com","commit_by_date":"Fri Aug 28 11:03:45 2020 -0700","stats":{"files_changed":88,"insertions":88,"deletions":0,"files":[".ci/kitchen-amazon2-py3",".ci/kitchen-amazon2-py3-pytest",".ci/kitchen-archlts-py3",".ci/kitchen-archlts-py3-pytest",".ci/kitchen-centos7-py3",".ci/kitchen-centos7-py3-cloud",".ci/kitchen-centos7-py3-cloud-pytest",".ci/kitchen-centos7-py3-m2crypto",".ci/kitchen-centos7-py3-m2crypto-pytest",".ci/kitchen-centos7-py3-proxy",".ci/kitchen-centos7-py3-pycryptodome",".ci/kitchen-centos7-py3-pycryptodome-pytest",".ci/kitchen-centos7-py3-pytest",".ci/kitchen-centos7-py3-tcp",".ci/kitchen-centos7-py3-tcp-pytest",".ci/kitchen-centos8-py3",".ci/kitchen-centos8-py3-pytest",".ci/kitchen-debian10-py3",".ci/kitchen-debian10-py3-pytest",".ci/kitchen-debian9-py3",".ci/kitchen-debian9-py3-pytest",".ci/kitchen-fedora31-py3",".ci/kitchen-fedora31-py3-pytest",".ci/kitchen-fedora32-py3",".ci/kitchen-fedora32-py3-pytest",".ci/kitchen-opensuse15-py3",".ci/kitchen-opensuse15-py3-pytest",".ci/kitchen-ubuntu1604-py3",".ci/kitchen-ubuntu1604-py3-m2crypto",".ci/kitchen-ubuntu1604-py3-m2crypto-pytest",".ci/kitchen-ubuntu1604-py3-proxy",".ci/kitchen-ubuntu1604-py3-pycryptodome",".ci/kitchen-ubuntu1604-py3-pycryptodome-pytest",".ci/kitchen-ubuntu1604-py3-pytest",".ci/kitchen-ubuntu1604-py3-tcp",".ci/kitchen-ubuntu1604-py3-tcp-pytest",".ci/kitchen-ubuntu1804-py3",".ci/kitchen-ubuntu1804-py3-pytest",".ci/kitchen-ubuntu2004-py3",".ci/kitchen-ubuntu2004-py3-pytest",".ci/kitchen-windows2016-py3",".ci/kitchen-windows2016-py3-pytest",".ci/kitchen-windows2019-py3",".ci/kitchen-windows2019-py3-pytest","cicd/jenkins/kitchen-amazon2-py3","cicd/jenkins/kitchen-amazon2-py3-pytest","cicd/jenkins/kitchen-archlts-py3","cicd/jenkins/kitchen-archlts-py3-pytest","cicd/jenkins/kitchen-centos7-py3","cicd/jenkins/kitchen-centos7-py3-cloud","cicd/jenkins/kitchen-centos7-py3-cloud-pytest","cicd/jenkins/kitchen-centos7-py3-m2crypto","cicd/jenkins/kitchen-centos7-py3-m2crypto-pytest","cicd/jenkins/kitchen-centos7-py3-proxy","cicd/jenkins/kitchen-centos7-py3-pycryptodome","cicd/jenkins/kitchen-centos7-py3-pycryptodome-pytest","cicd/jenkins/kitchen-centos7-py3-pytest","cicd/jenkins/kitchen-centos7-py3-tcp","cicd/jenkins/kitchen-centos7-py3-tcp-pytest","cicd/jenkins/kitchen-centos8-py3","cicd/jenkins/kitchen-centos8-py3-pytest","cicd/jenkins/kitchen-debian10-py3","cicd/jenkins/kitchen-debian10-py3-pytest","cicd/jenkins/kitchen-debian9-py3","cicd/jenkins/kitchen-debian9-py3-pytest","cicd/jenkins/kitchen-fedora31-py3","cicd/jenkins/kitchen-fedora31-py3-pytest","cicd/jenkins/kitchen-fedora32-py3","cicd/jenkins/kitchen-fedora32-py3-pytest","cicd/jenkins/kitchen-opensuse15-py3","cicd/jenkins/kitchen-opensuse15-py3-pytest","cicd/jenkins/kitchen-ubuntu1604-py3","cicd/jenkins/kitchen-ubuntu1604-py3-m2crypto","cicd/jenkins/kitchen-ubuntu1604-py3-m2crypto-pytest","cicd/jenkins/kitchen-ubuntu1604-py3-proxy","cicd/jenkins/kitchen-ubuntu1604-py3-pycryptodome","cicd/jenkins/kitchen-ubuntu1604-py3-pycryptodome-pytest","cicd/jenkins/kitchen-ubuntu1604-py3-pytest","cicd/jenkins/kitchen-ubuntu1604-py3-tcp","cicd/jenkins/kitchen-ubuntu1604-py3-tcp-pytest","cicd/jenkins/kitchen-ubuntu1804-py3","cicd/jenkins/kitchen-ubuntu1804-py3-pytest","cicd/jenkins/kitchen-ubuntu2004-py3","cicd/jenkins/kitchen-ubuntu2004-py3-pytest","cicd/jenkins/kitchen-windows2016-py3","cicd/jenkins/kitchen-windows2016-py3-pytest","cicd/jenkins/kitchen-windows2019-py3","cicd/jenkins/kitchen-windows2019-py3-pytest"]},"message":"hard-code ami ids","epoch":1597367062,"epoch_utc":1597341862},{"commit":"3332f5e131f223a9fd9fef22437c7830210d301f","author":"krionbsd","author_email":"krion@FreeBSD.org","date":"Thu Jul 30 14:50:44 2020 +0200","commit_by":"Daniel Wozniak","commit_by_email":"dan.woz@gmail.com","commit_by_date":"Thu Aug 27 13:04:37 2020 -0700","stats":{"files_changed":1,"insertions":31,"deletions":36,"files":["tests/unit/test_loader.py"]},"message":"[merge jam] port 53224","epoch":1596145844,"epoch_utc":null}] diff --git a/tests/fixtures/generic/git-log-is-hash-regex-fix.json b/tests/fixtures/generic/git-log-is-hash-regex-fix.json new file mode 100644 index 00000000..63d03a3e --- /dev/null +++ b/tests/fixtures/generic/git-log-is-hash-regex-fix.json @@ -0,0 +1 @@ +[{"commit":"6170eac439e590d774eb2e448c68eec90ea3fac0","author":"Jasper Lievisse Adriaanse","author_email":"j@jasper.la","date":"Fri Jul 3 15:19:49 2020 +0200","commit_by":"Daniel Wozniak","commit_by_email":"dan.woz@gmail.com","commit_by_date":"Fri Aug 28 12:16:13 2020 -0700","stats":{"files_changed":1,"insertions":11,"deletions":12,"files":["doc/topics/installation/openbsd.rst"]},"message":"Sync OpenBSD installation documentation with reality\n\nOpenBSD's salt package moved to python3 a while ago and dependencies\nhave changed since this page was last updated.\n\nWhile here tweak a reference to the OpenBSD package, not pkg, repo.","epoch":1593814789,"epoch_utc":null},{"commit":"2d684bd506d473379670ff8905db689d051ff7db","author":"Bryce Larson","author_email":"blarson@saltstack.com","date":"Thu Aug 13 18:04:22 2020 +0000","commit_by":"Daniel Wozniak","commit_by_email":"dan.woz@gmail.com","commit_by_date":"Fri Aug 28 11:03:45 2020 -0700","stats":{"files_changed":88,"insertions":88,"deletions":0,"files":[".ci/kitchen-amazon2-py3",".ci/kitchen-amazon2-py3-pytest",".ci/kitchen-archlts-py3",".ci/kitchen-archlts-py3-pytest",".ci/kitchen-centos7-py3",".ci/kitchen-centos7-py3-cloud",".ci/kitchen-centos7-py3-cloud-pytest",".ci/kitchen-centos7-py3-m2crypto",".ci/kitchen-centos7-py3-m2crypto-pytest",".ci/kitchen-centos7-py3-proxy",".ci/kitchen-centos7-py3-pycryptodome",".ci/kitchen-centos7-py3-pycryptodome-pytest",".ci/kitchen-centos7-py3-pytest",".ci/kitchen-centos7-py3-tcp",".ci/kitchen-centos7-py3-tcp-pytest",".ci/kitchen-centos8-py3",".ci/kitchen-centos8-py3-pytest",".ci/kitchen-debian10-py3",".ci/kitchen-debian10-py3-pytest",".ci/kitchen-debian9-py3",".ci/kitchen-debian9-py3-pytest",".ci/kitchen-fedora31-py3",".ci/kitchen-fedora31-py3-pytest",".ci/kitchen-fedora32-py3",".ci/kitchen-fedora32-py3-pytest",".ci/kitchen-opensuse15-py3",".ci/kitchen-opensuse15-py3-pytest",".ci/kitchen-ubuntu1604-py3",".ci/kitchen-ubuntu1604-py3-m2crypto",".ci/kitchen-ubuntu1604-py3-m2crypto-pytest",".ci/kitchen-ubuntu1604-py3-proxy",".ci/kitchen-ubuntu1604-py3-pycryptodome",".ci/kitchen-ubuntu1604-py3-pycryptodome-pytest",".ci/kitchen-ubuntu1604-py3-pytest",".ci/kitchen-ubuntu1604-py3-tcp",".ci/kitchen-ubuntu1604-py3-tcp-pytest",".ci/kitchen-ubuntu1804-py3",".ci/kitchen-ubuntu1804-py3-pytest",".ci/kitchen-ubuntu2004-py3",".ci/kitchen-ubuntu2004-py3-pytest",".ci/kitchen-windows2016-py3",".ci/kitchen-windows2016-py3-pytest",".ci/kitchen-windows2019-py3",".ci/kitchen-windows2019-py3-pytest","cicd/jenkins/kitchen-amazon2-py3","cicd/jenkins/kitchen-amazon2-py3-pytest","cicd/jenkins/kitchen-archlts-py3","cicd/jenkins/kitchen-archlts-py3-pytest","cicd/jenkins/kitchen-centos7-py3","cicd/jenkins/kitchen-centos7-py3-cloud","cicd/jenkins/kitchen-centos7-py3-cloud-pytest","cicd/jenkins/kitchen-centos7-py3-m2crypto","cicd/jenkins/kitchen-centos7-py3-m2crypto-pytest","cicd/jenkins/kitchen-centos7-py3-proxy","cicd/jenkins/kitchen-centos7-py3-pycryptodome","cicd/jenkins/kitchen-centos7-py3-pycryptodome-pytest","cicd/jenkins/kitchen-centos7-py3-pytest","cicd/jenkins/kitchen-centos7-py3-tcp","cicd/jenkins/kitchen-centos7-py3-tcp-pytest","cicd/jenkins/kitchen-centos8-py3","cicd/jenkins/kitchen-centos8-py3-pytest","cicd/jenkins/kitchen-debian10-py3","cicd/jenkins/kitchen-debian10-py3-pytest","cicd/jenkins/kitchen-debian9-py3","cicd/jenkins/kitchen-debian9-py3-pytest","cicd/jenkins/kitchen-fedora31-py3","cicd/jenkins/kitchen-fedora31-py3-pytest","cicd/jenkins/kitchen-fedora32-py3","cicd/jenkins/kitchen-fedora32-py3-pytest","cicd/jenkins/kitchen-opensuse15-py3","cicd/jenkins/kitchen-opensuse15-py3-pytest","cicd/jenkins/kitchen-ubuntu1604-py3","cicd/jenkins/kitchen-ubuntu1604-py3-m2crypto","cicd/jenkins/kitchen-ubuntu1604-py3-m2crypto-pytest","cicd/jenkins/kitchen-ubuntu1604-py3-proxy","cicd/jenkins/kitchen-ubuntu1604-py3-pycryptodome","cicd/jenkins/kitchen-ubuntu1604-py3-pycryptodome-pytest","cicd/jenkins/kitchen-ubuntu1604-py3-pytest","cicd/jenkins/kitchen-ubuntu1604-py3-tcp","cicd/jenkins/kitchen-ubuntu1604-py3-tcp-pytest","cicd/jenkins/kitchen-ubuntu1804-py3","cicd/jenkins/kitchen-ubuntu1804-py3-pytest","cicd/jenkins/kitchen-ubuntu2004-py3","cicd/jenkins/kitchen-ubuntu2004-py3-pytest","cicd/jenkins/kitchen-windows2016-py3","cicd/jenkins/kitchen-windows2016-py3-pytest","cicd/jenkins/kitchen-windows2019-py3","cicd/jenkins/kitchen-windows2019-py3-pytest"]},"message":"hard-code ami ids","epoch":1597367062,"epoch_utc":1597341862},{"commit":"3332f5e131f223a9fd9fef22437c7830210d301f","author":"krionbsd","author_email":"krion@FreeBSD.org","date":"Thu Jul 30 14:50:44 2020 +0200","commit_by":"Daniel Wozniak","commit_by_email":"dan.woz@gmail.com","commit_by_date":"Thu Aug 27 13:04:37 2020 -0700","stats":{"files_changed":1,"insertions":31,"deletions":36,"files":["tests/unit/test_loader.py"]},"message":"[merge jam] port 53224","epoch":1596145844,"epoch_utc":null}] diff --git a/tests/fixtures/generic/git-log-is-hash-regex-fix.out b/tests/fixtures/generic/git-log-is-hash-regex-fix.out new file mode 100644 index 00000000..4c63ae93 --- /dev/null +++ b/tests/fixtures/generic/git-log-is-hash-regex-fix.out @@ -0,0 +1,124 @@ +commit 6170eac439e590d774eb2e448c68eec90ea3fac0 +Author: Jasper Lievisse Adriaanse +AuthorDate: Fri Jul 3 15:19:49 2020 +0200 +Commit: Daniel Wozniak +CommitDate: Fri Aug 28 12:16:13 2020 -0700 + + Sync OpenBSD installation documentation with reality + + OpenBSD's salt package moved to python3 a while ago and dependencies + have changed since this page was last updated. + + While here tweak a reference to the OpenBSD package, not pkg, repo. + + doc/topics/installation/openbsd.rst | 23 +++++++++++------------ + 1 file changed, 11 insertions(+), 12 deletions(-) + +commit 2d684bd506d473379670ff8905db689d051ff7db +Author: Bryce Larson +AuthorDate: Thu Aug 13 18:04:22 2020 +0000 +Commit: Daniel Wozniak +CommitDate: Fri Aug 28 11:03:45 2020 -0700 + + hard-code ami ids + + .ci/kitchen-amazon2-py3 | 1 + + .ci/kitchen-amazon2-py3-pytest | 1 + + .ci/kitchen-archlts-py3 | 1 + + .ci/kitchen-archlts-py3-pytest | 1 + + .ci/kitchen-centos7-py3 | 1 + + .ci/kitchen-centos7-py3-cloud | 1 + + .ci/kitchen-centos7-py3-cloud-pytest | 1 + + .ci/kitchen-centos7-py3-m2crypto | 1 + + .ci/kitchen-centos7-py3-m2crypto-pytest | 1 + + .ci/kitchen-centos7-py3-proxy | 1 + + .ci/kitchen-centos7-py3-pycryptodome | 1 + + .ci/kitchen-centos7-py3-pycryptodome-pytest | 1 + + .ci/kitchen-centos7-py3-pytest | 1 + + .ci/kitchen-centos7-py3-tcp | 1 + + .ci/kitchen-centos7-py3-tcp-pytest | 1 + + .ci/kitchen-centos8-py3 | 1 + + .ci/kitchen-centos8-py3-pytest | 1 + + .ci/kitchen-debian10-py3 | 1 + + .ci/kitchen-debian10-py3-pytest | 1 + + .ci/kitchen-debian9-py3 | 1 + + .ci/kitchen-debian9-py3-pytest | 1 + + .ci/kitchen-fedora31-py3 | 1 + + .ci/kitchen-fedora31-py3-pytest | 1 + + .ci/kitchen-fedora32-py3 | 1 + + .ci/kitchen-fedora32-py3-pytest | 1 + + .ci/kitchen-opensuse15-py3 | 1 + + .ci/kitchen-opensuse15-py3-pytest | 1 + + .ci/kitchen-ubuntu1604-py3 | 1 + + .ci/kitchen-ubuntu1604-py3-m2crypto | 1 + + .ci/kitchen-ubuntu1604-py3-m2crypto-pytest | 1 + + .ci/kitchen-ubuntu1604-py3-proxy | 1 + + .ci/kitchen-ubuntu1604-py3-pycryptodome | 1 + + .ci/kitchen-ubuntu1604-py3-pycryptodome-pytest | 1 + + .ci/kitchen-ubuntu1604-py3-pytest | 1 + + .ci/kitchen-ubuntu1604-py3-tcp | 1 + + .ci/kitchen-ubuntu1604-py3-tcp-pytest | 1 + + .ci/kitchen-ubuntu1804-py3 | 1 + + .ci/kitchen-ubuntu1804-py3-pytest | 1 + + .ci/kitchen-ubuntu2004-py3 | 1 + + .ci/kitchen-ubuntu2004-py3-pytest | 1 + + .ci/kitchen-windows2016-py3 | 1 + + .ci/kitchen-windows2016-py3-pytest | 1 + + .ci/kitchen-windows2019-py3 | 1 + + .ci/kitchen-windows2019-py3-pytest | 1 + + cicd/jenkins/kitchen-amazon2-py3 | 1 + + cicd/jenkins/kitchen-amazon2-py3-pytest | 1 + + cicd/jenkins/kitchen-archlts-py3 | 1 + + cicd/jenkins/kitchen-archlts-py3-pytest | 1 + + cicd/jenkins/kitchen-centos7-py3 | 1 + + cicd/jenkins/kitchen-centos7-py3-cloud | 1 + + cicd/jenkins/kitchen-centos7-py3-cloud-pytest | 1 + + cicd/jenkins/kitchen-centos7-py3-m2crypto | 1 + + cicd/jenkins/kitchen-centos7-py3-m2crypto-pytest | 1 + + cicd/jenkins/kitchen-centos7-py3-proxy | 1 + + cicd/jenkins/kitchen-centos7-py3-pycryptodome | 1 + + cicd/jenkins/kitchen-centos7-py3-pycryptodome-pytest | 1 + + cicd/jenkins/kitchen-centos7-py3-pytest | 1 + + cicd/jenkins/kitchen-centos7-py3-tcp | 1 + + cicd/jenkins/kitchen-centos7-py3-tcp-pytest | 1 + + cicd/jenkins/kitchen-centos8-py3 | 1 + + cicd/jenkins/kitchen-centos8-py3-pytest | 1 + + cicd/jenkins/kitchen-debian10-py3 | 1 + + cicd/jenkins/kitchen-debian10-py3-pytest | 1 + + cicd/jenkins/kitchen-debian9-py3 | 1 + + cicd/jenkins/kitchen-debian9-py3-pytest | 1 + + cicd/jenkins/kitchen-fedora31-py3 | 1 + + cicd/jenkins/kitchen-fedora31-py3-pytest | 1 + + cicd/jenkins/kitchen-fedora32-py3 | 1 + + cicd/jenkins/kitchen-fedora32-py3-pytest | 1 + + cicd/jenkins/kitchen-opensuse15-py3 | 1 + + cicd/jenkins/kitchen-opensuse15-py3-pytest | 1 + + cicd/jenkins/kitchen-ubuntu1604-py3 | 1 + + cicd/jenkins/kitchen-ubuntu1604-py3-m2crypto | 1 + + cicd/jenkins/kitchen-ubuntu1604-py3-m2crypto-pytest | 1 + + cicd/jenkins/kitchen-ubuntu1604-py3-proxy | 1 + + cicd/jenkins/kitchen-ubuntu1604-py3-pycryptodome | 1 + + cicd/jenkins/kitchen-ubuntu1604-py3-pycryptodome-pytest | 1 + + cicd/jenkins/kitchen-ubuntu1604-py3-pytest | 1 + + cicd/jenkins/kitchen-ubuntu1604-py3-tcp | 1 + + cicd/jenkins/kitchen-ubuntu1604-py3-tcp-pytest | 1 + + cicd/jenkins/kitchen-ubuntu1804-py3 | 1 + + cicd/jenkins/kitchen-ubuntu1804-py3-pytest | 1 + + cicd/jenkins/kitchen-ubuntu2004-py3 | 1 + + cicd/jenkins/kitchen-ubuntu2004-py3-pytest | 1 + + cicd/jenkins/kitchen-windows2016-py3 | 1 + + cicd/jenkins/kitchen-windows2016-py3-pytest | 1 + + cicd/jenkins/kitchen-windows2019-py3 | 1 + + cicd/jenkins/kitchen-windows2019-py3-pytest | 1 + + 88 files changed, 88 insertions(+) + +commit 3332f5e131f223a9fd9fef22437c7830210d301f +Author: krionbsd +AuthorDate: Thu Jul 30 14:50:44 2020 +0200 +Commit: Daniel Wozniak +CommitDate: Thu Aug 27 13:04:37 2020 -0700 + + [merge jam] port 53224 + + tests/unit/test_loader.py | 67 ++++++++++++++++++++++------------------------- + 1 file changed, 31 insertions(+), 36 deletions(-) diff --git a/tests/test_git_log.py b/tests/test_git_log.py index 3a60be16..26f38bc0 100644 --- a/tests/test_git_log.py +++ b/tests/test_git_log.py @@ -58,6 +58,12 @@ class MyTests(unittest.TestCase): with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/git-log-oneline-shortstat.out'), 'r', encoding='utf-8') as f: self.git_log_oneline_shortstat = f.read() + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/git-log-hash-in-message-fix.out'), 'r', encoding='utf-8') as f: + self.git_log_fuller_hash_in_message_fix = f.read() + + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/git-log-is-hash-regex-fix.out'), 'r', encoding='utf-8') as f: + self.git_log_fuller_is_hash_regex_fix = f.read() + # output with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/git-log.json'), 'r', encoding='utf-8') as f: self.git_log_json = json.loads(f.read()) @@ -107,6 +113,12 @@ class MyTests(unittest.TestCase): with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/git-log-oneline-shortstat.json'), 'r', encoding='utf-8') as f: self.git_log_oneline_shortstat_json = json.loads(f.read()) + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/git-log-hash-in-message-fix.json'), 'r', encoding='utf-8') as f: + self.git_log_fuller_hash_in_message_fix_json = json.loads(f.read()) + + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/git-log-is-hash-regex-fix.json'), 'r', encoding='utf-8') as f: + self.git_log_fuller_is_hash_regex_fix_json = json.loads(f.read()) + def test_git_log_nodata(self): """ @@ -210,6 +222,20 @@ class MyTests(unittest.TestCase): """ self.assertEqual(jc.parsers.git_log.parse(self.git_log_oneline_shortstat, quiet=True), self.git_log_oneline_shortstat_json) + def test_git_log_fuller_hash_in_message_fix(self): + """ + Test 'git_log --format=fuller --stat' fix for when a commit message + contains a line that is only a commit hash value. + """ + self.assertEqual(jc.parsers.git_log.parse(self.git_log_fuller_hash_in_message_fix, quiet=True), self.git_log_fuller_hash_in_message_fix_json) + + def test_git_log_fuller_is_hash_fix(self): + """ + Test 'git_log --format=fuller --stat' fix for when a commit message + contains a line that evaluated as true to an older _is_hash regex + """ + self.assertEqual(jc.parsers.git_log.parse(self.git_log_fuller_is_hash_regex_fix, quiet=True), self.git_log_fuller_is_hash_regex_fix_json) + if __name__ == '__main__': unittest.main() diff --git a/tests/test_git_log_s.py b/tests/test_git_log_s.py index 58088b3d..c75855f3 100644 --- a/tests/test_git_log_s.py +++ b/tests/test_git_log_s.py @@ -7,7 +7,7 @@ from jc.exceptions import ParseError THIS_DIR = os.path.dirname(os.path.abspath(__file__)) # To create streaming output use: -# $ cat git_log.out | jc --git-log-s | jello -c > git-log-streaming.json +# $ cat git-log.out | jc --git-log-s | jello -c > git-log-streaming.json class MyTests(unittest.TestCase): @@ -63,6 +63,12 @@ class MyTests(unittest.TestCase): with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/git-log-oneline-shortstat.out'), 'r', encoding='utf-8') as f: self.generic_git_log_oneline_shortstat = f.read() + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/git-log-hash-in-message-fix.out'), 'r', encoding='utf-8') as f: + self.generic_git_log_fuller_hash_in_message_fix = f.read() + + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/git-log-is-hash-regex-fix.out'), 'r', encoding='utf-8') as f: + self.generic_git_log_fuller_is_hash_regex_fix = f.read() + # output with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/git-log-streaming.json'), 'r', encoding='utf-8') as f: self.generic_git_log_streaming_json = json.loads(f.read()) @@ -115,6 +121,12 @@ class MyTests(unittest.TestCase): with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/git-log-streaming-ignore-exceptions.json'), 'r', encoding='utf-8') as f: self.generic_git_log_streaming_ignore_exceptions_json = json.loads(f.read()) + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/git-log-hash-in-message-fix-streaming.json'), 'r', encoding='utf-8') as f: + self.generic_git_log_fuller_hash_in_message_fix_streaming_json = json.loads(f.read()) + + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/git-log-is-hash-regex-fix-streaming.json'), 'r', encoding='utf-8') as f: + self.generic_git_log_fuller_is_hash_regex_fix_streaming_json = json.loads(f.read()) + def test_git_log_s_nodata(self): """ Test 'git_log' with no data @@ -237,6 +249,20 @@ class MyTests(unittest.TestCase): """ self.assertEqual(list(jc.parsers.git_log_s.parse(self.generic_git_log_oneline_shortstat.splitlines(), quiet=True)), self.generic_git_log_oneline_shortstat_streaming_json) + def test_git_log_fuller_hash_in_message_fix(self): + """ + Test 'git_log --format=fuller --stat' fix for when a commit message + contains a line that is only a commit hash value. + """ + self.assertEqual(list(jc.parsers.git_log_s.parse(self.generic_git_log_fuller_hash_in_message_fix.splitlines(), quiet=True)), self.generic_git_log_fuller_hash_in_message_fix_streaming_json) + + def test_git_log_fuller_is_hash_fix(self): + """ + Test 'git_log --format=fuller --stat' fix for when a commit message + contains a line that evaluated as true to an older _is_hash regex + """ + self.assertEqual(list(jc.parsers.git_log_s.parse(self.generic_git_log_fuller_is_hash_regex_fix.splitlines(), quiet=True)), self.generic_git_log_fuller_is_hash_regex_fix_streaming_json) + if __name__ == '__main__': unittest.main()