fastgit 0.0.4__tar.gz → 0.0.6__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.4/fastgit.egg-info → fastgit-0.0.6}/PKG-INFO +1 -1
- fastgit-0.0.6/fastgit/__init__.py +3 -0
- {fastgit-0.0.4 → fastgit-0.0.6}/fastgit/_modidx.py +2 -0
- {fastgit-0.0.4 → fastgit-0.0.6}/fastgit/core.py +17 -5
- {fastgit-0.0.4 → fastgit-0.0.6/fastgit.egg-info}/PKG-INFO +1 -1
- {fastgit-0.0.4 → fastgit-0.0.6}/pyproject.toml +2 -0
- fastgit-0.0.4/fastgit/__init__.py +0 -3
- {fastgit-0.0.4 → fastgit-0.0.6}/LICENSE +0 -0
- {fastgit-0.0.4 → fastgit-0.0.6}/MANIFEST.in +0 -0
- {fastgit-0.0.4 → fastgit-0.0.6}/README.md +0 -0
- {fastgit-0.0.4 → fastgit-0.0.6}/fastgit.egg-info/SOURCES.txt +0 -0
- {fastgit-0.0.4 → fastgit-0.0.6}/fastgit.egg-info/dependency_links.txt +0 -0
- {fastgit-0.0.4 → fastgit-0.0.6}/fastgit.egg-info/entry_points.txt +0 -0
- {fastgit-0.0.4 → fastgit-0.0.6}/fastgit.egg-info/top_level.txt +0 -0
- {fastgit-0.0.4 → fastgit-0.0.6}/setup.cfg +0 -0
|
@@ -9,7 +9,9 @@ d = { 'settings': { 'branch': 'main',
|
|
|
9
9
|
'fastgit.core.Git.__call__': ('core.html#git.__call__', 'fastgit/core.py'),
|
|
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
|
+
'fastgit.core.Git.commits': ('core.html#git.commits', 'fastgit/core.py'),
|
|
12
13
|
'fastgit.core.Git.exists': ('core.html#git.exists', 'fastgit/core.py'),
|
|
14
|
+
'fastgit.core.Git.head_sha': ('core.html#git.head_sha', 'fastgit/core.py'),
|
|
13
15
|
'fastgit.core.Git.last_commit': ('core.html#git.last_commit', 'fastgit/core.py'),
|
|
14
16
|
'fastgit.core.Git.top': ('core.html#git.top', 'fastgit/core.py'),
|
|
15
17
|
'fastgit.core.callgit': ('core.html#callgit', 'fastgit/core.py'),
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
"""Implementation of fastgit
|
|
1
|
+
"""Implementation of fastgit
|
|
2
|
+
|
|
3
|
+
Docs: https://AnswerDotAI.github.io/fastgit/core.html.md"""
|
|
2
4
|
|
|
3
5
|
# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/00_core.ipynb.
|
|
4
6
|
|
|
@@ -12,10 +14,14 @@ from subprocess import CalledProcessError
|
|
|
12
14
|
import shutil,stat
|
|
13
15
|
|
|
14
16
|
# %% ../nbs/00_core.ipynb #e4c0a290
|
|
15
|
-
def callgit(path, *args, split=None, uname=None):
|
|
17
|
+
def callgit(path, *args, split=None, uname=None, pre=None):
|
|
18
|
+
assert not (uname and pre), "Pass `uname` or `pre`, not both"
|
|
19
|
+
if uname:
|
|
20
|
+
warn("`uname` is deprecated; pass e.g `pre=['/usr/bin/sudo','-u',uname]` instead", DeprecationWarning)
|
|
21
|
+
pre = ['/usr/bin/sudo', '-u', uname]
|
|
16
22
|
fp = Path(path).expanduser().resolve()
|
|
17
23
|
args = ['git', '-C', str(fp)] + list(args)
|
|
18
|
-
if
|
|
24
|
+
if pre: args = [*pre, *args]
|
|
19
25
|
res = subprocess.run(args, capture_output=True, text=True, check=True).stdout.strip()
|
|
20
26
|
if split is None: return res.splitlines() if '\n' in res else res
|
|
21
27
|
return res.splitlines() if split else res
|
|
@@ -27,7 +33,7 @@ def get_top(folder):
|
|
|
27
33
|
|
|
28
34
|
# %% ../nbs/00_core.ipynb #97f78839
|
|
29
35
|
class Git:
|
|
30
|
-
def __init__(self, d): self.d = Path(d).expanduser()
|
|
36
|
+
def __init__(self, d, pre=None): self.d,self.pre = Path(d).expanduser(),pre
|
|
31
37
|
|
|
32
38
|
def __call__(self, cmd, *args, split=None, mute_errors=False, **kwargs):
|
|
33
39
|
paths = [str(p) for p in listify(kwargs.pop('__', None) or [])]
|
|
@@ -37,7 +43,7 @@ class Git:
|
|
|
37
43
|
args += [f'--{k.replace("_","-")}={v}' for k,v in kwargs.items() if len(k)>1 and v is not True and v is not False]
|
|
38
44
|
args += [f'--{k.replace("_","-")}' for k,v in kwargs.items() if len(k)>1 and v is True]
|
|
39
45
|
if paths: args += ['--'] + paths
|
|
40
|
-
try: return callgit(self.d, cmd, *args, split=split)
|
|
46
|
+
try: return callgit(self.d, cmd, *args, split=split, pre=self.pre)
|
|
41
47
|
except CalledProcessError as e:
|
|
42
48
|
if not mute_errors: print(f'ERROR: Git.__call__ caught exception {e} \n with stderr={e.stderr}')
|
|
43
49
|
|
|
@@ -49,7 +55,13 @@ class Git:
|
|
|
49
55
|
|
|
50
56
|
@property
|
|
51
57
|
def exists(self): return self.top() is not None
|
|
58
|
+
@property
|
|
59
|
+
def head_sha(self): return self.rev_parse('HEAD', mute_errors=True)
|
|
52
60
|
|
|
53
61
|
# %% ../nbs/00_core.ipynb #b688e74b
|
|
54
62
|
@patch(as_prop=True)
|
|
55
63
|
def last_commit(self:Git): return self.log('-1', pretty='format:%s')
|
|
64
|
+
|
|
65
|
+
# %% ../nbs/00_core.ipynb #fdf315b8
|
|
66
|
+
@patch(as_prop=True)
|
|
67
|
+
def commits(self:Git): return self.log('--oneline', split=True)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|