Skip to main content

This python module is a wrapper around git (= the git binary file). It is ment as a simple interface to basic git functionality.

Project description

jk_git

Introduction

This python module is a wrapper around git (= the git binary file). It is ment as a simple interface to basic git functionality.

Information about this module can be found here:

Why this module?

git is an excellent version control system. It is widely used by developers to manage their source code in application development. Unfortunately using this functionality from within Python is a bit difficult as Python modules either don't provide some functionality required or aren't documented sufficiently. This module aims to fill this gap to some extent. Moreover it aims to do that in a way where the API is kept as universal as possible to allow similar support of other version control systems in the future.

Limitations of this module

This Python module does not aim to be a perfect wrapper around git, providing every single feature git provides. Nevertheless the functionality typically used will be covered in the future.

State of development

This module currently provides the following functionality:

  • check if a directory is a git working copy directory
  • retrieve the status: which files need to be committed?

Future versions of this module will provide the following functionality:

  • confirm changes to files in preparation of a commit
  • perform a commit
  • perform a push
  • create tags

How to use this module

Import this module

Please include this module into your application using the following code:

from jk_git import *

Check if a directory is a working copy directory

Sometimes it is convenient to check if a specific directory is a working copy directory:

print(GitWorkingCopy.hasWorkingCopy("/some/dir/....."))

Instantiate a working copy object to work with the working copy

In order to perform operations on the working copy you first have to instantiate an object representing your working copy:

wc = GitWorkingCopy("/some/dir/.....")

Display information about the current working copy

Example:

wc = GitWorkingCopy("/some/dir/.....")

print("Working copy root directory:", wc.rootDir)
print("Working copy is clean:", wc.isClean)
print("Working copy is not clean:", wc.isDirty)
print("Credentials are stored in git configuration:", wc.areCredentialsStored)
print("The upstream repository URL:", wc.remoteOrigin)

Display changes made to the current working copy

wc = GitWorkingCopy("/some/dir/.....")

for f in git.status(bIncludeIgnored=True):
	print("\t", f)

Contact Information

This is Open Source code. That not only gives you the possibility of freely using this code it also allows you to contribute. Feel free to contact the author(s) of this software listed below, either for comments, collaboration requests, suggestions for improvement or reporting bugs:

License

This software is provided under the following license:

  • Apache Software License 2.0

Project details


Download files

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

Files for jk-git, version 0.2020.1.14
Filename, size File type Python version Upload date Hashes
Filename, size jk_git-0.2020.1.14.tar.gz (9.8 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page