Lite, typed, python utilities for git, svn, mercurial, etc.
Project description
libvcs
·
libvcs is a lite, typed, pythonic tool box for
detection and parsing of URLs, commanding, and syncing with git
, hg
, and svn
. Powers
vcspull.
Overview
Features for git, Subversion, and Mercurial:
- Detect and parse VCS URLs
- Command VCS via python API
- Sync repos locally
To get started, see the quickstart for more.
$ pip install --user libvcs
URL Parsing (experimental)
You can validate and parse git, Mercurial, and Subversion URLs through
libvcs.parse
:
Validate:
>>> from libvcs.parse.git import GitUrl
>>> GitURL.is_valid(url='https://github.com/vcs-python/libvcs.git')
True
Parse and adjust a git url:
from libvcs.parse.git import GitUrl
>>> git_location = GitURL(url='git@github.com:vcs-python/libvcs.git')
>>> git_location
GitURL(url=git@github.com:vcs-python/libvcs.git,
hostname=github.com,
path=vcs-python/libvcs,
user=git,
suffix=.git,
matcher=core-git-scp)
Switch repo libvcs -> vcspull:
>>> git_location.path = 'vcs-python/vcspull'
>>> git_location.to_url()
'git@github.com:vcs-python/vcspull.git'
# Switch them to gitlab:
>>> git_location.hostname = 'gitlab.com'
# Export to a `git clone` compatible URL.
>>> git_location.to_url()
'git@gitlab.com:vcs-python/vcspull.git'
See more in the parser document.
Commands (experimental)
Simple subprocess
wrappers around git(1)
,
hg(1)
, svn(1)
. Here is Git
w/
Git.clone
:
import pathlib
from libvcs.cmd.git import Git
git = Git(dir=pathlib.Path.cwd() / 'my_git_repo')
git.clone(url='https://github.com/vcs-python/libvcs.git')
Projects
Create a
GitProject
object
of the project to inspect / checkout / update:
import pathlib
from libvcs.projects.git import GitProject
repo = GitProject(
url="https://github.com/vcs-python/libvcs",
dir=pathlib.Path().cwd() / "my_repo",
remotes={
'gitlab': 'https://gitlab.com/vcs-python/libvcs'
}
)
Update / clone repo:
>>> r.update_repo()
Get revision:
>>> r.get_revision()
u'5c227e6ab4aab44bf097da2e088b0ff947370ab8'
Donations
Your donations fund development of new features, testing and support. Your money will go directly to maintenance and development of the project. If you are an individual, feel free to give whatever feels right for the value you get out of the project.
See donation options at https://www.git-pull.com/support.html.
More information
- Python support: 3.9+, pypy
- VCS supported: git(1), svn(1), hg(1)
- Source: https://github.com/vcs-python/libvcs
- Docs: https://libvcs.git-pull.com
- Changelog: https://libvcs.git-pull.com/history.html
- API:
libvcs.cmd
: Commandslibvcs.projects
: High-level synchronization commands
- Issues: https://github.com/vcs-python/libvcs/issues
- Test Coverage: https://codecov.io/gh/vcs-python/libvcs
- pypi: https://pypi-hypernode.com/pypi/libvcs
- Open Hub: https://www.openhub.net/p/libvcs
- License: MIT.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file libvcs-0.14.0a3.tar.gz
.
File metadata
- Download URL: libvcs-0.14.0a3.tar.gz
- Upload date:
- Size: 51.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 182598ed3b605c1d30f31fe607c00844b4bcbed85780470615a43d2fed8d2a3b |
|
MD5 | c6d761714a360124f18682818f0fbb6d |
|
BLAKE2b-256 | b2397ed08044a6c2bc87b1ce1bcf2c345424fc919349b61e5de23aba1b55b540 |
Provenance
File details
Details for the file libvcs-0.14.0a3-py3-none-any.whl
.
File metadata
- Download URL: libvcs-0.14.0a3-py3-none-any.whl
- Upload date:
- Size: 51.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bbe80021107f3813d95b10c2dbc5994ced49a1d7c12720230cc68850328d6c75 |
|
MD5 | 9013dba94e73683f73410cef05ccb937 |
|
BLAKE2b-256 | 76c0c143e1530614d4f9c3de62d7297d3eb688fd79923797d0e538fe54e220a3 |