skilleter-thingy 0.1.10__py3-none-any.whl → 0.1.11__py3-none-any.whl

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.

Potentially problematic release.


This version of skilleter-thingy might be problematic. Click here for more details.

@@ -14,7 +14,7 @@ import sys
14
14
  import argparse
15
15
  import os
16
16
 
17
- import pygit2
17
+ import thingy.git2 as git
18
18
 
19
19
  ################################################################################
20
20
 
@@ -28,48 +28,27 @@ def main():
28
28
  help='If we are already at the top of the working tree, check if the parent directory is in a working tree and output the top-level directory of that tree.')
29
29
  parser.add_argument('--dir', '-d', action='store', default=os.getcwd(),
30
30
  help='Find the location of the top-level directory in the working tree starting at the specified directory')
31
- parser.add_argument('level', nargs='?', type=int, default=0, help='Number of levels below the top-level directory to report')
31
+
32
32
  args = parser.parse_args()
33
33
 
34
- if not os.path.isdir(args.dir):
35
- print(f'Unable to locate directory {args.dir}')
34
+ start_dir = os.path.abspath(args.dir)
35
+
36
+ if not os.path.isdir(start_dir):
37
+ sys.stderr.write(f'Unable to locate directory {args.dir}\n')
36
38
  sys.exit(1)
37
39
 
38
- # Try to get the current working tree
40
+ # Search for a .git directory in the current or parent directories
39
41
 
40
- try:
41
- working_tree = pygit2.Repository(args.dir).workdir
42
- except pygit2.GitError:
43
- print(f'Directory {args.dir} is not in a Git working tree')
44
- sys.exit(2)
42
+ working_tree = git.working_tree(start_dir)
45
43
 
46
44
  # If we are in a working tree and also looking for the parent working
47
45
  # tree, check if we are at the top of the current tree, and, if so,
48
46
  # hop up a level and try again.
49
47
 
50
- if args.parent:
51
- current_directory = os.getcwd()
52
-
53
- if os.path.samefile(working_tree, current_directory):
54
- os.chdir('..')
55
- current_directory = os.getcwd()
56
-
57
- try:
58
- working_tree = pygit2.Repository(current_directory).workdir
59
- except pygit2.GitError:
60
- print(f'Parent directory {current_directory} is not in a Git working tree')
61
- sys.exit(3)
62
-
63
- # Output the result, if we have one
64
-
65
- if args.level:
66
- start = args.dir.split('/')
67
- working = working_tree.split('/')
68
-
69
- working_tree = os.path.join(working_tree, '/'.join(start[len(working):len(working) + int(args.level)]))
48
+ if args.parent and working_tree == start_dir:
49
+ working_tree = git.working_tree(working_tree.parent)
70
50
 
71
- if working_tree:
72
- print(working_tree)
51
+ print(working_tree)
73
52
 
74
53
  ################################################################################
75
54
 
@@ -477,7 +477,7 @@ def working_tree(start_dir=None):
477
477
  repo_dir = git_dir(start_dir)
478
478
 
479
479
  if repo_dir:
480
- return os.path.abspath(os.path.join(repo_dir, '..'))
480
+ return os.path.abspath(os.path.join(repo_dir, os.pardir))
481
481
 
482
482
  return None
483
483
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: skilleter_thingy
3
- Version: 0.1.10
3
+ Version: 0.1.11
4
4
  Summary: A collection of useful utilities, mainly aimed at making Git more friendly
5
5
  Author-email: John Skilleter <john@skilleter.org.uk>
6
6
  Project-URL: Home, https://skilleter.org.uk
@@ -17,7 +17,7 @@ skilleter_thingy/git_mr.py,sha256=g33FaRtJTbIQI0tfXv_a042YpGwtbg5fKw072aqjAdw,30
17
17
  skilleter_thingy/git_parent.py,sha256=DLy38mo06R0YDyJWQjrP8pQS-qc7tvLYcn8unKqzEiQ,2774
18
18
  skilleter_thingy/git_review.py,sha256=Vmepd1qHPM9eHYE19KNO0UWJIYhGhlwPlVBjbgFZ2PM,52448
19
19
  skilleter_thingy/git_update.py,sha256=nw-bnDFrMi7yNf7P6gGF8gzmJUjXU5PhWhOYPgApcX4,14350
20
- skilleter_thingy/git_wt.py,sha256=Xm4VBBXMI4GxNtH3QvF-QL9rtvo4RrlWSbNQDFpGZu8,2954
20
+ skilleter_thingy/git_wt.py,sha256=YrMGDuLC_glRzN9-6wkTIfZkhtDqstWajzDjjCVjp9U,2176
21
21
  skilleter_thingy/gitcmp_helper.py,sha256=wutDHpBPOX8ZsXbsC5ApHxMY5tOKgD3P0eyFVs_mSAI,11214
22
22
  skilleter_thingy/gitprompt.py,sha256=SzSMd0EGI7ftPko80Q2PipwbVA-qjU1jsmdpmTCM5GI,8912
23
23
  skilleter_thingy/gl.py,sha256=9zbGpKxw6lX9RghLkdy-Q5sZlqtbB3uGFO04qTu1dH8,5954
@@ -51,7 +51,7 @@ skilleter_thingy/thingy/dircolors.py,sha256=5NbXMsGWdABLvvZfB70VPmN6N5HyyihfpgoQ
51
51
  skilleter_thingy/thingy/docker.py,sha256=9EFatudoVPfB1UbDEtzdJDB3o6ToHiNHv8-oLsUeqiQ,2449
52
52
  skilleter_thingy/thingy/files.py,sha256=oW6E6WWwVFSUPdrZnKMx7P_w_hh3etjoN7RrqvYHCHc,4705
53
53
  skilleter_thingy/thingy/git.py,sha256=5EYzj6kxXZCK8E7AhiNPOyLYydCB86amnU6uyDEPfS4,38902
54
- skilleter_thingy/thingy/git2.py,sha256=DE6osZamorZZ-351l8W8Z-bSCKSNKSy-45Z2-IVy5rM,37136
54
+ skilleter_thingy/thingy/git2.py,sha256=5sBGIa01PyidcyViNSAqcj5C97zbK7qwMM2RHQKZhqM,37141
55
55
  skilleter_thingy/thingy/gitlab.py,sha256=uXAF918xnPk6qQyiwPQDbMZfqtJzhiRqDS7yEtJEIAg,6079
56
56
  skilleter_thingy/thingy/path.py,sha256=8uM2Q9zFRWv_SaVOX49PeecQXttl7J6lsmBuRXWsXKY,4732
57
57
  skilleter_thingy/thingy/popup.py,sha256=jW-nbpdeswqEMTli7OmBv1J8XQsvFoMI0J33O6dOeu8,2529
@@ -60,9 +60,9 @@ skilleter_thingy/thingy/run.py,sha256=6SNKWF01fSxzB10GMU9ajraXYZqAL1w0PXkqjJdr1U
60
60
  skilleter_thingy/thingy/tfm_pane.py,sha256=oqy5zBzKwfbjbGqetbbhpKi4x5He7sl4qkmhUeqtdZc,19789
61
61
  skilleter_thingy/thingy/tidy.py,sha256=UWpBWuIMCE1UonLJErb41yW3RtpXrK_bt4Z4cZR-eDU,5910
62
62
  skilleter_thingy/thingy/venv_template.py,sha256=SsVNvSwojd8NnFeQaZPCRQYTNdwJRplpZpygbUEXRnY,1015
63
- skilleter_thingy-0.1.10.dist-info/licenses/LICENSE,sha256=ljOS4DjXvqEo5VzGfdaRwgRZPbNScGBmfwyC8PChvmQ,32422
64
- skilleter_thingy-0.1.10.dist-info/METADATA,sha256=fEGixW3RcifB9BsfvxxQmL2y5LsWpRdD_jBeKSKTefM,29874
65
- skilleter_thingy-0.1.10.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
66
- skilleter_thingy-0.1.10.dist-info/entry_points.txt,sha256=u5ymS-KPljIGTnprV5yJsAjz7qgeT2BZ-Qo_Con_PFM,2145
67
- skilleter_thingy-0.1.10.dist-info/top_level.txt,sha256=8-JhgToBBiWURunmvfpSxEvNkDHQQ7r25-aBXtZv61g,17
68
- skilleter_thingy-0.1.10.dist-info/RECORD,,
63
+ skilleter_thingy-0.1.11.dist-info/licenses/LICENSE,sha256=ljOS4DjXvqEo5VzGfdaRwgRZPbNScGBmfwyC8PChvmQ,32422
64
+ skilleter_thingy-0.1.11.dist-info/METADATA,sha256=yIfo6Rkwh-OiB1HH9K5VCeN7MDDptlnL48VCb65iUO8,29874
65
+ skilleter_thingy-0.1.11.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
66
+ skilleter_thingy-0.1.11.dist-info/entry_points.txt,sha256=u5ymS-KPljIGTnprV5yJsAjz7qgeT2BZ-Qo_Con_PFM,2145
67
+ skilleter_thingy-0.1.11.dist-info/top_level.txt,sha256=8-JhgToBBiWURunmvfpSxEvNkDHQQ7r25-aBXtZv61g,17
68
+ skilleter_thingy-0.1.11.dist-info/RECORD,,