Skip to main content

Python module to simplify loading of snapshot of git repository

Project description

gitsnapshot

Build Status PyPI version

A simple library to load snapshots of git repository.

Usage

To load git repository call load_repo as follows:

from gitsnapshot import load_repo

load_repo('~/target/directory', 'git@github.com/test/repo')

This code creates folder ~/target/directory if this folder doesn't exists, and then clone shallow copy of repository git@github.com/test/repo. By default this function loads current master branch.

To load another branch (i.e. develop) pass branch name in branch parameter:

from gitsnapshot import load_repo

load_repo('~/target/directory', 'git@github.com/test/repo', branch='develop')

Also you can load snapshot by tag:

from gitsnapshot import load_repo

load_repo('~/target/directory', 'git@github.com/test/repo', tag='v0.1.2')

Or by commit hash:

from gitsnapshot import load_repo

load_repo('~/target/directory', 'git@github.com/test/repo', commit='abcdef')

Errors

load_repo function return optional string with error description. If load_repo returned None then no errors was happened.

Reusing of directory

If you try to load repository snapshot into existing directory with another snapshot of the same repository, load_repo will return error. To avoid this behavior pass use_existing=True as argument.

from gitsnapshot import load_repo

load_repo('~/target/directory', 'git@github.com/test/repo', use_existing=True)

In this case load_repo will load repository index and will checkout to specified branch, tag or commit.

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

gitsnapshot-0.1.2.tar.gz (3.3 kB view details)

Uploaded Source

File details

Details for the file gitsnapshot-0.1.2.tar.gz.

File metadata

  • Download URL: gitsnapshot-0.1.2.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.1

File hashes

Hashes for gitsnapshot-0.1.2.tar.gz
Algorithm Hash digest
SHA256 2c38877f9fb3fe58447c89b34d7623d15afe5950b70716cc530634949fb8dfff
MD5 f5f52803b7f29732c6b0445c87de2614
BLAKE2b-256 3ddbd1d1b100d5bc36a9cf6af43da9b73e84f3ced519e8fda8aea1746f16a26f

See more details on using hashes here.

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