Downloading source control URIs with Blah
Saturday 13 October 2012 16:00
Blah is a little Python library that allows source control URIs to be downloaded into a local directory:
import blah
blah.fetch("git+https://github.com/mwilliamson/blah.git", "/tmp/blah")
print open("/tmp/blah/README.md").read()
It can also be used as a script:
blah fetch git+https://github.com/mwilliamson/blah.git /tmp/blah
The format of the URI is the name of the VCS (version control system), then a plus character, and then the URL of the repository. Optionally, you can include a specific revision by appending a hash and an identifier for a specific revision:
blah.fetch("git+https://github.com/mwilliamson/blah.git#74d69b4", "/tmp/blah")
At the moment, only Git and Mercurial (hg) are supported. If you want to give it a whirl, you can grab it off PyPI:
$ pip install blah
Topics: Python