skilleter-thingy 0.2.3__tar.gz → 0.2.4__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.

Potentially problematic release.


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

Files changed (67) hide show
  1. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/PKG-INFO +1 -1
  2. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/pyproject.toml +1 -1
  3. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy/ggit.py +1 -0
  4. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy/ggrep.py +1 -0
  5. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy/git_br.py +7 -0
  6. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy/git_ca.py +8 -0
  7. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy/git_cleanup.py +11 -0
  8. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy/git_co.py +8 -3
  9. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy/git_common.py +12 -4
  10. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy/git_hold.py +9 -0
  11. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy/git_mr.py +11 -0
  12. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy/git_parent.py +23 -18
  13. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy/git_retag.py +10 -0
  14. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy/git_review.py +1 -0
  15. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy/git_update.py +1 -0
  16. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy/git_wt.py +2 -0
  17. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy/gitprompt.py +1 -0
  18. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy/thingy/git.py +18 -5
  19. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy/thingy/git2.py +20 -7
  20. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy.egg-info/PKG-INFO +1 -1
  21. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy.egg-info/SOURCES.txt +0 -2
  22. skilleter_thingy-0.2.3/skilleter_thingy/git_retag.sync-conflict-20250928-192600-TVSLRWK.py +0 -54
  23. skilleter_thingy-0.2.3/skilleter_thingy.egg-info/PKG-INFO 2 +0 -193
  24. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/LICENSE +0 -0
  25. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/README.md +0 -0
  26. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/setup.cfg +0 -0
  27. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy/__init__.py +0 -0
  28. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy/addpath.py +0 -0
  29. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy/console_colours.py +0 -0
  30. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy/docker_purge.py +0 -0
  31. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy/ffind.py +0 -0
  32. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy/gitcmp_helper.py +0 -0
  33. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy/gl.py +0 -0
  34. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy/linecount.py +0 -0
  35. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy/multigit.py +0 -0
  36. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy/py_audit.py +0 -0
  37. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy/readable.py +0 -0
  38. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy/remdir.py +0 -0
  39. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy/rmdupe.py +0 -0
  40. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy/rpylint.py +0 -0
  41. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy/strreplace.py +0 -0
  42. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy/tfm.py +0 -0
  43. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy/tfparse.py +0 -0
  44. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy/thingy/__init__.py +0 -0
  45. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy/thingy/colour.py +0 -0
  46. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy/thingy/dc_curses.py +0 -0
  47. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy/thingy/dc_defaults.py +0 -0
  48. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy/thingy/dc_util.py +0 -0
  49. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy/thingy/dircolors.py +0 -0
  50. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy/thingy/docker.py +0 -0
  51. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy/thingy/files.py +0 -0
  52. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy/thingy/gitlab.py +0 -0
  53. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy/thingy/path.py +0 -0
  54. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy/thingy/popup.py +0 -0
  55. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy/thingy/process.py +0 -0
  56. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy/thingy/run.py +0 -0
  57. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy/thingy/tfm_pane.py +0 -0
  58. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy/thingy/tidy.py +0 -0
  59. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy/thingy/venv_template.py +0 -0
  60. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy/trimpath.py +0 -0
  61. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy/venv_create.py +0 -0
  62. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy/xchmod.py +0 -0
  63. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy/yamlcheck.py +0 -0
  64. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy.egg-info/dependency_links.txt +0 -0
  65. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy.egg-info/entry_points.txt +0 -0
  66. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy.egg-info/requires.txt +0 -0
  67. {skilleter_thingy-0.2.3 → skilleter_thingy-0.2.4}/skilleter_thingy.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: skilleter_thingy
3
- Version: 0.2.3
3
+ Version: 0.2.4
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
@@ -7,7 +7,7 @@ name = "skilleter_thingy"
7
7
 
8
8
  # Version must be incremented to install updated Thingy
9
9
 
10
- version = "0.2.3"
10
+ version = "0.2.4"
11
11
 
12
12
  authors = [
13
13
  {name="John Skilleter", email="john@skilleter.org.uk"},
@@ -7,6 +7,7 @@ import os
7
7
  import subprocess
8
8
  import argparse
9
9
 
10
+ # TODO: Update to git2
10
11
  import thingy.git as git
11
12
  import thingy.colour as colour
12
13
 
@@ -14,6 +14,7 @@ import sys
14
14
  import argparse
15
15
 
16
16
  import thingy.colour as colour
17
+ # TODO: Update to git2
17
18
  import thingy.git as git
18
19
 
19
20
  ################################################################################
@@ -13,6 +13,7 @@
13
13
  """
14
14
  ################################################################################
15
15
 
16
+ import os
16
17
  import sys
17
18
  import argparse
18
19
  import fnmatch
@@ -21,6 +22,7 @@ import datetime
21
22
  from dateutil.parser import parse
22
23
  from dateutil.relativedelta import relativedelta
23
24
 
25
+ # TODO: Update to git2
24
26
  import thingy.git as git
25
27
  import thingy.colour as colour
26
28
 
@@ -34,10 +36,15 @@ def parse_command_line():
34
36
  parser.add_argument('--all', '-a', action='store_true', help='List all branches, including remotes')
35
37
  parser.add_argument('--delete', '-d', action='store_true',
36
38
  help='Delete the specified branch(es), even if it is the current one (list of branches to delete must be supplied as parameters)')
39
+ parser.add_argument('--path', '-C', nargs=1, type=str, default=None,
40
+ help='Run the command in the specified directory')
37
41
  parser.add_argument('branches', nargs='*', help='Filter the list of branches according to one or more patterns')
38
42
 
39
43
  args = parser.parse_args()
40
44
 
45
+ if args.path:
46
+ os.chdir(args.path[0])
47
+
41
48
  if args.delete and not args.branches:
42
49
  colour.error('You must specify the branches to delete', prefix=True)
43
50
 
@@ -18,6 +18,7 @@ import sys
18
18
  import logging
19
19
 
20
20
  import thingy.colour as colour
21
+ # TODO: Update to git2
21
22
  import thingy.git as git
22
23
 
23
24
  ################################################################################
@@ -43,6 +44,8 @@ def main():
43
44
  parser.add_argument('--patch', '-p', action='store_true', help='Use the interactive patch selection interface to chose which changes to commit.')
44
45
  parser.add_argument('--verbose', '-v', action='store_true', help='Verbose mode')
45
46
  parser.add_argument('--dry-run', '-D', action='store_true', help='Dry-run')
47
+ parser.add_argument('--path', '-C', nargs=1, type=str, default=None,
48
+ help='Run the command in the specified directory')
46
49
 
47
50
  parser.add_argument('files', nargs='*', help='List of files to add to the commit')
48
51
 
@@ -54,6 +57,11 @@ def main():
54
57
  logging.basicConfig(level=logging.INFO)
55
58
  logging.info('Debug logging enabled')
56
59
 
60
+ # Change directory, if specified
61
+
62
+ if args.path:
63
+ os.chdir(args.path[0])
64
+
57
65
  # 'Add' implies 'all'
58
66
 
59
67
  if args.everything:
@@ -9,10 +9,12 @@
9
9
  """
10
10
  ################################################################################
11
11
 
12
+ import os
12
13
  import sys
13
14
  import argparse
14
15
  import logging
15
16
 
17
+ # TODO: Update to git2
16
18
  import thingy.git as git
17
19
  import thingy.colour as colour
18
20
 
@@ -38,6 +40,8 @@ def parse_command_line():
38
40
  parser.add_argument('--unmerged', '-u', action='store_true', dest='list_unmerged', help='List branches that have NOT been merged')
39
41
  parser.add_argument('--yes', '-y', action='store_true', dest='force', help='Assume "yes" in response to any prompts (e.g. to delete branches)')
40
42
  parser.add_argument('--debug', action='store_true', help='Enable debug output')
43
+ parser.add_argument('--path', '-C', nargs=1, type=str, default=None,
44
+ help='Run the command in the specified directory')
41
45
 
42
46
  parser.add_argument('branches', nargs='*', help='List of branches to check (default is all branches)')
43
47
 
@@ -94,6 +98,11 @@ def main():
94
98
  if args.debug:
95
99
  logging.basicConfig(level=logging.INFO)
96
100
 
101
+ # Change directory, if specified
102
+
103
+ if args.path:
104
+ os.chdir(args.path[0])
105
+
97
106
  # Get the list of all local branches
98
107
 
99
108
  try:
@@ -280,6 +289,8 @@ def git_cleanup():
280
289
  sys.exit(1)
281
290
  except BrokenPipeError:
282
291
  sys.exit(2)
292
+ except git.GitError as exc:
293
+ colour.error(exc.msg, status=exc.status, prefix=True)
283
294
 
284
295
  ################################################################################
285
296
 
@@ -20,6 +20,7 @@
20
20
  """
21
21
  ################################################################################
22
22
 
23
+ import os
23
24
  import logging
24
25
  import sys
25
26
  import argparse
@@ -68,6 +69,8 @@ def parse_arguments():
68
69
  parser.add_argument('--debug', action='store_true', help='Enable debug output')
69
70
  parser.add_argument('branchname', nargs=1, type=str,
70
71
  help='The branch name (or a partial name that matches uniquely against a local branch, remote branch, commit ID or tag)')
72
+ parser.add_argument('--path', '-C', nargs=1, type=str, default=None,
73
+ help='Run the command in the specified directory')
71
74
 
72
75
  args = parser.parse_args()
73
76
 
@@ -76,6 +79,9 @@ def parse_arguments():
76
79
  if args.debug:
77
80
  logging.basicConfig(level=logging.INFO)
78
81
 
82
+ if args.path:
83
+ os.chdir(args.path[0])
84
+
79
85
  return args
80
86
 
81
87
  ################################################################################
@@ -198,9 +204,6 @@ def main():
198
204
  else:
199
205
  checkout_matching_branch(args, args.branchname[0])
200
206
 
201
- except git.GitError as exc:
202
- colour.error(exc.msg, exc.status)
203
-
204
207
  ################################################################################
205
208
 
206
209
  def git_co():
@@ -213,6 +216,8 @@ def git_co():
213
216
  sys.exit(1)
214
217
  except BrokenPipeError:
215
218
  sys.exit(2)
219
+ except git.GitError as exc:
220
+ colour.error(exc.msg, status=exc.status, prefix=True)
216
221
 
217
222
  ################################################################################
218
223
 
@@ -6,10 +6,12 @@ Report the oldest commit in common in the history of two commits
6
6
 
7
7
  ################################################################################
8
8
 
9
+ import os
9
10
  import sys
10
11
  import argparse
11
12
 
12
13
  import thingy.colour as colour
14
+ # TODO: Update to git2
13
15
  import thingy.git as git
14
16
 
15
17
  ################################################################################
@@ -21,6 +23,8 @@ def main():
21
23
 
22
24
  parser.add_argument('--short', '-s', action='store_true', help='Just output the ancestor commit ID')
23
25
  parser.add_argument('--long', '-l', action='store_true', help='Output the log entry for the commit')
26
+ parser.add_argument('--path', '-C', nargs=1, type=str, default=None,
27
+ help='Run the command in the specified directory')
24
28
  parser.add_argument('commit1', nargs='?', default='HEAD', help='First commit (default=HEAD)')
25
29
  parser.add_argument('commit2', nargs='?', default='master', help='Second commit (default=master)')
26
30
 
@@ -29,10 +33,12 @@ def main():
29
33
  if args.long and args.short:
30
34
  colour.error('The [BLUE:--long] and [BLUE:--short] options cannot be used together', prefix=True)
31
35
 
32
- try:
33
- ancestor = git.find_common_ancestor(args.commit1, args.commit2)
34
- except git.GitError as exc:
35
- colour.error(exc, status=exc.status, prefix=True)
36
+ # Change directory, if specified
37
+
38
+ if args.path:
39
+ os.chdir(args.path[0])
40
+
41
+ ancestor = git.find_common_ancestor(args.commit1, args.commit2)
36
42
 
37
43
  if args.short:
38
44
  print(ancestor)
@@ -54,6 +60,8 @@ def git_common():
54
60
  sys.exit(1)
55
61
  except BrokenPipeError:
56
62
  sys.exit(2)
63
+ except git.GitError as exc:
64
+ colour.error(exc.msg, status=exc.status, prefix=True)
57
65
 
58
66
  ################################################################################
59
67
 
@@ -2,11 +2,13 @@
2
2
  """Archive one or more branches by tagging the branch then deleting it
3
3
  The branch tag is 'archive/BRANCH_NAME'"""
4
4
 
5
+ import os
5
6
  import sys
6
7
  import argparse
7
8
  import fnmatch
8
9
 
9
10
  import thingy.colour as colour
11
+ # TODO: Update to git2
10
12
  import thingy.git as git
11
13
 
12
14
  ################################################################################
@@ -118,6 +120,8 @@ def main():
118
120
  parser = argparse.ArgumentParser(description='Archive, list or recover one or more Git branches')
119
121
  parser.add_argument('--list', '-l', action='store_true', help='List archived branches')
120
122
  parser.add_argument('--restore', '-r', action='store_true', help='Restore archived branches')
123
+ parser.add_argument('--path', '-C', nargs=1, type=str, default=None,
124
+ help='Run the command in the specified directory')
121
125
  parser.add_argument('branches', nargs='*', help='Branches')
122
126
 
123
127
  args = parser.parse_args()
@@ -128,6 +132,9 @@ def main():
128
132
  if not args.branches and not args.list:
129
133
  colour.error('No branches specified', prefix=True)
130
134
 
135
+ if args.path:
136
+ os.chdir(args.path[0])
137
+
131
138
  if args.list:
132
139
  list_archive_branches(args.branches)
133
140
  elif args.restore:
@@ -147,6 +154,8 @@ def git_hold():
147
154
  sys.exit(1)
148
155
  except BrokenPipeError:
149
156
  sys.exit(2)
157
+ except git.GitError as exc:
158
+ colour.error(exc.msg, status=exc.status, prefix=True)
150
159
 
151
160
  ################################################################################
152
161
 
@@ -4,10 +4,12 @@
4
4
  """ Push to Gitlab and create a merge request at the same time """
5
5
  ################################################################################
6
6
 
7
+ import os
7
8
  import logging
8
9
  import sys
9
10
  import argparse
10
11
 
12
+ # TODO: Update to git2
11
13
  import thingy.git as git
12
14
  import thingy.colour as colour
13
15
 
@@ -27,6 +29,8 @@ def parse_arguments():
27
29
  parser.add_argument('--parent', '-p', action='store', help='Override the default parent and specify the branch to merge onto')
28
30
  parser.add_argument('--reviewer', '-r', action='store', help='Specify the name of the reviewer for the merge request')
29
31
  parser.add_argument('--keep', '-k', action='store_true', help='Keep the source branch after the merge (default is to delete it).')
32
+ parser.add_argument('--path', '-C', nargs=1, type=str, default=None,
33
+ help='Run the command in the specified directory')
30
34
 
31
35
  args = parser.parse_args()
32
36
 
@@ -35,6 +39,11 @@ def parse_arguments():
35
39
  if args.debug:
36
40
  logging.basicConfig(level=logging.INFO)
37
41
 
42
+ # Change directory, if specified
43
+
44
+ if args.path:
45
+ os.chdir(args.path[0])
46
+
38
47
  return args
39
48
 
40
49
  ################################################################################
@@ -86,6 +95,8 @@ def git_mr():
86
95
  sys.exit(1)
87
96
  except BrokenPipeError:
88
97
  sys.exit(2)
98
+ except git.GitError as exc:
99
+ colour.error(exc.msg, status=exc.status, prefix=True)
89
100
 
90
101
  ################################################################################
91
102
 
@@ -7,9 +7,11 @@ the same commit. Can optionally ignore feature branches and/or report
7
7
  the distance to the potential parent.
8
8
  """
9
9
 
10
+ import os
10
11
  import argparse
11
12
  import sys
12
13
 
14
+ # TODO: Update to git2
13
15
  import thingy.git as git
14
16
  import thingy.colour as colour
15
17
 
@@ -23,33 +25,34 @@ def main():
23
25
  parser = argparse.ArgumentParser(description='Attempt to determine the parent branch for the specified branch (defaulting to the current one)')
24
26
  parser.add_argument('--all', '-a', action='store_true', help='Include feature branches as possible parents')
25
27
  parser.add_argument('--verbose', '-v', action='store_true', help='Report verbose results (includes number of commits between branch and parent)')
28
+ parser.add_argument('--path', '-C', nargs=1, type=str, default=None,
29
+ help='Run the command in the specified directory')
26
30
  parser.add_argument('branch', action='store', nargs='?', type=str, default=current_branch,
27
31
  help=f'Branch, commit or commit (defaults to current branch; {current_branch})')
28
32
 
29
33
  args = parser.parse_args()
30
34
 
31
- try:
32
- if args.all:
33
- any_parents, any_distance = git.parents(args.branch)
34
- else:
35
- any_parents = []
35
+ if args.path:
36
+ os.chdir(args.path[0])
36
37
 
37
- parents, distance = git.parents(args.branch, ignore='feature/*')
38
+ if args.all:
39
+ any_parents, any_distance = git.parents(args.branch)
40
+ else:
41
+ any_parents = []
38
42
 
39
- # If we have feature and non-feature branch candidates, decide which to report
40
- # (one or both) based on distance.
43
+ parents, distance = git.parents(args.branch, ignore='feature/*')
41
44
 
42
- if parents and any_parents:
43
- if any_distance < distance:
44
- parents = any_parents
45
- distance = any_distance
46
- elif any_distance == distance:
47
- for more in any_parents:
48
- if more not in parents:
49
- parents.append(more)
45
+ # If we have feature and non-feature branch candidates, decide which to report
46
+ # (one or both) based on distance.
50
47
 
51
- except git.GitError as exc:
52
- colour.error(exc.msg, status=exc.status, prefix=True)
48
+ if parents and any_parents:
49
+ if any_distance < distance:
50
+ parents = any_parents
51
+ distance = any_distance
52
+ elif any_distance == distance:
53
+ for more in any_parents:
54
+ if more not in parents:
55
+ parents.append(more)
53
56
 
54
57
  if parents:
55
58
  if args.verbose:
@@ -73,6 +76,8 @@ def git_parent():
73
76
  sys.exit(1)
74
77
  except BrokenPipeError:
75
78
  sys.exit(2)
79
+ except git.GitError as exc:
80
+ colour.error(exc.msg, status=exc.status, prefix=True)
76
81
 
77
82
  ################################################################################
78
83
 
@@ -9,6 +9,7 @@
9
9
  """
10
10
  ################################################################################
11
11
 
12
+ import os
12
13
  import sys
13
14
  import argparse
14
15
 
@@ -23,10 +24,17 @@ def main():
23
24
 
24
25
  parser = argparse.ArgumentParser(description='Apply or update a tag, optionally updating it on the remote as well.')
25
26
  parser.add_argument('--push', '-p', action='store_true', help='Push the tag to the remote')
27
+ parser.add_argument('--path', '-C', nargs=1, type=str, default=None,
28
+ help='Run the command in the specified directory')
26
29
  parser.add_argument('tag', nargs=1, help='The tag')
27
30
 
28
31
  args = parser.parse_args()
29
32
 
33
+ # Change directory, if specified
34
+
35
+ if args.path:
36
+ os.chdir(args.path[0])
37
+
30
38
  tag = args.tag[0]
31
39
 
32
40
  # Delete the tag if it currently exists, optionally pushing the deletion
@@ -49,6 +57,8 @@ def git_retag():
49
57
  sys.exit(1)
50
58
  except BrokenPipeError:
51
59
  sys.exit(2)
60
+ except git.GitError as exc:
61
+ colour.error(exc.msg, status=exc.status, prefix=True)
52
62
 
53
63
  ################################################################################
54
64
 
@@ -54,6 +54,7 @@ import subprocess
54
54
  import time
55
55
  from enum import IntEnum
56
56
 
57
+ # TODO: Update to git2
57
58
  import thingy.git as git
58
59
  import thingy.dc_curses as dc_curses
59
60
  import thingy.colour as colour
@@ -27,6 +27,7 @@ import argparse
27
27
  import fnmatch
28
28
  import logging
29
29
 
30
+ # TODO: Update to git2
30
31
  import thingy.git as git
31
32
  import thingy.colour as colour
32
33
 
@@ -62,6 +62,8 @@ def git_wt():
62
62
  sys.exit(1)
63
63
  except BrokenPipeError:
64
64
  sys.exit(2)
65
+ except git.GitError as exc:
66
+ colour.error(exc.msg, status=exc.status, prefix=True)
65
67
 
66
68
  ################################################################################
67
69
 
@@ -49,6 +49,7 @@ import os
49
49
  import sys
50
50
  import argparse
51
51
 
52
+ # TODO: Update to git2
52
53
  import thingy.git as git
53
54
  import thingy.colour as colour
54
55
 
@@ -34,7 +34,11 @@ import thingy.gitlab as gitlab
34
34
  ################################################################################
35
35
  # Configuration files to access
36
36
 
37
- (LOCAL, GLOBAL, SYSTEM) = list(range(3))
37
+ (WORKTREE, LOCAL, GLOBAL, SYSTEM) = list(range(4))
38
+
39
+ # Default default branches (can be overridden in .gitconfig via skilleter-thingy.defaultBranches
40
+
41
+ DEFAULT_DEFAULT_BRANCHES = 'develop,main,master'
38
42
 
39
43
  ################################################################################
40
44
 
@@ -814,7 +818,7 @@ def reset(sha1):
814
818
 
815
819
  ################################################################################
816
820
 
817
- def config_get(section, key, source=LOCAL, defaultvalue=None):
821
+ def config_get(section, key, source=None, defaultvalue=None):
818
822
  """ Return the specified configuration entry
819
823
  Returns a default value if no matching configuration entry exists """
820
824
 
@@ -824,6 +828,10 @@ def config_get(section, key, source=LOCAL, defaultvalue=None):
824
828
  cmd.append('--global')
825
829
  elif source == SYSTEM:
826
830
  cmd.append('--system')
831
+ elif source == LOCAL:
832
+ cmd.append('--local')
833
+ elif source == WORKTREE:
834
+ cmd.append('--worktree')
827
835
 
828
836
  cmd += ['--get', f'{section}.{key}']
829
837
 
@@ -834,7 +842,7 @@ def config_get(section, key, source=LOCAL, defaultvalue=None):
834
842
 
835
843
  ################################################################################
836
844
 
837
- def config_set(section, key, value, source=LOCAL):
845
+ def config_set(section, key, value, source=None):
838
846
  """ Set a configuration entry """
839
847
 
840
848
  cmd = ['config']
@@ -843,6 +851,10 @@ def config_set(section, key, value, source=LOCAL):
843
851
  cmd.append('--global')
844
852
  elif source == SYSTEM:
845
853
  cmd.append('--system')
854
+ elif source == LOCAL:
855
+ cmd.append('--local')
856
+ elif source == WORKTREE:
857
+ cmd.append('--worktree')
846
858
 
847
859
  cmd += ['--replace-all', f'{section}.{key}', value]
848
860
 
@@ -1172,12 +1184,13 @@ def default_branch():
1172
1184
  return None
1173
1185
 
1174
1186
  git_branches = branches()
1187
+ default_branches = config_get('skilleter-thingy', 'defaultBranches', defaultvalue=DEFAULT_DEFAULT_BRANCHES).split(',')
1175
1188
 
1176
- for branch in ('develop', 'main', 'master'):
1189
+ for branch in default_branches:
1177
1190
  if branch in git_branches:
1178
1191
  return branch
1179
1192
 
1180
- return None
1193
+ raise GitError('Unable to determine default branch in the repo')
1181
1194
 
1182
1195
  ################################################################################
1183
1196
 
@@ -36,13 +36,17 @@ import thingy.gitlab as gitlab
36
36
  ################################################################################
37
37
  # Configuration files to access
38
38
 
39
- (LOCAL, GLOBAL, SYSTEM) = list(range(3))
39
+ (WORKTREE, LOCAL, GLOBAL, SYSTEM) = list(range(4))
40
40
 
41
41
  # Options always passed to Git (disable autocorrect to stop it running the wrong command
42
42
  # if an invalid command name has been specified).
43
43
 
44
44
  STANDARD_GIT_OPTIONS = ['-c', 'help.autoCorrect=never']
45
45
 
46
+ # Default default branches (can be overridden in .gitconfig via skilleter-thingy.defaultBranches
47
+
48
+ DEFAULT_DEFAULT_BRANCHES = 'develop,main,master'
49
+
46
50
  ################################################################################
47
51
 
48
52
  class GitError(run.RunError):
@@ -74,7 +78,7 @@ def git(cmd, stdout=None, stderr=None, path=None):
74
78
  try:
75
79
  return run.run(git_cmd, stdout=stdout, stderr=stderr)
76
80
  except run.RunError as exc:
77
- raise GitError(exc.msg, exc.status)
81
+ raise GitError(exc.msg, exc.status) from exc
78
82
 
79
83
  ################################################################################
80
84
 
@@ -103,7 +107,7 @@ def git_run_status(cmd, stdout=None, stderr=None, path=None, redirect=True):
103
107
  errors='ignore',
104
108
  universal_newlines=True)
105
109
  else:
106
- result = subprocess.run(git_cmd)
110
+ result = subprocess.run(git_cmd, check=False)
107
111
 
108
112
  return (result.stdout or result.stderr), result.returncode
109
113
 
@@ -775,7 +779,7 @@ def reset(sha1, path=None):
775
779
 
776
780
  ################################################################################
777
781
 
778
- def config_get(section, key, source=LOCAL, defaultvalue=None, path=None):
782
+ def config_get(section, key, source=None, defaultvalue=None, path=None):
779
783
  """ Return the specified configuration entry
780
784
  Returns a default value if no matching configuration entry exists """
781
785
 
@@ -785,6 +789,10 @@ def config_get(section, key, source=LOCAL, defaultvalue=None, path=None):
785
789
  cmd.append('--global')
786
790
  elif source == SYSTEM:
787
791
  cmd.append('--system')
792
+ elif source == LOCAL:
793
+ cmd.append('--local')
794
+ elif source == WORKTREE:
795
+ cmd.append('--worktree')
788
796
 
789
797
  cmd += ['--get', f'{section}.{key}']
790
798
 
@@ -795,7 +803,7 @@ def config_get(section, key, source=LOCAL, defaultvalue=None, path=None):
795
803
 
796
804
  ################################################################################
797
805
 
798
- def config_set(section, key, value, source=LOCAL, path=None):
806
+ def config_set(section, key, value, source=None, path=None):
799
807
  """ Set a configuration entry """
800
808
 
801
809
  cmd = ['config']
@@ -804,6 +812,10 @@ def config_set(section, key, value, source=LOCAL, path=None):
804
812
  cmd.append('--global')
805
813
  elif source == SYSTEM:
806
814
  cmd.append('--system')
815
+ elif source == LOCAL:
816
+ cmd.append('--local')
817
+ elif source == WORKTREE:
818
+ cmd.append('--worktree')
807
819
 
808
820
  cmd += ['--replace-all', f'{section}.{key}', value]
809
821
 
@@ -1130,12 +1142,13 @@ def default_branch(path=None):
1130
1142
  return None
1131
1143
 
1132
1144
  git_branches = branches(path=path)
1145
+ default_branches = config_get('skilleter-thingy', 'defaultBranches', defaultvalue=DEFAULT_DEFAULT_BRANCHES).split(',')
1133
1146
 
1134
- for branch in ('develop', 'main', 'master'):
1147
+ for branch in default_branches:
1135
1148
  if branch in git_branches:
1136
1149
  return branch
1137
1150
 
1138
- return None
1151
+ raise GitError('Unable to determine default branch in the repo')
1139
1152
 
1140
1153
  ################################################################################
1141
1154
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: skilleter_thingy
3
- Version: 0.2.3
3
+ Version: 0.2.4
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,6 @@ skilleter_thingy/git_hold.py
17
17
  skilleter_thingy/git_mr.py
18
18
  skilleter_thingy/git_parent.py
19
19
  skilleter_thingy/git_retag.py
20
- skilleter_thingy/git_retag.sync-conflict-20250928-192600-TVSLRWK.py
21
20
  skilleter_thingy/git_review.py
22
21
  skilleter_thingy/git_update.py
23
22
  skilleter_thingy/git_wt.py
@@ -39,7 +38,6 @@ skilleter_thingy/venv_create.py
39
38
  skilleter_thingy/xchmod.py
40
39
  skilleter_thingy/yamlcheck.py
41
40
  skilleter_thingy.egg-info/PKG-INFO
42
- skilleter_thingy.egg-info/PKG-INFO 2
43
41
  skilleter_thingy.egg-info/SOURCES.txt
44
42
  skilleter_thingy.egg-info/dependency_links.txt
45
43
  skilleter_thingy.egg-info/entry_points.txt
@@ -1,54 +0,0 @@
1
- #! /usr/bin/env python3
2
-
3
- ################################################################################
4
- """ Apply or update a tag, optionally updating it on the remote as well.
5
-
6
- Copyright (C) 2025 John Skilleter
7
-
8
- Licence: GPL v3 or later
9
- """
10
- ################################################################################
11
-
12
- import sys
13
- import argparse
14
-
15
- import thingy.git2 as git
16
-
17
- ################################################################################
18
-
19
- def main():
20
- """ Main function """
21
-
22
- # Command line parameters
23
-
24
- parser = argparse.ArgumentParser(description='Apply or update a tag, optionally updating it on the remote as well.')
25
- parser.add_argument('--push', '-p', action='store_true', help='Push the tag to the remote')
26
- parser.add_argument('tag', nargs=1, help='The tag')
27
-
28
- args = parser.parse_args()
29
-
30
- # Delete the tag if it currently exists, optionally pushing the deletion
31
-
32
- if args.tag in git.tags():
33
- git.tag_delete(args.tag, push=args.push)
34
-
35
- # Apply the tag
36
-
37
- git.tag_apply(args.tag, push=args.push)
38
-
39
- ################################################################################
40
-
41
- def git_retag():
42
- """Entry point"""
43
-
44
- try:
45
- main()
46
- except KeyboardInterrupt:
47
- sys.exit(1)
48
- except BrokenPipeError:
49
- sys.exit(2)
50
-
51
- ################################################################################
52
-
53
- if __name__ == '__main__':
54
- git_retag()
@@ -1,193 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: skilleter_thingy
3
- Version: 0.0.49
4
- Summary: A collection of useful utilities, mainly aimed at making Git more friendly
5
- Author-email: John Skilleter <john@skilleter.org.uk>
6
- Project-URL: Home, https://skilleter.org.uk
7
- Classifier: Programming Language :: Python :: 3
8
- Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
9
- Classifier: Operating System :: OS Independent
10
- Requires-Python: >=3.6
11
- Description-Content-Type: text/markdown
12
- License-File: LICENSE
13
- Requires-Dist: imagehash
14
- Requires-Dist: inotify
15
- Requires-Dist: pillow
16
- Requires-Dist: psutil
17
- Requires-Dist: pyaml
18
- Requires-Dist: pygit2
19
- Requires-Dist: python-dateutil
20
- Requires-Dist: requests
21
-
22
- # Thingy
23
-
24
- Licence: GPL v3
25
-
26
- Author: John Skilleter v0.99
27
-
28
- Collection of shell utilities and configuration stuff for Linux and MacOS. Untested on other operating systems.
29
-
30
- Permanently (for the forseeable future!) in a beta stage - usable, with a few rough edges, and probably with bugs when used in way I'm not expecting!
31
-
32
- The following commands are documented in detail in the help output that can be displayed by running the command with the '--help' option.
33
-
34
- This README just contains a summary of the functionality of each command.
35
-
36
- # General Commands
37
-
38
- ## addpath
39
-
40
- Update a $PATH-type variable by adding or removing entries.
41
-
42
- ## borger
43
-
44
- Wrapper for the borg backup utility to make it easier to use with a fixed set of options.
45
-
46
- ## console-colours
47
-
48
- Display all available colours in the console.
49
-
50
- ## diskspacecheck
51
-
52
- Check how much free space is available on all filesystems, ignoring read-only filesystems, /dev and tmpfs.
53
-
54
- Issue a warning if any are above 90% used.
55
-
56
- ## docker-purge
57
-
58
- Stop or kill docker instances and/or remove docker images.
59
-
60
- ## ffind
61
-
62
- Simple file find utility
63
-
64
- Implements the functionality of the find command that is regularly used in a simpler fashion and ignores all the options that nobody ever uses.
65
-
66
- ## gl
67
-
68
- ### gphotosync
69
-
70
- Utility for syncing photos from Google Photos to local storage
71
-
72
- ## linecount
73
-
74
- Count lines of code in a directory tree organised by file type.
75
-
76
- ## moviemover
77
-
78
- Search for files matching a wildcard in a directory tree and move them to an equivalent location in a different tree
79
-
80
- ## phototidier
81
-
82
- Perform various tidying operations on a directory full of photos:
83
-
84
- * Remove leading '$' and '_' from filenames
85
- * Move files in hidden directories up 1 level
86
- * If the EXIF data in a photo indicates that it was taken on date that doesn't match the name of the directory it is stored in (in YYYY-MM-DD format) then it is moved to the correct directory, creating it if necessary.
87
-
88
- All move/rename operations are carried out safely with the file being moved having
89
- a numeric suffix added to the name if it conflicts with an existing file.
90
-
91
- ## photodupe
92
-
93
- ## py-audit
94
-
95
- Query api.osv.dev to determine whether a specified version of a particular Python package is subject to known security vulnerabilities
96
-
97
- ## readable
98
-
99
- Pipe for converting colour combinations to make them readable on a light background
100
-
101
- ## remdir
102
-
103
- Recursively delete empty directories
104
-
105
- ## rmdupe
106
-
107
- Search for duplicate files
108
-
109
- ## rpylint
110
-
111
- Run pylint on all the Python source files in the current tree
112
-
113
- ## s3-sync
114
-
115
- Synchronise files from S3 to local storage.
116
-
117
- ## splitpics
118
-
119
- Copy a directory full of pictures to a destination, creating subdiretories with a fixed number of pictures in each in the destination directory for use with FAT filesystems and digital photo frames.
120
-
121
- ## strreplace
122
-
123
- Simple search and replace utility for those times when trying to escape characters in a regexp to use sed is more hassle than it is worth.
124
-
125
- ## sysmon
126
-
127
- ## tfm
128
-
129
- Console-based file-manager, similar to Midnight Commander but better.
130
-
131
- ## tfparse
132
-
133
- Read JSON Terraform output and convert back to human-readable text
134
- This allows multiple errors and warnings to be reported as there's
135
- no way of doing this directly from Terraform
136
-
137
- ## trimpath
138
-
139
- Intelligently trim a path to fit a given width (used by gitprompt)
140
-
141
- ## window-rename
142
-
143
- ## xchmod
144
-
145
- WIP: Command to run chmod only on files that need it (only modifies files that don't have the required permissions already).
146
-
147
- Currently implements a *very* restricted set of functionality.
148
-
149
- ## yamlcheck
150
-
151
- YAML validator - checks that a file is valid YAML (use yamllint to verify that it is nicely-formatted YAML).
152
-
153
- # Git Utilities
154
-
155
- ## ggit
156
-
157
- Run a git command in all repos under the current directory
158
-
159
- ## ggrep
160
-
161
- Run 'git grep' in all repos under the current directory
162
-
163
- ## gitprompt
164
-
165
- Output a string containing colour-coded shell nesting level, current directory and git working tree status (used in the shell prompt).
166
-
167
- ## git ca
168
-
169
- Improved version of 'git commit --amend'. Updates files that are already in the commit and, optionally, adds and commits additional files.
170
-
171
- ## git cleanup
172
-
173
- List or delete branches that have already been merged and delete tracking branches that are no longer on ther remote.
174
-
175
- ## git co
176
-
177
- ## git mr
178
-
179
- ## git parent
180
-
181
- ## git update
182
-
183
- Update the repo from the remote, rebase branches against their parents, optionally run git cleanup
184
-
185
- ## git wt
186
-
187
- Output the top level directory of the git working tree or return an error if we are not in a git working tree.
188
-
189
- ## git review
190
-
191
- ## venv-create
192
-
193
- Create a script to create/update a virtual environment and run a python script in it.