fastgit 0.0.5__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fastgit
3
- Version: 0.0.5
3
+ Version: 0.0.6
4
4
  Summary: Use git from python, fast
5
5
  Author-email: Jeremy Howard <github@jhoward.fastmail.fm>
6
6
  License: Apache-2.0
@@ -0,0 +1,3 @@
1
+ __version__ = "0.0.6"
2
+
3
+ from .core import *
@@ -9,6 +9,7 @@ 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'),
13
14
  'fastgit.core.Git.head_sha': ('core.html#git.head_sha', 'fastgit/core.py'),
14
15
  'fastgit.core.Git.last_commit': ('core.html#git.last_commit', 'fastgit/core.py'),
@@ -1,6 +1,6 @@
1
1
  """Implementation of fastgit
2
2
 
3
- Docs: https://AnswerDotAI.github.io/fastgitcore.html.md"""
3
+ Docs: https://AnswerDotAI.github.io/fastgit/core.html.md"""
4
4
 
5
5
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/00_core.ipynb.
6
6
 
@@ -14,10 +14,14 @@ from subprocess import CalledProcessError
14
14
  import shutil,stat
15
15
 
16
16
  # %% ../nbs/00_core.ipynb #e4c0a290
17
- 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]
18
22
  fp = Path(path).expanduser().resolve()
19
23
  args = ['git', '-C', str(fp)] + list(args)
20
- if uname: args = ['/usr/bin/sudo', '-u', uname] + args
24
+ if pre: args = [*pre, *args]
21
25
  res = subprocess.run(args, capture_output=True, text=True, check=True).stdout.strip()
22
26
  if split is None: return res.splitlines() if '\n' in res else res
23
27
  return res.splitlines() if split else res
@@ -29,7 +33,7 @@ def get_top(folder):
29
33
 
30
34
  # %% ../nbs/00_core.ipynb #97f78839
31
35
  class Git:
32
- def __init__(self, d): self.d = Path(d).expanduser()
36
+ def __init__(self, d, pre=None): self.d,self.pre = Path(d).expanduser(),pre
33
37
 
34
38
  def __call__(self, cmd, *args, split=None, mute_errors=False, **kwargs):
35
39
  paths = [str(p) for p in listify(kwargs.pop('__', None) or [])]
@@ -39,7 +43,7 @@ class Git:
39
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]
40
44
  args += [f'--{k.replace("_","-")}' for k,v in kwargs.items() if len(k)>1 and v is True]
41
45
  if paths: args += ['--'] + paths
42
- try: return callgit(self.d, cmd, *args, split=split)
46
+ try: return callgit(self.d, cmd, *args, split=split, pre=self.pre)
43
47
  except CalledProcessError as e:
44
48
  if not mute_errors: print(f'ERROR: Git.__call__ caught exception {e} \n with stderr={e.stderr}')
45
49
 
@@ -57,3 +61,7 @@ class Git:
57
61
  # %% ../nbs/00_core.ipynb #b688e74b
58
62
  @patch(as_prop=True)
59
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)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fastgit
3
- Version: 0.0.5
3
+ Version: 0.0.6
4
4
  Summary: Use git from python, fast
5
5
  Author-email: Jeremy Howard <github@jhoward.fastmail.fm>
6
6
  License: Apache-2.0
@@ -1,3 +0,0 @@
1
- __version__ = "0.0.5"
2
-
3
- from .core import *
File without changes
File without changes
File without changes
File without changes
File without changes