Skip to main content

Python GIT tool to check pending changes

Project description

Travis build Coverage Status pypi-version pypi-wheel pypi-format pypi-pyversions pypi-implementation pypi-status

Python GIT tool to check pending changes

gitchecker.check_clean_status() checks if there is any pending changes in GIT repository status and returns the last commit SHA (7 digits length). By default it raises an Exception if there are any pending changes but it can be configured to only show a warning instead.

Install

pip install gitchecker

Demo Usage

import gitchecker
commit_sha = gitchecker.check_clean_status(repo_path="",
                                           warning_instead_of_error=False,
                                           ignore_untracked_files=False,
                                           logger=None)
print("commit", commit_sha)

The displayed values of the parameters are the default ones.

If a logger is provided, it will be used only if it has an error() or warning() method. The required method depends on the value of warning_instead_of_error. If no logger provided or no proper log function exists in logger , print() will be used instead.

Ignoring untracked files (ignore_untracked_files=True) will ignore them completely, not raising errors and not showing warnings.

Testing

Launch: python setup.py test The GIT status must be clean to run functional test.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gitchecker-1.0.1.tar.gz (2.2 kB view hashes)

Uploaded Source

Built Distribution

gitchecker-1.0.1-py3-none-any.whl (2.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page