fastgit 0.0.3__tar.gz → 0.0.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fastgit
3
- Version: 0.0.3
3
+ Version: 0.0.5
4
4
  Summary: Use git from python, fast
5
5
  Author-email: Jeremy Howard <github@jhoward.fastmail.fm>
6
6
  License: Apache-2.0
@@ -38,7 +38,7 @@ In this example we run `git init` on a directory, add a *.gitignore*,
38
38
  and commit it.
39
39
 
40
40
  ``` python
41
- import tempfile
41
+ import shutil, tempfile
42
42
  ```
43
43
 
44
44
  ``` python
@@ -53,11 +53,23 @@ def _git_init(g):
53
53
  ```
54
54
 
55
55
  ``` python
56
- with tempfile.TemporaryDirectory() as td:
57
- g = Git(td)
58
- _git_init(g)
59
- assert 'add .gitignore' in g.last_commit
60
- print(g.branch('--show-current'))
56
+ td = tempfile.mkdtemp()
57
+ g = Git(td)
58
+ _git_init(g)
59
+ assert 'add .gitignore' in g.last_commit
60
+ print(g.branch('--show-current'))
61
61
  ```
62
62
 
63
63
  main
64
+
65
+ You can also pass path arguments after `--` using the `__` parameter:
66
+
67
+ ``` python
68
+ g.log('--oneline', __=['.gitignore'])
69
+ ```
70
+
71
+ '22a9a5d add .gitignore'
72
+
73
+ ``` python
74
+ shutil.rmtree(td)
75
+ ```
@@ -19,7 +19,7 @@ In this example we run `git init` on a directory, add a *.gitignore*,
19
19
  and commit it.
20
20
 
21
21
  ``` python
22
- import tempfile
22
+ import shutil, tempfile
23
23
  ```
24
24
 
25
25
  ``` python
@@ -34,11 +34,23 @@ def _git_init(g):
34
34
  ```
35
35
 
36
36
  ``` python
37
- with tempfile.TemporaryDirectory() as td:
38
- g = Git(td)
39
- _git_init(g)
40
- assert 'add .gitignore' in g.last_commit
41
- print(g.branch('--show-current'))
37
+ td = tempfile.mkdtemp()
38
+ g = Git(td)
39
+ _git_init(g)
40
+ assert 'add .gitignore' in g.last_commit
41
+ print(g.branch('--show-current'))
42
42
  ```
43
43
 
44
44
  main
45
+
46
+ You can also pass path arguments after `--` using the `__` parameter:
47
+
48
+ ``` python
49
+ g.log('--oneline', __=['.gitignore'])
50
+ ```
51
+
52
+ '22a9a5d add .gitignore'
53
+
54
+ ``` python
55
+ shutil.rmtree(td)
56
+ ```
@@ -0,0 +1,3 @@
1
+ __version__ = "0.0.5"
2
+
3
+ from .core import *
@@ -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.exists': ('core.html#git.exists', 'fastgit/core.py'),
13
+ 'fastgit.core.Git.head_sha': ('core.html#git.head_sha', 'fastgit/core.py'),
13
14
  'fastgit.core.Git.last_commit': ('core.html#git.last_commit', 'fastgit/core.py'),
14
15
  'fastgit.core.Git.top': ('core.html#git.top', 'fastgit/core.py'),
15
16
  '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/fastgitcore.html.md"""
2
4
 
3
5
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/00_core.ipynb.
4
6
 
@@ -13,7 +15,7 @@ import shutil,stat
13
15
 
14
16
  # %% ../nbs/00_core.ipynb #e4c0a290
15
17
  def callgit(path, *args, split=None, uname=None):
16
- fp = Path(path).resolve()
18
+ fp = Path(path).expanduser().resolve()
17
19
  args = ['git', '-C', str(fp)] + list(args)
18
20
  if uname: args = ['/usr/bin/sudo', '-u', uname] + args
19
21
  res = subprocess.run(args, capture_output=True, text=True, check=True).stdout.strip()
@@ -27,7 +29,7 @@ def get_top(folder):
27
29
 
28
30
  # %% ../nbs/00_core.ipynb #97f78839
29
31
  class Git:
30
- def __init__(self, d): self.d = Path(d)
32
+ def __init__(self, d): self.d = Path(d).expanduser()
31
33
 
32
34
  def __call__(self, cmd, *args, split=None, mute_errors=False, **kwargs):
33
35
  paths = [str(p) for p in listify(kwargs.pop('__', None) or [])]
@@ -49,6 +51,8 @@ class Git:
49
51
 
50
52
  @property
51
53
  def exists(self): return self.top() is not None
54
+ @property
55
+ def head_sha(self): return self.rev_parse('HEAD', mute_errors=True)
52
56
 
53
57
  # %% ../nbs/00_core.ipynb #b688e74b
54
58
  @patch(as_prop=True)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fastgit
3
- Version: 0.0.3
3
+ Version: 0.0.5
4
4
  Summary: Use git from python, fast
5
5
  Author-email: Jeremy Howard <github@jhoward.fastmail.fm>
6
6
  License: Apache-2.0
@@ -38,7 +38,7 @@ In this example we run `git init` on a directory, add a *.gitignore*,
38
38
  and commit it.
39
39
 
40
40
  ``` python
41
- import tempfile
41
+ import shutil, tempfile
42
42
  ```
43
43
 
44
44
  ``` python
@@ -53,11 +53,23 @@ def _git_init(g):
53
53
  ```
54
54
 
55
55
  ``` python
56
- with tempfile.TemporaryDirectory() as td:
57
- g = Git(td)
58
- _git_init(g)
59
- assert 'add .gitignore' in g.last_commit
60
- print(g.branch('--show-current'))
56
+ td = tempfile.mkdtemp()
57
+ g = Git(td)
58
+ _git_init(g)
59
+ assert 'add .gitignore' in g.last_commit
60
+ print(g.branch('--show-current'))
61
61
  ```
62
62
 
63
63
  main
64
+
65
+ You can also pass path arguments after `--` using the `__` parameter:
66
+
67
+ ``` python
68
+ g.log('--oneline', __=['.gitignore'])
69
+ ```
70
+
71
+ '22a9a5d add .gitignore'
72
+
73
+ ``` python
74
+ shutil.rmtree(td)
75
+ ```
@@ -28,4 +28,6 @@ version = {attr = "fastgit.__version__"}
28
28
  include = ["fastgit"]
29
29
 
30
30
  [tool.nbdev]
31
+ allowed_metadata_keys = ['solveit']
32
+ allowed_cell_metadata_keys = ['solveit_ai']
31
33
  custom_sidebar = false
@@ -1,3 +0,0 @@
1
- __version__ = "0.0.3"
2
-
3
- from .core import *
File without changes
File without changes
File without changes