fastgit 0.0.6__tar.gz → 0.1.0__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.0.6/fastgit.egg-info → fastgit-0.1.0}/PKG-INFO +3 -3
- {fastgit-0.0.6 → fastgit-0.1.0}/README.md +1 -2
- fastgit-0.1.0/fastgit/__init__.py +3 -0
- {fastgit-0.0.6 → fastgit-0.1.0}/fastgit/_modidx.py +1 -0
- {fastgit-0.0.6 → fastgit-0.1.0}/fastgit/core.py +21 -15
- {fastgit-0.0.6 → fastgit-0.1.0/fastgit.egg-info}/PKG-INFO +3 -3
- {fastgit-0.0.6 → fastgit-0.1.0}/fastgit.egg-info/SOURCES.txt +1 -0
- fastgit-0.1.0/fastgit.egg-info/requires.txt +1 -0
- {fastgit-0.0.6 → fastgit-0.1.0}/pyproject.toml +4 -1
- fastgit-0.0.6/fastgit/__init__.py +0 -3
- {fastgit-0.0.6 → fastgit-0.1.0}/LICENSE +0 -0
- {fastgit-0.0.6 → fastgit-0.1.0}/MANIFEST.in +0 -0
- {fastgit-0.0.6 → fastgit-0.1.0}/fastgit.egg-info/dependency_links.txt +0 -0
- {fastgit-0.0.6 → fastgit-0.1.0}/fastgit.egg-info/entry_points.txt +0 -0
- {fastgit-0.0.6 → fastgit-0.1.0}/fastgit.egg-info/top_level.txt +0 -0
- {fastgit-0.0.6 → fastgit-0.1.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fastgit
|
|
3
|
-
Version: 0.0
|
|
3
|
+
Version: 0.1.0
|
|
4
4
|
Summary: Use git from python, fast
|
|
5
5
|
Author-email: Jeremy Howard <github@jhoward.fastmail.fm>
|
|
6
6
|
License: Apache-2.0
|
|
@@ -15,6 +15,7 @@ Classifier: Programming Language :: Python :: 3 :: Only
|
|
|
15
15
|
Requires-Python: >=3.9
|
|
16
16
|
Description-Content-Type: text/markdown
|
|
17
17
|
License-File: LICENSE
|
|
18
|
+
Requires-Dist: fastcore>=1.12.27
|
|
18
19
|
Dynamic: license-file
|
|
19
20
|
|
|
20
21
|
# fastgit
|
|
@@ -34,8 +35,7 @@ $ pip install fastgit
|
|
|
34
35
|
|
|
35
36
|
### How to use
|
|
36
37
|
|
|
37
|
-
In this example we run `git init` on a directory, add a *.gitignore*,
|
|
38
|
-
and commit it.
|
|
38
|
+
In this example we run `git init` on a directory, add a *.gitignore*, and commit it.
|
|
39
39
|
|
|
40
40
|
``` python
|
|
41
41
|
import shutil, tempfile
|
|
@@ -15,8 +15,7 @@ $ pip install fastgit
|
|
|
15
15
|
|
|
16
16
|
### How to use
|
|
17
17
|
|
|
18
|
-
In this example we run `git init` on a directory, add a *.gitignore*,
|
|
19
|
-
and commit it.
|
|
18
|
+
In this example we run `git init` on a directory, add a *.gitignore*, and commit it.
|
|
20
19
|
|
|
21
20
|
``` python
|
|
22
21
|
import shutil, tempfile
|
|
@@ -10,6 +10,7 @@ d = { 'settings': { 'branch': 'main',
|
|
|
10
10
|
'fastgit.core.Git.__getattr__': ('core.html#git.__getattr__', 'fastgit/core.py'),
|
|
11
11
|
'fastgit.core.Git.__init__': ('core.html#git.__init__', 'fastgit/core.py'),
|
|
12
12
|
'fastgit.core.Git.commits': ('core.html#git.commits', 'fastgit/core.py'),
|
|
13
|
+
'fastgit.core.Git.current_branch': ('core.html#git.current_branch', 'fastgit/core.py'),
|
|
13
14
|
'fastgit.core.Git.exists': ('core.html#git.exists', 'fastgit/core.py'),
|
|
14
15
|
'fastgit.core.Git.head_sha': ('core.html#git.head_sha', 'fastgit/core.py'),
|
|
15
16
|
'fastgit.core.Git.last_commit': ('core.html#git.last_commit', 'fastgit/core.py'),
|
|
@@ -11,20 +11,19 @@ __all__ = ['callgit', 'get_top', 'Git']
|
|
|
11
11
|
from fastcore.utils import *
|
|
12
12
|
import subprocess
|
|
13
13
|
from subprocess import CalledProcessError
|
|
14
|
-
import shutil,stat
|
|
15
14
|
|
|
16
15
|
# %% ../nbs/00_core.ipynb #e4c0a290
|
|
17
|
-
def callgit(path, *args,
|
|
16
|
+
def callgit(path, *args, uname=None, pre=None):
|
|
17
|
+
"Run git in `path`, returning stripped stdout+stderr as a single `str`"
|
|
18
18
|
assert not (uname and pre), "Pass `uname` or `pre`, not both"
|
|
19
19
|
if uname:
|
|
20
|
-
warn("`uname` is deprecated; pass e.g `pre=['/usr/bin/sudo','-u',uname]` instead", DeprecationWarning)
|
|
20
|
+
warn("`uname` is deprecated; pass e.g `pre=['/usr/bin/sudo','-u',uname]` instead", DeprecationWarning, stacklevel=2)
|
|
21
21
|
pre = ['/usr/bin/sudo', '-u', uname]
|
|
22
22
|
fp = Path(path).expanduser().resolve()
|
|
23
23
|
args = ['git', '-C', str(fp)] + list(args)
|
|
24
24
|
if pre: args = [*pre, *args]
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return res.splitlines() if split else res
|
|
25
|
+
r = subprocess.run(args, capture_output=True, text=True, check=True)
|
|
26
|
+
return (r.stdout + r.stderr).strip()
|
|
28
27
|
|
|
29
28
|
# %% ../nbs/00_core.ipynb #4c0df6c6
|
|
30
29
|
def get_top(folder):
|
|
@@ -33,30 +32,33 @@ def get_top(folder):
|
|
|
33
32
|
|
|
34
33
|
# %% ../nbs/00_core.ipynb #97f78839
|
|
35
34
|
class Git:
|
|
36
|
-
|
|
35
|
+
"Run git commands in dir `d`"
|
|
36
|
+
def __init__(self, d, pre=None, raise_exc=False): self.d,self.pre,self.raise_exc = Path(d).expanduser(),pre,raise_exc
|
|
37
37
|
|
|
38
|
-
def __call__(self, cmd, *args,
|
|
38
|
+
def __call__(self, cmd, *args, mute_errors=False, raise_exc=None, **kwargs):
|
|
39
39
|
paths = [str(p) for p in listify(kwargs.pop('__', None) or [])]
|
|
40
40
|
args = listify(args)
|
|
41
|
-
|
|
41
|
+
kwargs = {k:v for k,v in kwargs.items() if v is not False}
|
|
42
|
+
args += concat((f'-{k}',str(v)) for k,v in kwargs.items() if len(k)==1 and v is not True)
|
|
42
43
|
args += [f'-{k}' for k,v in kwargs.items() if len(k)==1 and v is True]
|
|
43
|
-
args += [f'--{k.replace("_","-")}={v}' for k,v in kwargs.items() if len(k)>1 and v is not True
|
|
44
|
+
args += [f'--{k.replace("_","-")}={v}' for k,v in kwargs.items() if len(k)>1 and v is not True]
|
|
44
45
|
args += [f'--{k.replace("_","-")}' for k,v in kwargs.items() if len(k)>1 and v is True]
|
|
45
46
|
if paths: args += ['--'] + paths
|
|
46
|
-
try: return callgit(self.d, cmd, *args,
|
|
47
|
+
try: return callgit(self.d, cmd, *args, pre=self.pre)
|
|
47
48
|
except CalledProcessError as e:
|
|
49
|
+
if ifnone(raise_exc, self.raise_exc): raise
|
|
48
50
|
if not mute_errors: print(f'ERROR: Git.__call__ caught exception {e} \n with stderr={e.stderr}')
|
|
49
51
|
|
|
50
52
|
def __getattr__(self, nm):
|
|
51
53
|
if nm.startswith('_'): raise AttributeError(nm)
|
|
52
54
|
return partial(self, nm.replace('_','-'))
|
|
53
55
|
|
|
54
|
-
def top(self): return self.rev_parse('--show-toplevel', mute_errors=True)
|
|
55
|
-
|
|
56
|
+
def top(self): return self.rev_parse('--show-toplevel', mute_errors=True, raise_exc=False)
|
|
57
|
+
|
|
56
58
|
@property
|
|
57
59
|
def exists(self): return self.top() is not None
|
|
58
60
|
@property
|
|
59
|
-
def head_sha(self): return self.rev_parse('HEAD', mute_errors=True)
|
|
61
|
+
def head_sha(self): return self.rev_parse('HEAD', mute_errors=True, raise_exc=False)
|
|
60
62
|
|
|
61
63
|
# %% ../nbs/00_core.ipynb #b688e74b
|
|
62
64
|
@patch(as_prop=True)
|
|
@@ -64,4 +66,8 @@ def last_commit(self:Git): return self.log('-1', pretty='format:%s')
|
|
|
64
66
|
|
|
65
67
|
# %% ../nbs/00_core.ipynb #fdf315b8
|
|
66
68
|
@patch(as_prop=True)
|
|
67
|
-
def commits(self:Git): return self.log('--oneline',
|
|
69
|
+
def commits(self:Git): return (self.log('--oneline', mute_errors=True, raise_exc=False) or '').splitlines()
|
|
70
|
+
|
|
71
|
+
# %% ../nbs/00_core.ipynb #712ca55b
|
|
72
|
+
@patch(as_prop=True)
|
|
73
|
+
def current_branch(self:Git): return self.branch('--show-current')
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fastgit
|
|
3
|
-
Version: 0.0
|
|
3
|
+
Version: 0.1.0
|
|
4
4
|
Summary: Use git from python, fast
|
|
5
5
|
Author-email: Jeremy Howard <github@jhoward.fastmail.fm>
|
|
6
6
|
License: Apache-2.0
|
|
@@ -15,6 +15,7 @@ Classifier: Programming Language :: Python :: 3 :: Only
|
|
|
15
15
|
Requires-Python: >=3.9
|
|
16
16
|
Description-Content-Type: text/markdown
|
|
17
17
|
License-File: LICENSE
|
|
18
|
+
Requires-Dist: fastcore>=1.12.27
|
|
18
19
|
Dynamic: license-file
|
|
19
20
|
|
|
20
21
|
# fastgit
|
|
@@ -34,8 +35,7 @@ $ pip install fastgit
|
|
|
34
35
|
|
|
35
36
|
### How to use
|
|
36
37
|
|
|
37
|
-
In this example we run `git init` on a directory, add a *.gitignore*,
|
|
38
|
-
and commit it.
|
|
38
|
+
In this example we run `git init` on a directory, add a *.gitignore*, and commit it.
|
|
39
39
|
|
|
40
40
|
``` python
|
|
41
41
|
import shutil, tempfile
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
fastcore>=1.12.27
|
|
@@ -12,7 +12,7 @@ license = {text = "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"]
|
|
15
|
-
dependencies = []
|
|
15
|
+
dependencies = ['fastcore>=1.12.27']
|
|
16
16
|
|
|
17
17
|
[project.urls]
|
|
18
18
|
Repository = "https://github.com/AnswerDotAI/fastgit"
|
|
@@ -31,3 +31,6 @@ include = ["fastgit"]
|
|
|
31
31
|
allowed_metadata_keys = ['solveit']
|
|
32
32
|
allowed_cell_metadata_keys = ['solveit_ai']
|
|
33
33
|
custom_sidebar = false
|
|
34
|
+
|
|
35
|
+
[tool.chkstyle]
|
|
36
|
+
skip_paths = ["_modidx.py"]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|