skilleter-thingy 0.2.1__py3-none-any.whl → 0.2.3__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.

Files changed (34) hide show
  1. skilleter_thingy/ggit.py +0 -1
  2. skilleter_thingy/ggrep.py +0 -1
  3. skilleter_thingy/git_br.py +0 -7
  4. skilleter_thingy/git_ca.py +0 -8
  5. skilleter_thingy/git_cleanup.py +0 -11
  6. skilleter_thingy/git_co.py +3 -8
  7. skilleter_thingy/git_common.py +4 -12
  8. skilleter_thingy/git_hold.py +0 -9
  9. skilleter_thingy/git_mr.py +0 -11
  10. skilleter_thingy/git_parent.py +18 -23
  11. skilleter_thingy/git_retag.py +0 -10
  12. skilleter_thingy/git_retag.sync-conflict-20250928-192600-TVSLRWK.py +54 -0
  13. skilleter_thingy/git_review.py +0 -1
  14. skilleter_thingy/git_update.py +0 -1
  15. skilleter_thingy/git_wt.py +0 -2
  16. skilleter_thingy/gitprompt.py +0 -1
  17. skilleter_thingy/thingy/git.py +5 -18
  18. skilleter_thingy/thingy/git2.py +7 -20
  19. {skilleter_thingy-0.2.1.dist-info → skilleter_thingy-0.2.3.dist-info}/METADATA +1 -46
  20. skilleter_thingy-0.2.3.dist-info/PKG-INFO 2 +193 -0
  21. {skilleter_thingy-0.2.1.dist-info → skilleter_thingy-0.2.3.dist-info}/RECORD +25 -32
  22. {skilleter_thingy-0.2.1.dist-info → skilleter_thingy-0.2.3.dist-info}/entry_points.txt +0 -9
  23. skilleter_thingy/borger.py +0 -273
  24. skilleter_thingy/diskspacecheck.py +0 -67
  25. skilleter_thingy/localphotosync.py +0 -201
  26. skilleter_thingy/moviemover.py +0 -133
  27. skilleter_thingy/photodupe.py +0 -135
  28. skilleter_thingy/phototidier.py +0 -248
  29. skilleter_thingy/splitpics.py +0 -99
  30. skilleter_thingy/sysmon.py +0 -435
  31. skilleter_thingy/window_rename.py +0 -92
  32. {skilleter_thingy-0.2.1.dist-info → skilleter_thingy-0.2.3.dist-info}/WHEEL +0 -0
  33. {skilleter_thingy-0.2.1.dist-info → skilleter_thingy-0.2.3.dist-info}/licenses/LICENSE +0 -0
  34. {skilleter_thingy-0.2.1.dist-info → skilleter_thingy-0.2.3.dist-info}/top_level.txt +0 -0
skilleter_thingy/ggit.py CHANGED
@@ -7,7 +7,6 @@ import os
7
7
  import subprocess
8
8
  import argparse
9
9
 
10
- # TODO: Update to git2
11
10
  import thingy.git as git
12
11
  import thingy.colour as colour
13
12
 
skilleter_thingy/ggrep.py CHANGED
@@ -14,7 +14,6 @@ import sys
14
14
  import argparse
15
15
 
16
16
  import thingy.colour as colour
17
- # TODO: Update to git2
18
17
  import thingy.git as git
19
18
 
20
19
  ################################################################################
@@ -13,7 +13,6 @@
13
13
  """
14
14
  ################################################################################
15
15
 
16
- import os
17
16
  import sys
18
17
  import argparse
19
18
  import fnmatch
@@ -22,7 +21,6 @@ import datetime
22
21
  from dateutil.parser import parse
23
22
  from dateutil.relativedelta import relativedelta
24
23
 
25
- # TODO: Update to git2
26
24
  import thingy.git as git
27
25
  import thingy.colour as colour
28
26
 
@@ -36,15 +34,10 @@ def parse_command_line():
36
34
  parser.add_argument('--all', '-a', action='store_true', help='List all branches, including remotes')
37
35
  parser.add_argument('--delete', '-d', action='store_true',
38
36
  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')
41
37
  parser.add_argument('branches', nargs='*', help='Filter the list of branches according to one or more patterns')
42
38
 
43
39
  args = parser.parse_args()
44
40
 
45
- if args.path:
46
- os.chdir(args.path[0])
47
-
48
41
  if args.delete and not args.branches:
49
42
  colour.error('You must specify the branches to delete', prefix=True)
50
43
 
@@ -18,7 +18,6 @@ import sys
18
18
  import logging
19
19
 
20
20
  import thingy.colour as colour
21
- # TODO: Update to git2
22
21
  import thingy.git as git
23
22
 
24
23
  ################################################################################
@@ -44,8 +43,6 @@ def main():
44
43
  parser.add_argument('--patch', '-p', action='store_true', help='Use the interactive patch selection interface to chose which changes to commit.')
45
44
  parser.add_argument('--verbose', '-v', action='store_true', help='Verbose mode')
46
45
  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')
49
46
 
50
47
  parser.add_argument('files', nargs='*', help='List of files to add to the commit')
51
48
 
@@ -57,11 +54,6 @@ def main():
57
54
  logging.basicConfig(level=logging.INFO)
58
55
  logging.info('Debug logging enabled')
59
56
 
60
- # Change directory, if specified
61
-
62
- if args.path:
63
- os.chdir(args.path[0])
64
-
65
57
  # 'Add' implies 'all'
66
58
 
67
59
  if args.everything:
@@ -9,12 +9,10 @@
9
9
  """
10
10
  ################################################################################
11
11
 
12
- import os
13
12
  import sys
14
13
  import argparse
15
14
  import logging
16
15
 
17
- # TODO: Update to git2
18
16
  import thingy.git as git
19
17
  import thingy.colour as colour
20
18
 
@@ -40,8 +38,6 @@ def parse_command_line():
40
38
  parser.add_argument('--unmerged', '-u', action='store_true', dest='list_unmerged', help='List branches that have NOT been merged')
41
39
  parser.add_argument('--yes', '-y', action='store_true', dest='force', help='Assume "yes" in response to any prompts (e.g. to delete branches)')
42
40
  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')
45
41
 
46
42
  parser.add_argument('branches', nargs='*', help='List of branches to check (default is all branches)')
47
43
 
@@ -98,11 +94,6 @@ def main():
98
94
  if args.debug:
99
95
  logging.basicConfig(level=logging.INFO)
100
96
 
101
- # Change directory, if specified
102
-
103
- if args.path:
104
- os.chdir(args.path[0])
105
-
106
97
  # Get the list of all local branches
107
98
 
108
99
  try:
@@ -289,8 +280,6 @@ def git_cleanup():
289
280
  sys.exit(1)
290
281
  except BrokenPipeError:
291
282
  sys.exit(2)
292
- except git.GitError as exc:
293
- colour.error(exc.msg, status=exc.status, prefix=True)
294
283
 
295
284
  ################################################################################
296
285
 
@@ -20,7 +20,6 @@
20
20
  """
21
21
  ################################################################################
22
22
 
23
- import os
24
23
  import logging
25
24
  import sys
26
25
  import argparse
@@ -69,8 +68,6 @@ def parse_arguments():
69
68
  parser.add_argument('--debug', action='store_true', help='Enable debug output')
70
69
  parser.add_argument('branchname', nargs=1, type=str,
71
70
  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')
74
71
 
75
72
  args = parser.parse_args()
76
73
 
@@ -79,9 +76,6 @@ def parse_arguments():
79
76
  if args.debug:
80
77
  logging.basicConfig(level=logging.INFO)
81
78
 
82
- if args.path:
83
- os.chdir(args.path[0])
84
-
85
79
  return args
86
80
 
87
81
  ################################################################################
@@ -204,6 +198,9 @@ def main():
204
198
  else:
205
199
  checkout_matching_branch(args, args.branchname[0])
206
200
 
201
+ except git.GitError as exc:
202
+ colour.error(exc.msg, exc.status)
203
+
207
204
  ################################################################################
208
205
 
209
206
  def git_co():
@@ -216,8 +213,6 @@ def git_co():
216
213
  sys.exit(1)
217
214
  except BrokenPipeError:
218
215
  sys.exit(2)
219
- except git.GitError as exc:
220
- colour.error(exc.msg, status=exc.status, prefix=True)
221
216
 
222
217
  ################################################################################
223
218
 
@@ -6,12 +6,10 @@ Report the oldest commit in common in the history of two commits
6
6
 
7
7
  ################################################################################
8
8
 
9
- import os
10
9
  import sys
11
10
  import argparse
12
11
 
13
12
  import thingy.colour as colour
14
- # TODO: Update to git2
15
13
  import thingy.git as git
16
14
 
17
15
  ################################################################################
@@ -23,8 +21,6 @@ def main():
23
21
 
24
22
  parser.add_argument('--short', '-s', action='store_true', help='Just output the ancestor commit ID')
25
23
  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')
28
24
  parser.add_argument('commit1', nargs='?', default='HEAD', help='First commit (default=HEAD)')
29
25
  parser.add_argument('commit2', nargs='?', default='master', help='Second commit (default=master)')
30
26
 
@@ -33,12 +29,10 @@ def main():
33
29
  if args.long and args.short:
34
30
  colour.error('The [BLUE:--long] and [BLUE:--short] options cannot be used together', prefix=True)
35
31
 
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)
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)
42
36
 
43
37
  if args.short:
44
38
  print(ancestor)
@@ -60,8 +54,6 @@ def git_common():
60
54
  sys.exit(1)
61
55
  except BrokenPipeError:
62
56
  sys.exit(2)
63
- except git.GitError as exc:
64
- colour.error(exc.msg, status=exc.status, prefix=True)
65
57
 
66
58
  ################################################################################
67
59
 
@@ -2,13 +2,11 @@
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
6
5
  import sys
7
6
  import argparse
8
7
  import fnmatch
9
8
 
10
9
  import thingy.colour as colour
11
- # TODO: Update to git2
12
10
  import thingy.git as git
13
11
 
14
12
  ################################################################################
@@ -120,8 +118,6 @@ def main():
120
118
  parser = argparse.ArgumentParser(description='Archive, list or recover one or more Git branches')
121
119
  parser.add_argument('--list', '-l', action='store_true', help='List archived branches')
122
120
  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')
125
121
  parser.add_argument('branches', nargs='*', help='Branches')
126
122
 
127
123
  args = parser.parse_args()
@@ -132,9 +128,6 @@ def main():
132
128
  if not args.branches and not args.list:
133
129
  colour.error('No branches specified', prefix=True)
134
130
 
135
- if args.path:
136
- os.chdir(args.path[0])
137
-
138
131
  if args.list:
139
132
  list_archive_branches(args.branches)
140
133
  elif args.restore:
@@ -154,8 +147,6 @@ def git_hold():
154
147
  sys.exit(1)
155
148
  except BrokenPipeError:
156
149
  sys.exit(2)
157
- except git.GitError as exc:
158
- colour.error(exc.msg, status=exc.status, prefix=True)
159
150
 
160
151
  ################################################################################
161
152
 
@@ -4,12 +4,10 @@
4
4
  """ Push to Gitlab and create a merge request at the same time """
5
5
  ################################################################################
6
6
 
7
- import os
8
7
  import logging
9
8
  import sys
10
9
  import argparse
11
10
 
12
- # TODO: Update to git2
13
11
  import thingy.git as git
14
12
  import thingy.colour as colour
15
13
 
@@ -29,8 +27,6 @@ def parse_arguments():
29
27
  parser.add_argument('--parent', '-p', action='store', help='Override the default parent and specify the branch to merge onto')
30
28
  parser.add_argument('--reviewer', '-r', action='store', help='Specify the name of the reviewer for the merge request')
31
29
  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')
34
30
 
35
31
  args = parser.parse_args()
36
32
 
@@ -39,11 +35,6 @@ def parse_arguments():
39
35
  if args.debug:
40
36
  logging.basicConfig(level=logging.INFO)
41
37
 
42
- # Change directory, if specified
43
-
44
- if args.path:
45
- os.chdir(args.path[0])
46
-
47
38
  return args
48
39
 
49
40
  ################################################################################
@@ -95,8 +86,6 @@ def git_mr():
95
86
  sys.exit(1)
96
87
  except BrokenPipeError:
97
88
  sys.exit(2)
98
- except git.GitError as exc:
99
- colour.error(exc.msg, status=exc.status, prefix=True)
100
89
 
101
90
  ################################################################################
102
91
 
@@ -7,11 +7,9 @@ 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
11
10
  import argparse
12
11
  import sys
13
12
 
14
- # TODO: Update to git2
15
13
  import thingy.git as git
16
14
  import thingy.colour as colour
17
15
 
@@ -25,34 +23,33 @@ def main():
25
23
  parser = argparse.ArgumentParser(description='Attempt to determine the parent branch for the specified branch (defaulting to the current one)')
26
24
  parser.add_argument('--all', '-a', action='store_true', help='Include feature branches as possible parents')
27
25
  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')
30
26
  parser.add_argument('branch', action='store', nargs='?', type=str, default=current_branch,
31
27
  help=f'Branch, commit or commit (defaults to current branch; {current_branch})')
32
28
 
33
29
  args = parser.parse_args()
34
30
 
35
- if args.path:
36
- os.chdir(args.path[0])
31
+ try:
32
+ if args.all:
33
+ any_parents, any_distance = git.parents(args.branch)
34
+ else:
35
+ any_parents = []
37
36
 
38
- if args.all:
39
- any_parents, any_distance = git.parents(args.branch)
40
- else:
41
- any_parents = []
37
+ parents, distance = git.parents(args.branch, ignore='feature/*')
42
38
 
43
- parents, distance = git.parents(args.branch, ignore='feature/*')
39
+ # If we have feature and non-feature branch candidates, decide which to report
40
+ # (one or both) based on distance.
44
41
 
45
- # If we have feature and non-feature branch candidates, decide which to report
46
- # (one or both) based on distance.
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)
47
50
 
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)
51
+ except git.GitError as exc:
52
+ colour.error(exc.msg, status=exc.status, prefix=True)
56
53
 
57
54
  if parents:
58
55
  if args.verbose:
@@ -76,8 +73,6 @@ def git_parent():
76
73
  sys.exit(1)
77
74
  except BrokenPipeError:
78
75
  sys.exit(2)
79
- except git.GitError as exc:
80
- colour.error(exc.msg, status=exc.status, prefix=True)
81
76
 
82
77
  ################################################################################
83
78
 
@@ -9,7 +9,6 @@
9
9
  """
10
10
  ################################################################################
11
11
 
12
- import os
13
12
  import sys
14
13
  import argparse
15
14
 
@@ -24,17 +23,10 @@ def main():
24
23
 
25
24
  parser = argparse.ArgumentParser(description='Apply or update a tag, optionally updating it on the remote as well.')
26
25
  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')
29
26
  parser.add_argument('tag', nargs=1, help='The tag')
30
27
 
31
28
  args = parser.parse_args()
32
29
 
33
- # Change directory, if specified
34
-
35
- if args.path:
36
- os.chdir(args.path[0])
37
-
38
30
  tag = args.tag[0]
39
31
 
40
32
  # Delete the tag if it currently exists, optionally pushing the deletion
@@ -57,8 +49,6 @@ def git_retag():
57
49
  sys.exit(1)
58
50
  except BrokenPipeError:
59
51
  sys.exit(2)
60
- except git.GitError as exc:
61
- colour.error(exc.msg, status=exc.status, prefix=True)
62
52
 
63
53
  ################################################################################
64
54
 
@@ -0,0 +1,54 @@
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()
@@ -54,7 +54,6 @@ import subprocess
54
54
  import time
55
55
  from enum import IntEnum
56
56
 
57
- # TODO: Update to git2
58
57
  import thingy.git as git
59
58
  import thingy.dc_curses as dc_curses
60
59
  import thingy.colour as colour
@@ -27,7 +27,6 @@ import argparse
27
27
  import fnmatch
28
28
  import logging
29
29
 
30
- # TODO: Update to git2
31
30
  import thingy.git as git
32
31
  import thingy.colour as colour
33
32
 
@@ -62,8 +62,6 @@ 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)
67
65
 
68
66
  ################################################################################
69
67
 
@@ -49,7 +49,6 @@ import os
49
49
  import sys
50
50
  import argparse
51
51
 
52
- # TODO: Update to git2
53
52
  import thingy.git as git
54
53
  import thingy.colour as colour
55
54
 
@@ -34,11 +34,7 @@ import thingy.gitlab as gitlab
34
34
  ################################################################################
35
35
  # Configuration files to access
36
36
 
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'
37
+ (LOCAL, GLOBAL, SYSTEM) = list(range(3))
42
38
 
43
39
  ################################################################################
44
40
 
@@ -818,7 +814,7 @@ def reset(sha1):
818
814
 
819
815
  ################################################################################
820
816
 
821
- def config_get(section, key, source=None, defaultvalue=None):
817
+ def config_get(section, key, source=LOCAL, defaultvalue=None):
822
818
  """ Return the specified configuration entry
823
819
  Returns a default value if no matching configuration entry exists """
824
820
 
@@ -828,10 +824,6 @@ def config_get(section, key, source=None, defaultvalue=None):
828
824
  cmd.append('--global')
829
825
  elif source == SYSTEM:
830
826
  cmd.append('--system')
831
- elif source == LOCAL:
832
- cmd.append('--local')
833
- elif source == WORKTREE:
834
- cmd.append('--worktree')
835
827
 
836
828
  cmd += ['--get', f'{section}.{key}']
837
829
 
@@ -842,7 +834,7 @@ def config_get(section, key, source=None, defaultvalue=None):
842
834
 
843
835
  ################################################################################
844
836
 
845
- def config_set(section, key, value, source=None):
837
+ def config_set(section, key, value, source=LOCAL):
846
838
  """ Set a configuration entry """
847
839
 
848
840
  cmd = ['config']
@@ -851,10 +843,6 @@ def config_set(section, key, value, source=None):
851
843
  cmd.append('--global')
852
844
  elif source == SYSTEM:
853
845
  cmd.append('--system')
854
- elif source == LOCAL:
855
- cmd.append('--local')
856
- elif source == WORKTREE:
857
- cmd.append('--worktree')
858
846
 
859
847
  cmd += ['--replace-all', f'{section}.{key}', value]
860
848
 
@@ -1184,13 +1172,12 @@ def default_branch():
1184
1172
  return None
1185
1173
 
1186
1174
  git_branches = branches()
1187
- default_branches = config_get('skilleter-thingy', 'defaultBranches', defaultvalue=DEFAULT_DEFAULT_BRANCHES).split(',')
1188
1175
 
1189
- for branch in default_branches:
1176
+ for branch in ('develop', 'main', 'master'):
1190
1177
  if branch in git_branches:
1191
1178
  return branch
1192
1179
 
1193
- raise GitError('Unable to determine default branch in the repo')
1180
+ return None
1194
1181
 
1195
1182
  ################################################################################
1196
1183
 
@@ -36,17 +36,13 @@ import thingy.gitlab as gitlab
36
36
  ################################################################################
37
37
  # Configuration files to access
38
38
 
39
- (WORKTREE, LOCAL, GLOBAL, SYSTEM) = list(range(4))
39
+ (LOCAL, GLOBAL, SYSTEM) = list(range(3))
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
-
50
46
  ################################################################################
51
47
 
52
48
  class GitError(run.RunError):
@@ -78,7 +74,7 @@ def git(cmd, stdout=None, stderr=None, path=None):
78
74
  try:
79
75
  return run.run(git_cmd, stdout=stdout, stderr=stderr)
80
76
  except run.RunError as exc:
81
- raise GitError(exc.msg, exc.status) from exc
77
+ raise GitError(exc.msg, exc.status)
82
78
 
83
79
  ################################################################################
84
80
 
@@ -107,7 +103,7 @@ def git_run_status(cmd, stdout=None, stderr=None, path=None, redirect=True):
107
103
  errors='ignore',
108
104
  universal_newlines=True)
109
105
  else:
110
- result = subprocess.run(git_cmd, check=False)
106
+ result = subprocess.run(git_cmd)
111
107
 
112
108
  return (result.stdout or result.stderr), result.returncode
113
109
 
@@ -779,7 +775,7 @@ def reset(sha1, path=None):
779
775
 
780
776
  ################################################################################
781
777
 
782
- def config_get(section, key, source=None, defaultvalue=None, path=None):
778
+ def config_get(section, key, source=LOCAL, defaultvalue=None, path=None):
783
779
  """ Return the specified configuration entry
784
780
  Returns a default value if no matching configuration entry exists """
785
781
 
@@ -789,10 +785,6 @@ def config_get(section, key, source=None, defaultvalue=None, path=None):
789
785
  cmd.append('--global')
790
786
  elif source == SYSTEM:
791
787
  cmd.append('--system')
792
- elif source == LOCAL:
793
- cmd.append('--local')
794
- elif source == WORKTREE:
795
- cmd.append('--worktree')
796
788
 
797
789
  cmd += ['--get', f'{section}.{key}']
798
790
 
@@ -803,7 +795,7 @@ def config_get(section, key, source=None, defaultvalue=None, path=None):
803
795
 
804
796
  ################################################################################
805
797
 
806
- def config_set(section, key, value, source=None, path=None):
798
+ def config_set(section, key, value, source=LOCAL, path=None):
807
799
  """ Set a configuration entry """
808
800
 
809
801
  cmd = ['config']
@@ -812,10 +804,6 @@ def config_set(section, key, value, source=None, path=None):
812
804
  cmd.append('--global')
813
805
  elif source == SYSTEM:
814
806
  cmd.append('--system')
815
- elif source == LOCAL:
816
- cmd.append('--local')
817
- elif source == WORKTREE:
818
- cmd.append('--worktree')
819
807
 
820
808
  cmd += ['--replace-all', f'{section}.{key}', value]
821
809
 
@@ -1142,13 +1130,12 @@ def default_branch(path=None):
1142
1130
  return None
1143
1131
 
1144
1132
  git_branches = branches(path=path)
1145
- default_branches = config_get('skilleter-thingy', 'defaultBranches', defaultvalue=DEFAULT_DEFAULT_BRANCHES).split(',')
1146
1133
 
1147
- for branch in default_branches:
1134
+ for branch in ('develop', 'main', 'master'):
1148
1135
  if branch in git_branches:
1149
1136
  return branch
1150
1137
 
1151
- raise GitError('Unable to determine default branch in the repo')
1138
+ return None
1152
1139
 
1153
1140
  ################################################################################
1154
1141