fastgit 0.1.3__tar.gz → 0.1.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {fastgit-0.1.3/fastgit.egg-info → fastgit-0.1.5}/PKG-INFO +14 -8
- fastgit-0.1.5/README.md +90 -0
- fastgit-0.1.5/fastgit/__init__.py +9 -0
- {fastgit-0.1.3 → fastgit-0.1.5}/fastgit/_modidx.py +1 -0
- {fastgit-0.1.3 → fastgit-0.1.5}/fastgit/core.py +19 -9
- {fastgit-0.1.3 → fastgit-0.1.5/fastgit.egg-info}/PKG-INFO +14 -8
- {fastgit-0.1.3 → fastgit-0.1.5}/fastgit.egg-info/SOURCES.txt +0 -1
- {fastgit-0.1.3 → fastgit-0.1.5}/pyproject.toml +2 -2
- fastgit-0.1.3/MANIFEST.in +0 -5
- fastgit-0.1.3/README.md +0 -84
- fastgit-0.1.3/fastgit/__init__.py +0 -9
- {fastgit-0.1.3 → fastgit-0.1.5}/LICENSE +0 -0
- {fastgit-0.1.3 → fastgit-0.1.5}/fastgit.egg-info/dependency_links.txt +0 -0
- {fastgit-0.1.3 → fastgit-0.1.5}/fastgit.egg-info/entry_points.txt +0 -0
- {fastgit-0.1.3 → fastgit-0.1.5}/fastgit.egg-info/requires.txt +0 -0
- {fastgit-0.1.3 → fastgit-0.1.5}/fastgit.egg-info/top_level.txt +0 -0
- {fastgit-0.1.3 → fastgit-0.1.5}/setup.cfg +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fastgit
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.5
|
|
4
4
|
Summary: Use git from python, fast
|
|
5
5
|
Author-email: Jeremy Howard <github@jhoward.fastmail.fm>
|
|
6
|
-
License: Apache-2.0
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
7
|
Project-URL: Repository, https://github.com/AnswerDotAI/fastgit
|
|
8
8
|
Project-URL: Documentation, https://AnswerDotAI.github.io/fastgit
|
|
9
9
|
Keywords: nbdev,jupyter,notebook,python
|
|
@@ -23,9 +23,9 @@ Dynamic: license-file
|
|
|
23
23
|
|
|
24
24
|
<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
|
|
25
25
|
|
|
26
|
-
`fastgit` is a
|
|
26
|
+
`fastgit` is a Python wrapper for the `git` command line, for use in scripts and interactive sessions. You call git subcommands as Python methods and pass options as keyword arguments.
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
Commands run through the installed `git` executable and return its text output. There is no separate object model for repositories and commits. Both synchronous and asynchronous clients are available.
|
|
29
29
|
|
|
30
30
|
## Usage
|
|
31
31
|
|
|
@@ -39,7 +39,7 @@ $ pip install fastgit
|
|
|
39
39
|
|
|
40
40
|
### How to use
|
|
41
41
|
|
|
42
|
-
Create a [`Git`](https://AnswerDotAI.github.io/fastgit/core.html#git) for
|
|
42
|
+
Create a [`Git`](https://AnswerDotAI.github.io/fastgit/core.html#git) object for the directory you want to work in. Every command runs in that directory. The default local runner expands `~` and resolves relative paths. A custom `runner` receives the supplied directory unchanged. Results have leading and trailing whitespace stripped:
|
|
43
43
|
|
|
44
44
|
``` python
|
|
45
45
|
import shutil, tempfile
|
|
@@ -61,7 +61,11 @@ g.commit(m='add .gitignore')
|
|
|
61
61
|
|
|
62
62
|
'[main (root-commit) 5113ce1] add .gitignore\n 1 file changed, 1 insertion(+)\n create mode 100644 .gitignore'
|
|
63
63
|
|
|
64
|
-
Keyword arguments become
|
|
64
|
+
Keyword arguments become command-line options:
|
|
65
|
+
|
|
66
|
+
- Single-letter names produce short options, such as `n=1` for `-n 1`.
|
|
67
|
+
- Longer names produce long options, with underscores replaced by dashes.
|
|
68
|
+
- A value of `True` passes the flag without a value.
|
|
65
69
|
|
|
66
70
|
``` python
|
|
67
71
|
g.log(n=1, oneline=True)
|
|
@@ -85,7 +89,9 @@ g.current_branch, g.commits
|
|
|
85
89
|
|
|
86
90
|
('main', ['5113ce1 add .gitignore'])
|
|
87
91
|
|
|
88
|
-
A failed command prints git’s message and returns `None
|
|
92
|
+
Command output is returned in a `str` subclass with the exit code in `.returncode`. A failed command prints git’s message and returns `None`. Pass `raise_exc=True` to raise an exception instead. You can set this per call or when creating the client.
|
|
93
|
+
|
|
94
|
+
Some git commands use exit code 1 for a negative result. For example, `grep` returns 1 when nothing matches. fastgit returns the output for these results without treating them as failures:
|
|
89
95
|
|
|
90
96
|
``` python
|
|
91
97
|
res = g.grep('missing')
|
|
@@ -94,7 +100,7 @@ res.returncode
|
|
|
94
100
|
|
|
95
101
|
1
|
|
96
102
|
|
|
97
|
-
Pass `sync=False` for an async client
|
|
103
|
+
Pass `sync=False` for an async client. Its commands and properties return awaitables. Waiting for git does not block the event loop:
|
|
98
104
|
|
|
99
105
|
``` python
|
|
100
106
|
ag = Git(td, sync=False)
|
fastgit-0.1.5/README.md
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# fastgit
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
|
|
5
|
+
|
|
6
|
+
`fastgit` is a Python wrapper for the `git` command line, for use in scripts and interactive sessions. You call git subcommands as Python methods and pass options as keyword arguments.
|
|
7
|
+
|
|
8
|
+
Commands run through the installed `git` executable and return its text output. There is no separate object model for repositories and commits. Both synchronous and asynchronous clients are available.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
### Installation
|
|
13
|
+
|
|
14
|
+
Install latest from [pypi](https://pypi.org/project/fastgit/)
|
|
15
|
+
|
|
16
|
+
``` sh
|
|
17
|
+
$ pip install fastgit
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### How to use
|
|
21
|
+
|
|
22
|
+
Create a [`Git`](https://AnswerDotAI.github.io/fastgit/core.html#git) object for the directory you want to work in. Every command runs in that directory. The default local runner expands `~` and resolves relative paths. A custom `runner` receives the supplied directory unchanged. Results have leading and trailing whitespace stripped:
|
|
23
|
+
|
|
24
|
+
``` python
|
|
25
|
+
import shutil, tempfile
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
``` python
|
|
29
|
+
td = tempfile.mkdtemp()
|
|
30
|
+
g = Git(td)
|
|
31
|
+
g.init(b='main')
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
'Initialized empty Git repository in /private/var/folders/51/b2_szf2945n072c0vj2cyty40000gn/T/tmp8zyj76q7/.git/'
|
|
35
|
+
|
|
36
|
+
``` python
|
|
37
|
+
(g.d/'.gitignore').mk_write('*.bak')
|
|
38
|
+
g.add('.gitignore')
|
|
39
|
+
g.commit(m='add .gitignore')
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
'[main (root-commit) 5113ce1] add .gitignore\n 1 file changed, 1 insertion(+)\n create mode 100644 .gitignore'
|
|
43
|
+
|
|
44
|
+
Keyword arguments become command-line options:
|
|
45
|
+
|
|
46
|
+
- Single-letter names produce short options, such as `n=1` for `-n 1`.
|
|
47
|
+
- Longer names produce long options, with underscores replaced by dashes.
|
|
48
|
+
- A value of `True` passes the flag without a value.
|
|
49
|
+
|
|
50
|
+
``` python
|
|
51
|
+
g.log(n=1, oneline=True)
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
'5113ce1 add .gitignore'
|
|
55
|
+
|
|
56
|
+
You can also pass path arguments after `--` using the `__` parameter:
|
|
57
|
+
|
|
58
|
+
``` python
|
|
59
|
+
g.log('--oneline', __=['.gitignore'])
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
'5113ce1 add .gitignore'
|
|
63
|
+
|
|
64
|
+
Frequent queries are properties:
|
|
65
|
+
|
|
66
|
+
``` python
|
|
67
|
+
g.current_branch, g.commits
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
('main', ['5113ce1 add .gitignore'])
|
|
71
|
+
|
|
72
|
+
Command output is returned in a `str` subclass with the exit code in `.returncode`. A failed command prints git’s message and returns `None`. Pass `raise_exc=True` to raise an exception instead. You can set this per call or when creating the client.
|
|
73
|
+
|
|
74
|
+
Some git commands use exit code 1 for a negative result. For example, `grep` returns 1 when nothing matches. fastgit returns the output for these results without treating them as failures:
|
|
75
|
+
|
|
76
|
+
``` python
|
|
77
|
+
res = g.grep('missing')
|
|
78
|
+
res.returncode
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
1
|
|
82
|
+
|
|
83
|
+
Pass `sync=False` for an async client. Its commands and properties return awaitables. Waiting for git does not block the event loop:
|
|
84
|
+
|
|
85
|
+
``` python
|
|
86
|
+
ag = Git(td, sync=False)
|
|
87
|
+
await ag.last_commit
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
'add .gitignore'
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"""Use git from python, fast
|
|
2
|
+
|
|
3
|
+
`fastgit` is a Python wrapper for the `git` command line, for use in scripts and interactive sessions. You call git subcommands as Python methods and pass options as keyword arguments.
|
|
4
|
+
|
|
5
|
+
Commands run through the installed `git` executable and return its text output. There is no separate object model for repositories and commits. Both synchronous and asynchronous clients are available."""
|
|
6
|
+
|
|
7
|
+
__version__ = "0.1.5"
|
|
8
|
+
|
|
9
|
+
from .core import *
|
|
@@ -20,6 +20,7 @@ d = { 'settings': { 'branch': 'main',
|
|
|
20
20
|
'fastgit.core.Git.top': ('core.html#git.top', 'fastgit/core.py'),
|
|
21
21
|
'fastgit.core.GitRes': ('core.html#gitres', 'fastgit/core.py'),
|
|
22
22
|
'fastgit.core.GitRes.__new__': ('core.html#gitres.__new__', 'fastgit/core.py'),
|
|
23
|
+
'fastgit.core.GitRes.__repr__': ('core.html#gitres.__repr__', 'fastgit/core.py'),
|
|
23
24
|
'fastgit.core._arunlocal': ('core.html#_arunlocal', 'fastgit/core.py'),
|
|
24
25
|
'fastgit.core._depr_uname': ('core.html#_depr_uname', 'fastgit/core.py'),
|
|
25
26
|
'fastgit.core._gitcmd': ('core.html#_gitcmd', 'fastgit/core.py'),
|
|
@@ -18,12 +18,14 @@ from functools import cache
|
|
|
18
18
|
_ok1 = {'merge-tree','merge-base','grep','check-ignore','diff','diff-index','diff-files','diff-tree','show-ref','config','rev-parse'}
|
|
19
19
|
|
|
20
20
|
class GitRes(str):
|
|
21
|
-
"Git output `
|
|
22
|
-
def __new__(cls,
|
|
23
|
-
self = super().__new__(cls,
|
|
24
|
-
self.returncode = returncode
|
|
21
|
+
"Git output text for display, with raw `stdout`, `stderr` and `returncode`"
|
|
22
|
+
def __new__(cls, stdout, stderr, returncode=0):
|
|
23
|
+
self = super().__new__(cls, (stdout + stderr).strip())
|
|
24
|
+
self.stdout,self.stderr,self.returncode = stdout,stderr,returncode
|
|
25
25
|
return self
|
|
26
26
|
|
|
27
|
+
def __repr__(self): return str(self)
|
|
28
|
+
|
|
27
29
|
# %% ../nbs/00_core.ipynb #e4c0a290
|
|
28
30
|
def _gitcmd(path, *args, pre=None):
|
|
29
31
|
cmd = ['git', '-C', str(Path(path).expanduser().resolve())] + list(args)
|
|
@@ -38,7 +40,7 @@ def _depr_uname(uname, pre):
|
|
|
38
40
|
def _gitres(args, out, err, returncode, ok_exit):
|
|
39
41
|
if ok_exit is None: ok_exit = 1 if args and args[0] in _ok1 else 0
|
|
40
42
|
if returncode not in (0, *listify(ok_exit)): raise CalledProcessError(returncode, ['git', *args], out, err)
|
|
41
|
-
return GitRes(
|
|
43
|
+
return GitRes(out, err, returncode)
|
|
42
44
|
|
|
43
45
|
def _runlocal(path, args, pre=None):
|
|
44
46
|
"Default runner: compose the local argv and run it in a subprocess"
|
|
@@ -53,7 +55,7 @@ def callgit(
|
|
|
53
55
|
ok_exit=None, # Extra accepted exit codes (default: 1 for `_ok1` commands)
|
|
54
56
|
runner=None, # Replaces the local subprocess: `(path, args, pre) -> (stdout, stderr, returncode)`
|
|
55
57
|
):
|
|
56
|
-
"Run git in `path
|
|
58
|
+
"Run git in `path`; its `GitRes` displays stripped output and retains raw stdout/stderr"
|
|
57
59
|
out,err,rc = (runner or _runlocal)(path, list(args), pre=_depr_uname(uname, pre))
|
|
58
60
|
return _gitres(args, out, err, rc, ok_exit)
|
|
59
61
|
|
|
@@ -73,9 +75,17 @@ def _longopts(cmd):
|
|
|
73
75
|
# %% ../nbs/00_core.ipynb #97f78839
|
|
74
76
|
class Git:
|
|
75
77
|
"Run git commands in dir `d`; `sync=False` makes every command return an awaitable"
|
|
76
|
-
def __init__(self, d, pre=None, raise_exc=False, sync=True, runner=None): self.d,self.pre,self.raise_exc,self._sync,self.runner = Path(d)
|
|
77
|
-
|
|
78
|
-
def __call__(self,
|
|
78
|
+
def __init__(self, d, pre=None, raise_exc=False, sync=True, runner=None): self.d,self.pre,self.raise_exc,self._sync,self.runner = Path(d),pre,raise_exc,sync,runner
|
|
79
|
+
|
|
80
|
+
def __call__(self,
|
|
81
|
+
cmd, # git subcommand to run
|
|
82
|
+
*args, # Positional arguments for the subcommand
|
|
83
|
+
mute_errors=False, # Suppress the printed ERROR line on failure?
|
|
84
|
+
raise_exc=None, # Raise `CalledProcessError` on failure? (default: `self.raise_exc`)
|
|
85
|
+
ok_exit=None, # Extra accepted exit codes (default: 1 for commands like `diff` where it isn't an error)
|
|
86
|
+
**kwargs # Become flags: short keys as `-k v`, long as `--key=v` (`_` to `-`; `True` bare, `False` dropped); `__` passes paths after `--`
|
|
87
|
+
):
|
|
88
|
+
"Run `git cmd` in `self.d`, returning a `GitRes` (or an awaitable of one when `sync=False`)"
|
|
79
89
|
paths = [str(p) for p in listify(kwargs.pop('__', None) or [])]
|
|
80
90
|
args = listify(args)
|
|
81
91
|
kwargs = {k:v for k,v in kwargs.items() if v is not False}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fastgit
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.5
|
|
4
4
|
Summary: Use git from python, fast
|
|
5
5
|
Author-email: Jeremy Howard <github@jhoward.fastmail.fm>
|
|
6
|
-
License: Apache-2.0
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
7
|
Project-URL: Repository, https://github.com/AnswerDotAI/fastgit
|
|
8
8
|
Project-URL: Documentation, https://AnswerDotAI.github.io/fastgit
|
|
9
9
|
Keywords: nbdev,jupyter,notebook,python
|
|
@@ -23,9 +23,9 @@ Dynamic: license-file
|
|
|
23
23
|
|
|
24
24
|
<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
|
|
25
25
|
|
|
26
|
-
`fastgit` is a
|
|
26
|
+
`fastgit` is a Python wrapper for the `git` command line, for use in scripts and interactive sessions. You call git subcommands as Python methods and pass options as keyword arguments.
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
Commands run through the installed `git` executable and return its text output. There is no separate object model for repositories and commits. Both synchronous and asynchronous clients are available.
|
|
29
29
|
|
|
30
30
|
## Usage
|
|
31
31
|
|
|
@@ -39,7 +39,7 @@ $ pip install fastgit
|
|
|
39
39
|
|
|
40
40
|
### How to use
|
|
41
41
|
|
|
42
|
-
Create a [`Git`](https://AnswerDotAI.github.io/fastgit/core.html#git) for
|
|
42
|
+
Create a [`Git`](https://AnswerDotAI.github.io/fastgit/core.html#git) object for the directory you want to work in. Every command runs in that directory. The default local runner expands `~` and resolves relative paths. A custom `runner` receives the supplied directory unchanged. Results have leading and trailing whitespace stripped:
|
|
43
43
|
|
|
44
44
|
``` python
|
|
45
45
|
import shutil, tempfile
|
|
@@ -61,7 +61,11 @@ g.commit(m='add .gitignore')
|
|
|
61
61
|
|
|
62
62
|
'[main (root-commit) 5113ce1] add .gitignore\n 1 file changed, 1 insertion(+)\n create mode 100644 .gitignore'
|
|
63
63
|
|
|
64
|
-
Keyword arguments become
|
|
64
|
+
Keyword arguments become command-line options:
|
|
65
|
+
|
|
66
|
+
- Single-letter names produce short options, such as `n=1` for `-n 1`.
|
|
67
|
+
- Longer names produce long options, with underscores replaced by dashes.
|
|
68
|
+
- A value of `True` passes the flag without a value.
|
|
65
69
|
|
|
66
70
|
``` python
|
|
67
71
|
g.log(n=1, oneline=True)
|
|
@@ -85,7 +89,9 @@ g.current_branch, g.commits
|
|
|
85
89
|
|
|
86
90
|
('main', ['5113ce1 add .gitignore'])
|
|
87
91
|
|
|
88
|
-
A failed command prints git’s message and returns `None
|
|
92
|
+
Command output is returned in a `str` subclass with the exit code in `.returncode`. A failed command prints git’s message and returns `None`. Pass `raise_exc=True` to raise an exception instead. You can set this per call or when creating the client.
|
|
93
|
+
|
|
94
|
+
Some git commands use exit code 1 for a negative result. For example, `grep` returns 1 when nothing matches. fastgit returns the output for these results without treating them as failures:
|
|
89
95
|
|
|
90
96
|
``` python
|
|
91
97
|
res = g.grep('missing')
|
|
@@ -94,7 +100,7 @@ res.returncode
|
|
|
94
100
|
|
|
95
101
|
1
|
|
96
102
|
|
|
97
|
-
Pass `sync=False` for an async client
|
|
103
|
+
Pass `sync=False` for an async client. Its commands and properties return awaitables. Waiting for git does not block the event loop:
|
|
98
104
|
|
|
99
105
|
``` python
|
|
100
106
|
ag = Git(td, sync=False)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
[build-system]
|
|
2
|
-
requires = ["setuptools>=
|
|
2
|
+
requires = ["setuptools>=77"]
|
|
3
3
|
build-backend = "setuptools.build_meta"
|
|
4
4
|
|
|
5
5
|
[project]
|
|
@@ -8,7 +8,7 @@ dynamic = ["version"]
|
|
|
8
8
|
description = "Use git from python, fast"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.9"
|
|
11
|
-
license =
|
|
11
|
+
license = "Apache-2.0"
|
|
12
12
|
authors = [{name = "Jeremy Howard", email = "github@jhoward.fastmail.fm"}]
|
|
13
13
|
keywords = ['nbdev', 'jupyter', 'notebook', 'python']
|
|
14
14
|
classifiers = ["Natural Language :: English", "Intended Audience :: Developers", "Development Status :: 3 - Alpha", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only"]
|
fastgit-0.1.3/MANIFEST.in
DELETED
fastgit-0.1.3/README.md
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
# fastgit
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
|
|
5
|
-
|
|
6
|
-
`fastgit` is a thin Python wrapper for the `git` CLI: one [`Git`](https://AnswerDotAI.github.io/fastgit/core.html#git) object whose attribute calls run git commands, so if you know git, you already know fastgit. There is no reimplementation of git internals and no object model to learn – commands return git’s own output as (subclassed) `str`s.
|
|
7
|
-
|
|
8
|
-
It is designed for interactive use and automation alike: errors print tersely by default (like git itself) or raise on request, exit codes that mean “no” rather than “failed” are returned normally, and passing `sync=False` gives an async client for servers and concurrent code.
|
|
9
|
-
|
|
10
|
-
## Usage
|
|
11
|
-
|
|
12
|
-
### Installation
|
|
13
|
-
|
|
14
|
-
Install latest from [pypi](https://pypi.org/project/fastgit/)
|
|
15
|
-
|
|
16
|
-
``` sh
|
|
17
|
-
$ pip install fastgit
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
### How to use
|
|
21
|
-
|
|
22
|
-
Create a [`Git`](https://AnswerDotAI.github.io/fastgit/core.html#git) for any directory; every command runs with that directory as its working tree. Method names map to git subcommands, and results come back as stripped strings:
|
|
23
|
-
|
|
24
|
-
``` python
|
|
25
|
-
import shutil, tempfile
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
``` python
|
|
29
|
-
td = tempfile.mkdtemp()
|
|
30
|
-
g = Git(td)
|
|
31
|
-
g.init(b='main')
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
'Initialized empty Git repository in /private/var/folders/51/b2_szf2945n072c0vj2cyty40000gn/T/tmp8zyj76q7/.git/'
|
|
35
|
-
|
|
36
|
-
``` python
|
|
37
|
-
(g.d/'.gitignore').mk_write('*.bak')
|
|
38
|
-
g.add('.gitignore')
|
|
39
|
-
g.commit(m='add .gitignore')
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
'[main (root-commit) 5113ce1] add .gitignore\n 1 file changed, 1 insertion(+)\n create mode 100644 .gitignore'
|
|
43
|
-
|
|
44
|
-
Keyword arguments become options: single-letter names are short options (`n=1` → `-n 1`), longer names long options with underscores turned into dashes, and `True` passes the bare flag:
|
|
45
|
-
|
|
46
|
-
``` python
|
|
47
|
-
g.log(n=1, oneline=True)
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
'5113ce1 add .gitignore'
|
|
51
|
-
|
|
52
|
-
You can also pass path arguments after `--` using the `__` parameter:
|
|
53
|
-
|
|
54
|
-
``` python
|
|
55
|
-
g.log('--oneline', __=['.gitignore'])
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
'5113ce1 add .gitignore'
|
|
59
|
-
|
|
60
|
-
Frequent queries are properties:
|
|
61
|
-
|
|
62
|
-
``` python
|
|
63
|
-
g.current_branch, g.commits
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
('main', ['5113ce1 add .gitignore'])
|
|
67
|
-
|
|
68
|
-
A failed command prints git’s message and returns `None`; pass `raise_exc=True` (per call or at init) to raise instead. Where git uses exit 1 to mean “no” rather than “error” – like `grep` finding nothing – the output is returned as usual, with the code on `.returncode`:
|
|
69
|
-
|
|
70
|
-
``` python
|
|
71
|
-
res = g.grep('missing')
|
|
72
|
-
res.returncode
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
1
|
|
76
|
-
|
|
77
|
-
Pass `sync=False` for an async client: the same commands and properties, each returning an awaitable, so a server never blocks its event loop on git:
|
|
78
|
-
|
|
79
|
-
``` python
|
|
80
|
-
ag = Git(td, sync=False)
|
|
81
|
-
await ag.last_commit
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
'add .gitignore'
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"""Use git from python, fast
|
|
2
|
-
|
|
3
|
-
`fastgit` is a thin Python wrapper for the `git` CLI: one `Git` object whose attribute calls run git commands, so if you know git, you already know fastgit. There is no reimplementation of git internals and no object model to learn -- commands return git's own output as (subclassed) `str`s.
|
|
4
|
-
|
|
5
|
-
It is designed for interactive use and automation alike: errors print tersely by default (like git itself) or raise on request, exit codes that mean "no" rather than "failed" are returned normally, and passing `sync=False` gives an async client for servers and concurrent code."""
|
|
6
|
-
|
|
7
|
-
__version__ = "0.1.3"
|
|
8
|
-
|
|
9
|
-
from .core import *
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|