vcs-python/libvcs
⚙️ Lite, typed, pythonic utilities for git, svn, mercurial, etc.
📦 Commands
- via https://github.com/vcs-python/libvcs/pull/430
- Git
- Support for progress bar
- Add subcommands for:
- stash: [`Git.stash`](https://libvcs.git-pull.com/cmd/git.html#libvcs.cmd.git.Git.stash "libvcs.cmd.git.Git.stash") -> [`libvcs.cmd.git.GitStashCmd`](https://libvcs.git-pull.com/cmd/git.html#libvcs.cmd.git.GitStashCmd "libvcs.cmd.git.GitStashCmd")
- remote: [`Git.remote`](https://libvcs.git-pull.com/cmd/git.html#libvcs.cmd.git.Git.remote "libvcs.cmd.git.Git.remote") -> [`libvcs.cmd.git.GitRemoteCmd`](https://libvcs.git-pull.com/cmd/git.html#libvcs.cmd.git.GitRemoteCmd "libvcs.cmd.git.GitRemoteCmd")
- submodule: [`Git.submodule`](https://libvcs.git-pull.com/cmd/git.html#libvcs.cmd.git.Git.submodule "libvcs.cmd.git.Git.submodule") -> [`libvcs.cmd.git.GitSubmoduleCmd`](https://libvcs.git-pull.com/cmd/git.html#libvcs.cmd.git.GitSubmoduleCmd "libvcs.cmd.git.GitSubmoduleCmd")
- Added commands for:
- + 14 more
📦 Syncing
- via https://github.com/vcs-python/libvcs/pull/430
- Git, SVN, and Mercurial have moved to `libvcs.cmd`
- Full Changelog: https://github.com/vcs-python/libvcs/compare/v0.18.1...v0.19.0
📋 Changes
- Development dependency updatse
- Documentation improvements
📦 URLs: Weighting system for mathers
- By @tony in https://github.com/vcs-python/libvcs/pull/428
- matchers now support `weight`, higher numbers means they'll be checked first. First match is the one picked by extract URL info
- docs: Registry examples
- Full Changelog: https://github.com/vcs-python/libvcs/compare/v0.17.0...v0.18.0
📦 URLs
- URL Detection via vcs-registry:
- All vcspull compatible URLs must have URLs detected by @tony in https://github.com/vcs-python/libvcs/pull/420
- _Unblocks vcspull 1.13.x via https://github.com/vcs-python/vcspull/pull/373_
- URLs: Renaming by @tony in https://github.com/vcs-python/libvcs/pull/417
- `url`: Improvements to parsing URLs by @tony in https://github.com/vcs-python/libvcs/pull/423
📦 Syncing
- fix(git): Fix update_repo when there are untracked files (Take 2) by @jfpedroza in https://github.com/vcs-python/libvcs/pull/425
🧪 Pytest plugin
- feat(pytest_plugin): Allow passing init flags to repo fixtures by @tony in https://github.com/vcs-python/libvcs/pull/426
📦 Meta
- build: Remove .coveragerc, use pyproject.toml by @tony in https://github.com/vcs-python/libvcs/pull/421
✨ New Contributors
- @jfpedroza made their first contribution in https://github.com/vcs-python/libvcs/pull/425
- Full Changelog: https://github.com/vcs-python/libvcs/compare/v0.16.5...v0.17.0
📋 What's Changed
- feat(pytest_plugin): Allow passing init flags to repo fixtures by @tony in https://github.com/vcs-python/libvcs/pull/426
- fix(sync[git]): Fix update_repo when there are untracked files (Take 2) by @jfpedroza in https://github.com/vcs-python/libvcs/pull/425
✨ New Contributors
- @jfpedroza made their first contribution in https://github.com/vcs-python/libvcs/pull/425
- Full Changelog: https://github.com/vcs-python/libvcs/compare/v0.17.0a0...v0.17.0a1
✨ New features
- URLs: Added `registry`, match find which VCS a URL matches with ([](https://github.com/vcs-python/libvcs/issues/420)[#420](https://github.com/vcs-python/libvcs/issues/420))
- `create_project`: Learn to guess VCS from URL, if none provided ([](https://github.com/vcs-python/libvcs/issues/420)[#420](https://github.com/vcs-python/libvcs/issues/420))
💥 Breaking changes
- URL renamings ([](https://github.com/vcs-python/libvcs/issues/417)[#417](https://github.com/vcs-python/libvcs/issues/417)):
- `Matcher` -> `Rule`, `MatcherRegistry` -> `Rules`
- `matches` -> `rule_map`
- `default_patterns` -> `patterns`
- `MATCHERS` -> `RULES`
📦 Improvements[](https://libvcs.git-pull.com/history.html#improvements "Permalink to this heading")
- URLs ([](https://github.com/vcs-python/libvcs/issues/423)[#423](https://github.com/vcs-python/libvcs/issues/423)):
- `hg`: Add `HgBaseURL`, `HgPipURL`
- `svn`: Add `SvnBaseURL`, `SvnPipURL`
- `URLProtocol`: Fix `is_valid` to use `classmethod`
- All: Fix `is_valid` to use default of `None` to avoid implicitly filtering
- Reduce duplicated code in methods by using `super()`
📦 Packaging
- Migrate `.coveragerc` to `pyproject.toml` ([](https://github.com/vcs-python/libvcs/issues/421)[#421](https://github.com/vcs-python/libvcs/issues/421))
- Remove `.tmuxp.before-script.sh` (was a `before_script` in `.tmuxp.yaml`) that was unused.
- Move `conftest.py` to root level
- Can be excluded from wheel, included in sdist
- Required to satisfy pytest's `pytest_plugins` only being in top-level confte conftest.py files since 4.0 (see [notice](https://docs.pytest.org/en/stable/deprecations.html#pytest-plugins-in-non-top-level-conftest-files))
- Makes it possible to run `pytest README.md` with doctest plugin
✨ Automatically added
- URLs: Renaming by @tony in https://github.com/vcs-python/libvcs/pull/417
- build: Remove .coveragerc, use pyproject.toml by @tony in https://github.com/vcs-python/libvcs/pull/421
- `url`: Improvements to parsing URLs by @tony in https://github.com/vcs-python/libvcs/pull/423
- vcs-registry: All vcspull compatible URLs must have URLs detected by @tony in https://github.com/vcs-python/libvcs/pull/420
- Full Changelog: https://github.com/vcs-python/libvcs/compare/v0.16.5...v0.17.0a0
🐛 Fix / compatibility improvement
- Fix typings, use pytest public APIs by @tony in https://github.com/vcs-python/libvcs/pull/418
- Full Changelog: https://github.com/vcs-python/libvcs/compare/v0.16.4...v0.16.5
Bump poetry to v1.2.1 **Full Changelog**: https://github.com/vcs-python/libvcs/compare/v0.16.3...v0.16.4
📋 What's Changed
- QueryList: Test objects by @tony in https://github.com/vcs-python/libvcs/pull/414
- QueryList: Better object handling by @tony in https://github.com/vcs-python/libvcs/pull/415
🧪 Tests
- Tests for pytest plugin by @tony in https://github.com/vcs-python/libvcs/pull/413
📦 CI
- CI: Speed improvements by @tony in https://github.com/vcs-python/libvcs/pull/416
- Full Changelog: https://github.com/vcs-python/libvcs/compare/v0.16.2...v0.16.3
📋 Full list of changes
- Tests for pytest plugin by @tony in https://github.com/vcs-python/libvcs/pull/413
- QueryList: Test objects by @tony in https://github.com/vcs-python/libvcs/pull/414
- QueryList: Better object handling by @tony in https://github.com/vcs-python/libvcs/pull/415
- Full Changelog: https://github.com/vcs-python/libvcs/compare/v0.16.2...v0.16.3a0
refactor(pytest_plugin): Remove faker dependency by @tony in https://github.com/vcs-python/libvcs/pull/412 **Full Changelog**: https://github.com/vcs-python/libvcs/compare/v0.16.1...v0.16.2
Temporarily adds `faker` as a dependency. Follow workaround in #411 **Full Changelog**: https://github.com/vcs-python/libvcs/compare/v0.16.0...v0.16.1
via #409 libvcs now provides a test rig for local repositories. It automatically can provide clean local repositories and working copies for git, svn, and mercurial. They are automatically cleaned up after each test. It works by bootstrapping a temporary `$HOME` environment in a [`TmpPathFactory`](https://docs.pytest.org/en/7.1.x/reference/reference.html#tmp-path-factory-factory-api) for automatic cleanup. ```python import pathlib from libvcs.pytest_plugin import CreateProjectCallbackFixtureProtocol from libvcs.sync.git import GitSync def test_repo_git_remote_checkout( create_git_remote_repo: CreateProjectCallbackFixtureProtocol, tmp_path: pathlib.Path, projects_path: pathlib.Path, ) -> None: git_server = create_git_remote_repo() git_repo_checkout_dir = projects_path / "my_git_checkout" git_repo = GitSync(dir=str(git_repo_checkout_dir), url=f"file://{git_server!s}") git_repo.obtain() git_repo.update_repo() assert git_repo.get_revision() == "initial" assert git_repo_checkout_dir.exists() assert pathlib.Path(git_repo_checkout_dir / ".git").exists() ``` Learn more on the docs at https://libvcs.git-pull.com/pytest-plugin.html **Full Changelog**: https://github.com/vcs-python/libvcs/compare/v0.15.0...v0.16.0
💥 Breaking changes[](https://libvcs.git-pull.com/history.html#breaking-changes "Permalink to this heading")
- Moves ([](https://github.com/vcs-python/libvcs/issues/408)[#408](https://github.com/vcs-python/libvcs/issues/408)):
- `libvcs.parse` -> `libvcs.url`
- `libvcs.projects` -> `libvcs.sync`
- Renames ([](https://github.com/vcs-python/libvcs/issues/408)[#408](https://github.com/vcs-python/libvcs/issues/408)):
- `BaseProject` -> `BaseSync`
- `MercurialProject` -> `HgSync`
- `SubversionProject` -> `SvnSync`
- `GitProject` -> `GitSync`
- + 3 more
📦 Development[](https://libvcs.git-pull.com/history.html#development "Permalink to this heading")
- Remove `.pre-commit-config.yaml`: This can be done less obtrusively via flake8 and having the user run the tools themselves.
- Add [flake8-bugbear](https://github.com/PyCQA/flake8-bugbear) ([](https://github.com/vcs-python/libvcs/issues/379)[#379](https://github.com/vcs-python/libvcs/issues/379))
- Add [flake8-comprehensions](https://github.com/adamchainz/flake8-comprehensions) ([](https://github.com/vcs-python/libvcs/issues/402)[#402](https://github.com/vcs-python/libvcs/issues/402))
📝 Documentation[](https://libvcs.git-pull.com/history.html#documentation "Permalink to this heading")
- Render changelog in [`linkify_issues`](https://gp-libs.git-pull.com/linkify_issues/) (~~[#396](https://github.com/vcs-python/libvcs/issues/396)~~, [](https://github.com/vcs-python/libvcs/issues/403)[#403](https://github.com/vcs-python/libvcs/issues/403))
- Fix Table of contents rendering with sphinx autodoc with [`sphinx_toctree_autodoc_fix`](https://gp-libs.git-pull.com/sphinx_toctree_autodoc_fix/) ([](https://github.com/vcs-python/libvcs/issues/403)[#403](https://github.com/vcs-python/libvcs/issues/403))
- Deprecate `sphinx-autoapi`, per above fixing the table of contents issue ([](https://github.com/vcs-python/libvcs/issues/403)[#403](https://github.com/vcs-python/libvcs/issues/403))
- This also removes the need to workaround autoapi bugs.
📦 PRs (automatically generated)
- Cache poetry by @tony in https://github.com/vcs-python/libvcs/pull/394
- refactor!: Deprecate `which()` in favor of `shutil.which()` by @tony in https://github.com/vcs-python/libvcs/pull/397
- refactor!: Remove `mkdir_p` by @tony in https://github.com/vcs-python/libvcs/pull/399
- build(deps): Add flake8-bugbear by @tony in https://github.com/vcs-python/libvcs/pull/401
- build(deps): Add flake8-comprehensions by @tony in https://github.com/vcs-python/libvcs/pull/402
- Add `gp-libs` by @tony in https://github.com/vcs-python/libvcs/pull/403
- Try to use ToC gist with `sphinx.ext.autoapi` by @tony in https://github.com/vcs-python/libvcs/pull/400
- Move to `src/` layout by @tony in https://github.com/vcs-python/libvcs/pull/407
- + 2 more
📋 Changes
- Moves:
- `libvcs.parse` -> `libvcs.url`
- `libvcs.projects` -> `libvcs.sync`
- Renames:
- `BaseProject` -> `BaseSync`
- `MercurialProject` -> `HgSync`
- `SubversionProject` -> `SvnSync`
- `GitProject` -> `GitSync`
Move to `src/` layout by @tony in https://github.com/vcs-python/libvcs/pull/407 **Full Changelog**: https://github.com/vcs-python/libvcs/compare/v0.15.0a1...v0.15.0a2
📦 Development
- build(deps): Add flake8-bugbear #401
- build(deps): Add flake8-comprehensions #402
📝 Documentation
- Add `gp-libs` ([github](https://github.com/git-pull/gp-libs), [site](https://gp-libs.git-pull.com/), [PyPI](https://pypi.org/project/gp-libs/)) #403
- Render changelog in [linkify_issues](https://gp-libs.git-pull.com/linkify_issues/)
- Fix Table of contents rendering with sphinx autodoc with [sphinx_toctree_autodoc_fix](https://gp-libs.git-pull.com/sphinx_toctree_autodoc_fix/)
- Try to use ToC gist with `sphinx.ext.autoapi` #400
- Full Changelog: https://github.com/vcs-python/libvcs/compare/v0.15.0a0...v0.15.0a1
💥 Breaking changes
- Remove custom internal functions in favor of standard library:
- refactor!: Deprecate `which()` in favor of `shutil.which()` by @tony in #397
- refactor!: Remove `mkdir_p` by @tony in #399
📦 CI / Internal
- Cache poetry by @tony in https://github.com/vcs-python/libvcs/pull/394
- docs: Move to sphinx-autoissues by @tony in https://github.com/vcs-python/libvcs/pull/396
- Full Changelog: https://github.com/vcs-python/libvcs/compare/v0.14.0...v0.15.0a0
✨ What's new[](https://libvcs.git-pull.com/history.html#what-s-new "Permalink to this heading")
- New and improved logo
- Improved typings
- Now [`mypy --strict`](https://mypy.readthedocs.io/en/stable/command_line.html#cmdoption-mypy-strict) compliant ([#390](https://github.com/vcs-python/libvcs/issues/390))
- Parser: Experimental VCS URL parsing added ([#376](https://github.com/vcs-python/libvcs/issues/376), [#381](https://github.com/vcs-python/libvcs/issues/381), [#384](https://github.com/vcs-python/libvcs/issues/384), [#386](https://github.com/vcs-python/libvcs/issues/386)):
- Warning
- APIs are unstable and subject to break until we get it right.
- [`libvcs.parse.git`](https://libvcs.git-pull.com/parse/git.html#module-libvcs.parse.git "libvcs.parse.git")
- [`GitBaseURL`](https://libvcs.git-pull.com/parse/git.html#libvcs.parse.git.GitBaseURL "libvcs.parse.git.GitBaseURL") - Parse git URLs, `git(1)` compatible
- + 12 more
💥 Breaking changes[](https://libvcs.git-pull.com/history.html#breaking-changes "Permalink to this heading")
- [#391](https://github.com/vcs-python/libvcs/issues/391) Removed `flat` keyword argument for [`libvcs.projects.git.GitProject`](https://libvcs.git-pull.com/projects/git.html#libvcs.projects.git.GitProject "libvcs.projects.git.GitProject"). This was unused and the equivalent can be retrieved via `.to_dict()` on `GitRemote`
- [#379](https://github.com/vcs-python/libvcs/issues/379) Support for `git+git` URLs removed. Pip removed these in 21.0 due to them being insecure [[1]](https://libvcs.git-pull.com/history.html#pip-git-git)
- [#372](https://github.com/vcs-python/libvcs/issues/372) Typings moved from `libvcs.types` -> [`libvcs._internal.types`](https://libvcs.git-pull.com/internals/types.html#module-libvcs._internal.types "libvcs._internal.types")
- [#377](https://github.com/vcs-python/libvcs/issues/377) Remove deprecated functions and exceptions
- Removed `libvcs.shortcuts`
- Removed `libvcs.shortcuts.create_project_from_pip_url()`: This will be replaced in future versions by [#376](https://github.com/vcs-python/libvcs/issues/376) / parsing utilities
- Moved `libvcs.shortcuts.create_project()` to [`libvcs._internal.shortcuts.create_project()`](https://libvcs.git-pull.com/internals/shortcuts.html#libvcs._internal.shortcuts.create_project "libvcs._internal.shortcuts.create_project")
- Removed `libvcs.exc.InvalidPipURL`
🐛 Fixes[](https://libvcs.git-pull.com/history.html#fixes "Permalink to this heading")
- Minor spelling fix in Git's `convert_pip_url()` exception
- Fix mercurial cloning in [`libvcs.projects.hg.MercurialProject`](https://libvcs.git-pull.com/projects/hg.html#libvcs.projects.hg.MercurialProject "libvcs.projects.hg.MercurialProject")
- _Backport from 0.13.1_
📦 Typings[](https://libvcs.git-pull.com/history.html#typings "Permalink to this heading")
- Rename `VcsLiteral` -> `VCSLiteral`
- _Backport from 0.13.4_
- `create_project()`: Add overloads that return the typed project (e.g. [`GitProject`](https://libvcs.git-pull.com/projects/git.html#libvcs.projects.git.GitProject "libvcs.projects.git.GitProject"))
- _Backport from 0.13.3_
📦 Cleanup[](https://libvcs.git-pull.com/history.html#cleanup "Permalink to this heading")
- [#378](https://github.com/vcs-python/libvcs/issues/378) [#380](https://github.com/vcs-python/libvcs/issues/380) Remove duplicate `uses_netloc` scheme for `git+ssh` (this was in cpython since 2.7 / 3.1 [[2]](https://libvcs.git-pull.com/history.html#git-ssh)[[3]](https://libvcs.git-pull.com/history.html#python-bugs-8657))
📦 Autogenerated
- refactor(types): Move to `_internals` by @tony in https://github.com/vcs-python/libvcs/pull/372
- Remove 0.14.x deprecations by @tony in https://github.com/vcs-python/libvcs/pull/377
- chore(git): Remove `uses_netloc` for `git+ssh`, already in cpython by @tony in https://github.com/vcs-python/libvcs/pull/378
- chore!(git): Remove insecure `git+git` support by @tony in https://github.com/vcs-python/libvcs/pull/379
- chore(git): Remove another already supported netloc scheme ('git') by @tony in https://github.com/vcs-python/libvcs/pull/380
- Parsing / detection and location by @tony in https://github.com/vcs-python/libvcs/pull/376
- Parsing tests by @tony in https://github.com/vcs-python/libvcs/pull/381
- Parser: Improvements, tests by @tony in https://github.com/vcs-python/libvcs/pull/384
- + 5 more
📋 What's Changed
- Strict mypy by @tony in https://github.com/vcs-python/libvcs/pull/390
- Full Changelog: https://github.com/vcs-python/libvcs/compare/v0.14.0a7...v0.14.0a8
📋 What's Changed
- refactor!(projects[git]): Remove `flat=True` keyword argument by @tony in https://github.com/vcs-python/libvcs/pull/391
- Full Changelog: https://github.com/vcs-python/libvcs/compare/v0.14.0a6...v0.14.0a7
🐛 Parser fixes (#386)
- Git scp-style URLs: Fix detection detect of scp style URLs with `.git` prefixes
- Fix critical bug where `matchers` were being applied as variable not annotations
- Fix `pattern_defaults`
- Base tests: Rename `Location` to `URL`
- Tests and modules: Rename `_location` to `_url`
📦 Automated
- Parser: Support explicit matchers, critical bug fixes by @tony in https://github.com/vcs-python/libvcs/pull/386
- Full Changelog: https://github.com/vcs-python/libvcs/compare/v0.14.0a5...v0.14.0a6
✨ What's new
- Parser improvements (#384)
- [`libvcs.parse.git`](https://libvcs.git-pull.com/parse/git.html#module-libvcs.parse.git)
- [`GitBaseURL`](https://libvcs.git-pull.com/parse/git.html#libvcs.parse.git.GitBaseURL) - Parse git URLs, git(1) compatible
- [`is_valid()`](https://libvcs.git-pull.com/parse/git.html#libvcs.parse.git.GitBaseURL.is_valid)
- [`to_url()`](https://libvcs.git-pull.com/parse/git.html#libvcs.parse.git.GitBaseURL.to_url) - export git clone-compatible URL
- [`GitPipURL`](https://libvcs.git-pull.com/parse/git.html#libvcs.parse.git.GitPipURL) - Pip URLs, [`is_valid()`](https://libvcs.git-pull.com/parse/git.html#libvcs.parse.git.GitPipURL.is_valid), [`to_url()`](https://libvcs.git-pull.com/parse/git.html#libvcs.parse.git.GitPipURL.to_url)
- [`GitURL`](https://libvcs.git-pull.com/parse/git.html#libvcs.parse.git.GitURL) - Compatibility focused, [`is_valid()`](https://libvcs.git-pull.com/parse/git.html#libvcs.parse.git.GitURL.is_valid) [`to_url()`](https://libvcs.git-pull.com/parse/git.html#libvcs.parse.git.GitURL.to_url)
📦 Automated
- Parser: Improvements, tests by @tony in https://github.com/vcs-python/libvcs/pull/384
- Full Changelog: https://github.com/vcs-python/libvcs/compare/v0.14.0a4...v0.14.0a5
📋 Changes
- Fixes
- doctests
- Add pytest modules
📦 Autogenerated
- Parsing tests by @tony in https://github.com/vcs-python/libvcs/pull/381
- Full Changelog: https://github.com/vcs-python/libvcs/compare/v0.14.0a3...v0.14.0a4
✨ Parser: Experimental VCS URL parsing added (#376):
- Warning
- APIs are unstable and subject to break until we get it right.
- [`libvcs.parse.git`](https://libvcs.git-pull.com/parse/git.html#module-libvcs.parse.git)
- [`GitURL`](https://libvcs.git-pull.com/parse/git.html#libvcs.parse.git.GitURL) - Parse git URLs
- [`is_valid()`](https://libvcs.git-pull.com/parse/git.html#libvcs.parse.git.GitURL.is_valid)
- [`to_url()`](https://libvcs.git-pull.com/parse/git.html#libvcs.parse.git.GitURL.to_url) - export git clone-compatible URL
- [`libvcs.parse.hg`](https://libvcs.git-pull.com/parse/hg.html#module-libvcs.parse.hg)
- [`HgURL`](https://libvcs.git-pull.com/parse/hg.html#libvcs.parse.hg.HgURL) - Parse Mercurial URLs
- + 6 more
📦 Autogenerated
- Parsing / detection and location by @tony in https://github.com/vcs-python/libvcs/pull/376
- Full Changelog: https://github.com/vcs-python/libvcs/compare/v0.14.0a2...v0.14.0a3
📋 What's Changed
- chore(git): Remove `uses_netloc` for `git+ssh`, already in cpython by @tony in https://github.com/vcs-python/libvcs/pull/378
- chore!(git): Remove insecure `git+git` support by @tony in https://github.com/vcs-python/libvcs/pull/379
- chore(git): Remove another already supported netloc scheme ('git') by @tony in https://github.com/vcs-python/libvcs/pull/380
- Full Changelog: https://github.com/vcs-python/libvcs/compare/v0.14.0a1...v0.14.0a2
📋 Changes
- https://github.com/vcs-python/libvcs/pull/377 Removed `libvcs.shortcuts`
- Removed `libvcs.shortcuts.create_project_from_pip_url()`: This will be replaced in future versions by https://github.com/vcs-python/libvcs/issues/376 / parsing utilities
- Moved `libvcs.shortcuts.create_project()` to [`libvcs._internal.shortcuts.create_project()`](http://localhost:8064/internals/shortcuts.html#libvcs._internal.shortcuts.create_project)
- Removed `libvcs.exc.InvalidPipURL`
📋 Changes
- refactor(types): Move to _internals by @tony in https://github.com/vcs-python/libvcs/pull/372
📋 Changes
- Rename VcsLiteral -> VCSLiteral
`libvcs.shortcuts.create_project`: Add overloads that return the typed project (e.g. `libvcs.projects.git.GitProject`) **Full Changelog**: https://github.com/vcs-python/libvcs/compare/v0.13.2...v0.13.3
