Skip to content

Python module to simplify loading of snapshot of git repository

License

Notifications You must be signed in to change notification settings

Rohithzr/gitsnapshot

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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', '[email protected]/test/repo')

This code creates folder ~/target/directory if this folder doesn't exists, and then clone shallow copy of repository [email protected]/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', '[email protected]/test/repo', branch='develop')

Also you can load snapshot by tag:

from gitsnapshot import load_repo

load_repo('~/target/directory', '[email protected]/test/repo', tag='v0.1.2')

Or by commit hash:

from gitsnapshot import load_repo

load_repo('~/target/directory', '[email protected]/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', '[email protected]/test/repo', use_existing=True)

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

About

Python module to simplify loading of snapshot of git repository

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%