@@ -6,27 +6,28 @@ detection and parsing of URLs, commanding, and syncing with `git`, `hg`, and `sv
66
77## Overview
88
9- _ Supports Python 3.9 and above _
9+ ### Key Features
1010
11- Features for Git, Subversion, and Mercurial:
11+ - ** URL Detection and Parsing** : Validate and parse Git, Mercurial, and Subversion URLs.
12+ - ** Command Abstraction** : Interact with VCS systems through a Python API.
13+ - ** Repository Synchronization** : Clone and update repositories locally via
14+ Python API.
15+ - ** py.test fixtures** : Create temporary local repositories and working copies for testing for unit tests.
1216
13- - ** Detect and parse** VCS URLs
14- - ** Command** VCS via python API
15- - ** Sync** repos locally
16- - ** Test fixtures** for temporary local repos and working copies
17+ _ Supports Python 3.9 and above, Git (including AWS CodeCommit), Subversion, and Mercurial._
1718
18- To ** get started** , see the [ quickstart] ( https://libvcs.git-pull.com/quickstart.html ) for more.
19+ To ** get started** , see the [ quickstart guide ] ( https://libvcs.git-pull.com/quickstart.html ) for more information .
1920
2021``` console
2122$ pip install --user libvcs
2223```
2324
24- ## URL Parser
25+ ## URL Detection and Parsing
2526
26- You can validate and parse Git, Mercurial, and Subversion URLs through
27- [ ` libvcs.url ` ] ( https://libvcs.git-pull.com/url/index.html ) :
27+ Easily validate and parse VCS URLs using the
28+ [ ` libvcs.url ` ] ( https://libvcs.git-pull.com/url/index.html ) module :
2829
29- Validate:
30+ ### Validate URLs
3031
3132``` python
3233>> > from libvcs.url.git import GitURL
@@ -35,7 +36,7 @@ Validate:
3536True
3637```
3738
38- Parse and adjust a Git URL :
39+ ### Parse and adjust Git URLs :
3940
4041``` python
4142>> > from libvcs.url.git import GitURL
@@ -73,11 +74,11 @@ Switch repo libvcs -> vcspull:
7374
7475See more in the [ parser document] ( https://libvcs.git-pull.com/parse/index.html ) .
7576
76- ## Commands
77+ ## Command Abstraction
7778
78- Simple [ ` subprocess ` ] ( https://docs.python.org/3/library/subprocess.html ) wrappers around ` git(1) ` ,
79- ` hg(1) ` , ` svn(1) ` . Here is [ ` Git ` ] ( https://libvcs.git-pull.com/cmd/git.html#libvcs.cmd.git.Git ) w/
80- [ ` Git.clone ` ] ( http://libvcs.git-pull.com/cmd/git.html#libvcs.cmd.git. Git.clone ) :
79+ Abstracts CLI commands for ` git(1) ` , ` hg(1) ` , ` svn(1) ` via a lightweight [ ` subprocess ` ] ( https://docs.python.org/3/library/subprocess.html ) wrapper.
80+
81+ ### Run Git Commands
8182
8283``` python
8384import pathlib
@@ -87,10 +88,15 @@ git = Git(path=pathlib.Path.cwd() / 'my_git_repo')
8788git.clone(url = ' https://github.com/vcs-python/libvcs.git' )
8889```
8990
90- ## Sync
91+ Above: [ ` libvcs.cmd.git.Git ` ] ( https://libvcs.git-pull.com/cmd/git.html#libvcs.cmd.git.Git ) using
92+ [ ` Git.clone() ` ] ( http://libvcs.git-pull.com/cmd/git.html#libvcs.cmd.git.Git.clone ) .
93+
94+ ## Repository Synchronization
9195
92- Create a [ ` GitSync ` ] ( https://libvcs.git-pull.com/projects/git.html#libvcs.sync.git.GitProject )
93- object of the project to inspect / checkout / update:
96+ Synchronize your repositories using the
97+ [ ` libvcs.sync ` ] ( https://libvcs.git-pull.com/sync/ ) module.
98+
99+ ### Clone and Update Repositories
94100
95101``` python
96102import pathlib
@@ -112,25 +118,29 @@ repo = GitSync(
112118u ' 5c227e6ab4aab44bf097da2e088b0ff947370ab8'
113119```
114120
115- ## Pytest plugin
121+ Above: [ ` libvcs.sync.git.GitSync ` ] ( https://libvcs.git-pull.com/projects/git.html#libvcs.sync.git.GitSync ) repository
122+ object using
123+ [ ` GitSync.update_repo() ` ] ( https://libvcs.git-pull.com/sync/git.html#libvcs.sync.git.GitSync.update_repo )
124+ and
125+ [ ` GitSync.get_revision() ` ] ( https://libvcs.git-pull.com/sync/git.html#libvcs.sync.git.GitSync.get_revision ) .
116126
117- libvcs also provides a test rig for local repositories. It automatically can provide clean local
118- repositories and working copies for git, svn, and mercurial. They are automatically cleaned up after
119- each test.
127+ ## Pytest plugin: Temporary VCS repositories for testing
120128
121- It works by bootstrapping a temporary ` $HOME ` environment in a
122- [ ` TmpPathFactory ` ] ( https://docs.pytest.org/en/7.1.x/reference/reference.html#tmp-path-factory-factory-api )
123- for automatic cleanup.
129+ libvcs [ pytest plugin] ( https://libvcs.git-pull.com/pytest-plugin.html ) provides [ py.test fixtures] to swiftly create local VCS repositories and working repositories to test with. Repositories are automatically cleaned on test teardown.
130+
131+ [ py.test fixtures ] : https://docs.pytest.org/en/8.2.x/explanation/fixtures.html
132+
133+ ### Use temporary, local VCS in py.test
124134
125135``` python
126136import pathlib
127137
128- from libvcs.pytest_plugin import CreateProjectCallbackFixtureProtocol
138+ from libvcs.pytest_plugin import CreateRepoPytestFixtureFn
129139from libvcs.sync.git import GitSync
130140
131141
132142def test_repo_git_remote_checkout (
133- create_git_remote_repo : CreateProjectCallbackFixtureProtocol ,
143+ create_git_remote_repo : CreateRepoPytestFixtureFn ,
134144 tmp_path : pathlib.Path,
135145 projects_path : pathlib.Path,
136146) -> None :
@@ -147,7 +157,9 @@ def test_repo_git_remote_checkout(
147157 assert pathlib.Path(git_repo_checkout_dir / " .git" ).exists()
148158```
149159
150- Learn more on the docs at https://libvcs.git-pull.com/pytest-plugin.html
160+ Under the hood: fixtures bootstrap a temporary ` $HOME ` environment in a
161+ [ ` TmpPathFactory ` ] ( https://docs.pytest.org/en/7.1.x/reference/reference.html#tmp-path-factory-factory-api )
162+ for automatic cleanup and ` pytest-xdist ` compatibility..
151163
152164## Donations
153165
0 commit comments