skilleter-thingy 0.2.3__py3-none-any.whl → 0.2.6__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.
- skilleter_thingy/ggit.py +1 -0
- skilleter_thingy/ggrep.py +1 -0
- skilleter_thingy/git_br.py +7 -0
- skilleter_thingy/git_ca.py +8 -0
- skilleter_thingy/git_cleanup.py +11 -0
- skilleter_thingy/git_co.py +16 -12
- skilleter_thingy/git_common.py +12 -4
- skilleter_thingy/git_hold.py +11 -2
- skilleter_thingy/git_mr.py +11 -0
- skilleter_thingy/git_parent.py +23 -18
- skilleter_thingy/git_retag.py +12 -1
- skilleter_thingy/git_review.py +1 -0
- skilleter_thingy/git_update.py +1 -0
- skilleter_thingy/git_wt.py +3 -0
- skilleter_thingy/gitprompt.py +1 -0
- skilleter_thingy/thingy/git.py +20 -7
- skilleter_thingy/thingy/git2.py +31 -10
- skilleter_thingy/thingy/run.py +0 -1
- {skilleter_thingy-0.2.3.dist-info → skilleter_thingy-0.2.6.dist-info}/METADATA +1 -1
- {skilleter_thingy-0.2.3.dist-info → skilleter_thingy-0.2.6.dist-info}/RECORD +24 -26
- skilleter_thingy/git_retag.sync-conflict-20250928-192600-TVSLRWK.py +0 -54
- skilleter_thingy-0.2.3.dist-info/PKG-INFO 2 +0 -193
- {skilleter_thingy-0.2.3.dist-info → skilleter_thingy-0.2.6.dist-info}/WHEEL +0 -0
- {skilleter_thingy-0.2.3.dist-info → skilleter_thingy-0.2.6.dist-info}/entry_points.txt +0 -0
- {skilleter_thingy-0.2.3.dist-info → skilleter_thingy-0.2.6.dist-info}/licenses/LICENSE +0 -0
- {skilleter_thingy-0.2.3.dist-info → skilleter_thingy-0.2.6.dist-info}/top_level.txt +0 -0
skilleter_thingy/ggit.py
CHANGED
skilleter_thingy/ggrep.py
CHANGED
skilleter_thingy/git_br.py
CHANGED
|
@@ -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
|
|
skilleter_thingy/git_ca.py
CHANGED
|
@@ -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:
|
skilleter_thingy/git_cleanup.py
CHANGED
|
@@ -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
|
|
skilleter_thingy/git_co.py
CHANGED
|
@@ -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
|
################################################################################
|
|
@@ -99,11 +105,11 @@ def checkout_matching_branch(args, branchname):
|
|
|
99
105
|
if args.exact:
|
|
100
106
|
commits = [branchname] if git.iscommit(branchname, remote=True) else []
|
|
101
107
|
|
|
102
|
-
logging.info(
|
|
108
|
+
logging.info('Exact match required: %s', commits)
|
|
103
109
|
elif git.iscommit(branchname, remote=True):
|
|
104
110
|
commits = [branchname]
|
|
105
111
|
|
|
106
|
-
logging.info(
|
|
112
|
+
logging.info('Exact match found for %s', branchname)
|
|
107
113
|
else:
|
|
108
114
|
commits = git.matching_branch(branchname)
|
|
109
115
|
|
|
@@ -158,7 +164,7 @@ def checkout_matching_branch(args, branchname):
|
|
|
158
164
|
colour.write(f'ERROR: Most recent commit on {commit} is {author} - Use the --force option to force-update your own branch!')
|
|
159
165
|
sys.exit(1)
|
|
160
166
|
|
|
161
|
-
colour.write('Removing existing [BLUE
|
|
167
|
+
colour.write('Removing existing [BLUE:{commit}] branch')
|
|
162
168
|
git.delete_branch(commit, force=True)
|
|
163
169
|
else:
|
|
164
170
|
colour.write(f'No corresponding remote branch [BLUE:{remote_branch}] exists')
|
|
@@ -180,7 +186,7 @@ def checkout_matching_branch(args, branchname):
|
|
|
180
186
|
print(text)
|
|
181
187
|
|
|
182
188
|
elif not commits:
|
|
183
|
-
colour.write('[BOLD]No branches or commits matching [NORMAL][BLUE]
|
|
189
|
+
colour.write(f'[BOLD]No branches or commits matching [NORMAL][BLUE]{branchname}[NORMAL]')
|
|
184
190
|
else:
|
|
185
191
|
colour.write('[BOLD]Multiple matches for [NORMAL][BLUE]%s[NORMAL]: %s' % (branchname, ', '.join(commits)))
|
|
186
192
|
|
|
@@ -192,14 +198,10 @@ def main():
|
|
|
192
198
|
|
|
193
199
|
args = parse_arguments()
|
|
194
200
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
checkout_matching_branch(args, args.branchname[0])
|
|
200
|
-
|
|
201
|
-
except git.GitError as exc:
|
|
202
|
-
colour.error(exc.msg, exc.status)
|
|
201
|
+
if args.branch:
|
|
202
|
+
git.checkout(args.branchname[0], create=True)
|
|
203
|
+
else:
|
|
204
|
+
checkout_matching_branch(args, args.branchname[0])
|
|
203
205
|
|
|
204
206
|
################################################################################
|
|
205
207
|
|
|
@@ -213,6 +215,8 @@ def git_co():
|
|
|
213
215
|
sys.exit(1)
|
|
214
216
|
except BrokenPipeError:
|
|
215
217
|
sys.exit(2)
|
|
218
|
+
except git.GitError as exc:
|
|
219
|
+
colour.error(exc.msg, status=exc.status, prefix=True)
|
|
216
220
|
|
|
217
221
|
################################################################################
|
|
218
222
|
|
skilleter_thingy/git_common.py
CHANGED
|
@@ -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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
|
skilleter_thingy/git_hold.py
CHANGED
|
@@ -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
|
################################################################################
|
|
@@ -59,7 +61,7 @@ def archive_branches(branches):
|
|
|
59
61
|
for branch in branches:
|
|
60
62
|
tag_name = archive_tag_name(branch)
|
|
61
63
|
|
|
62
|
-
git.
|
|
64
|
+
git.tag_apply(tag_name, branch)
|
|
63
65
|
git.delete_branch(branch, force=True)
|
|
64
66
|
|
|
65
67
|
for remote in git.remotes():
|
|
@@ -105,7 +107,7 @@ def restore_archive_branches(branches):
|
|
|
105
107
|
archive_tag_names.append(archive_tag)
|
|
106
108
|
|
|
107
109
|
git.checkout(branch, commit=archive_tag)
|
|
108
|
-
git.
|
|
110
|
+
git.tag_delete(archive_tag)
|
|
109
111
|
|
|
110
112
|
for remote in git.remotes():
|
|
111
113
|
git.push(repository=remote, delete=True, refspec=archive_tag_names)
|
|
@@ -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
|
|
skilleter_thingy/git_mr.py
CHANGED
|
@@ -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
|
|
skilleter_thingy/git_parent.py
CHANGED
|
@@ -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
|
-
|
|
32
|
-
|
|
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
|
-
|
|
38
|
+
if args.all:
|
|
39
|
+
any_parents, any_distance = git.parents(args.branch)
|
|
40
|
+
else:
|
|
41
|
+
any_parents = []
|
|
38
42
|
|
|
39
|
-
|
|
40
|
-
# (one or both) based on distance.
|
|
43
|
+
parents, distance = git.parents(args.branch, ignore='feature/*')
|
|
41
44
|
|
|
42
|
-
|
|
43
|
-
|
|
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
|
-
|
|
52
|
-
|
|
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
|
|
skilleter_thingy/git_retag.py
CHANGED
|
@@ -9,10 +9,12 @@
|
|
|
9
9
|
"""
|
|
10
10
|
################################################################################
|
|
11
11
|
|
|
12
|
+
import os
|
|
12
13
|
import sys
|
|
13
14
|
import argparse
|
|
14
15
|
|
|
15
16
|
import thingy.git2 as git
|
|
17
|
+
import thingy.colour as colour
|
|
16
18
|
|
|
17
19
|
################################################################################
|
|
18
20
|
|
|
@@ -23,10 +25,17 @@ def main():
|
|
|
23
25
|
|
|
24
26
|
parser = argparse.ArgumentParser(description='Apply or update a tag, optionally updating it on the remote as well.')
|
|
25
27
|
parser.add_argument('--push', '-p', action='store_true', help='Push the tag to the remote')
|
|
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('tag', nargs=1, help='The tag')
|
|
27
31
|
|
|
28
32
|
args = parser.parse_args()
|
|
29
33
|
|
|
34
|
+
# Change directory, if specified
|
|
35
|
+
|
|
36
|
+
if args.path:
|
|
37
|
+
os.chdir(args.path[0])
|
|
38
|
+
|
|
30
39
|
tag = args.tag[0]
|
|
31
40
|
|
|
32
41
|
# Delete the tag if it currently exists, optionally pushing the deletion
|
|
@@ -36,7 +45,7 @@ def main():
|
|
|
36
45
|
|
|
37
46
|
# Apply the tag
|
|
38
47
|
|
|
39
|
-
git.tag_apply(tag, push=args.push)
|
|
48
|
+
git.tag_apply(tag, 'HEAD', push=args.push)
|
|
40
49
|
|
|
41
50
|
################################################################################
|
|
42
51
|
|
|
@@ -49,6 +58,8 @@ def git_retag():
|
|
|
49
58
|
sys.exit(1)
|
|
50
59
|
except BrokenPipeError:
|
|
51
60
|
sys.exit(2)
|
|
61
|
+
except git.GitError as exc:
|
|
62
|
+
colour.error(exc.msg, status=exc.status, prefix=True)
|
|
52
63
|
|
|
53
64
|
################################################################################
|
|
54
65
|
|
skilleter_thingy/git_review.py
CHANGED
skilleter_thingy/git_update.py
CHANGED
skilleter_thingy/git_wt.py
CHANGED
|
@@ -15,6 +15,7 @@ import argparse
|
|
|
15
15
|
import os
|
|
16
16
|
|
|
17
17
|
import thingy.git2 as git
|
|
18
|
+
import thingy.colour as colour
|
|
18
19
|
|
|
19
20
|
################################################################################
|
|
20
21
|
|
|
@@ -62,6 +63,8 @@ def git_wt():
|
|
|
62
63
|
sys.exit(1)
|
|
63
64
|
except BrokenPipeError:
|
|
64
65
|
sys.exit(2)
|
|
66
|
+
except git.GitError as exc:
|
|
67
|
+
colour.error(exc.msg, status=exc.status, prefix=True)
|
|
65
68
|
|
|
66
69
|
################################################################################
|
|
67
70
|
|
skilleter_thingy/gitprompt.py
CHANGED
skilleter_thingy/thingy/git.py
CHANGED
|
@@ -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(
|
|
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
|
|
|
@@ -165,14 +169,14 @@ def tags():
|
|
|
165
169
|
|
|
166
170
|
################################################################################
|
|
167
171
|
|
|
168
|
-
def
|
|
172
|
+
def tag_apply(tag, commit):
|
|
169
173
|
""" Apply a tag to a commit """
|
|
170
174
|
|
|
171
175
|
return git(['tag', tag, commit])
|
|
172
176
|
|
|
173
177
|
################################################################################
|
|
174
178
|
|
|
175
|
-
def
|
|
179
|
+
def tag_delete(tag):
|
|
176
180
|
""" Delete a tag """
|
|
177
181
|
|
|
178
182
|
return git(['tag', '--delete', tag])
|
|
@@ -814,7 +818,7 @@ def reset(sha1):
|
|
|
814
818
|
|
|
815
819
|
################################################################################
|
|
816
820
|
|
|
817
|
-
def config_get(section, key, source=
|
|
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=
|
|
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
|
|
1189
|
+
for branch in default_branches:
|
|
1177
1190
|
if branch in git_branches:
|
|
1178
1191
|
return branch
|
|
1179
1192
|
|
|
1180
|
-
|
|
1193
|
+
raise GitError('Unable to determine default branch in the repo')
|
|
1181
1194
|
|
|
1182
1195
|
################################################################################
|
|
1183
1196
|
|
skilleter_thingy/thingy/git2.py
CHANGED
|
@@ -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(
|
|
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
|
|
|
@@ -225,10 +229,15 @@ def tag_delete(tag, push=False, path=None):
|
|
|
225
229
|
|
|
226
230
|
################################################################################
|
|
227
231
|
|
|
228
|
-
def tag_apply(tag, push=False, path=None):
|
|
232
|
+
def tag_apply(tag, commit=None, push=False, path=None):
|
|
229
233
|
"""Apply a tag, optionally pushing it"""
|
|
230
234
|
|
|
231
|
-
|
|
235
|
+
cmd = ['tag', tag]
|
|
236
|
+
|
|
237
|
+
if commit:
|
|
238
|
+
cmd.append(commit)
|
|
239
|
+
|
|
240
|
+
git(cmd, path=path)
|
|
232
241
|
|
|
233
242
|
if push:
|
|
234
243
|
git(['push', 'origin', tag], path=path)
|
|
@@ -264,7 +273,7 @@ def pull(repo=None, all=False, path=None):
|
|
|
264
273
|
|
|
265
274
|
################################################################################
|
|
266
275
|
|
|
267
|
-
def checkout(branch, create=False, path=None):
|
|
276
|
+
def checkout(branch, create=False, commit=None, path=None):
|
|
268
277
|
""" Checkout a branch (optionally creating it) """
|
|
269
278
|
|
|
270
279
|
cmd = ['checkout']
|
|
@@ -274,6 +283,9 @@ def checkout(branch, create=False, path=None):
|
|
|
274
283
|
|
|
275
284
|
cmd.append(branch)
|
|
276
285
|
|
|
286
|
+
if commit:
|
|
287
|
+
cmd.append(commit)
|
|
288
|
+
|
|
277
289
|
return git(cmd, path=path)
|
|
278
290
|
|
|
279
291
|
################################################################################
|
|
@@ -775,7 +787,7 @@ def reset(sha1, path=None):
|
|
|
775
787
|
|
|
776
788
|
################################################################################
|
|
777
789
|
|
|
778
|
-
def config_get(section, key, source=
|
|
790
|
+
def config_get(section, key, source=None, defaultvalue=None, path=None):
|
|
779
791
|
""" Return the specified configuration entry
|
|
780
792
|
Returns a default value if no matching configuration entry exists """
|
|
781
793
|
|
|
@@ -785,6 +797,10 @@ def config_get(section, key, source=LOCAL, defaultvalue=None, path=None):
|
|
|
785
797
|
cmd.append('--global')
|
|
786
798
|
elif source == SYSTEM:
|
|
787
799
|
cmd.append('--system')
|
|
800
|
+
elif source == LOCAL:
|
|
801
|
+
cmd.append('--local')
|
|
802
|
+
elif source == WORKTREE:
|
|
803
|
+
cmd.append('--worktree')
|
|
788
804
|
|
|
789
805
|
cmd += ['--get', f'{section}.{key}']
|
|
790
806
|
|
|
@@ -795,7 +811,7 @@ def config_get(section, key, source=LOCAL, defaultvalue=None, path=None):
|
|
|
795
811
|
|
|
796
812
|
################################################################################
|
|
797
813
|
|
|
798
|
-
def config_set(section, key, value, source=
|
|
814
|
+
def config_set(section, key, value, source=None, path=None):
|
|
799
815
|
""" Set a configuration entry """
|
|
800
816
|
|
|
801
817
|
cmd = ['config']
|
|
@@ -804,6 +820,10 @@ def config_set(section, key, value, source=LOCAL, path=None):
|
|
|
804
820
|
cmd.append('--global')
|
|
805
821
|
elif source == SYSTEM:
|
|
806
822
|
cmd.append('--system')
|
|
823
|
+
elif source == LOCAL:
|
|
824
|
+
cmd.append('--local')
|
|
825
|
+
elif source == WORKTREE:
|
|
826
|
+
cmd.append('--worktree')
|
|
807
827
|
|
|
808
828
|
cmd += ['--replace-all', f'{section}.{key}', value]
|
|
809
829
|
|
|
@@ -1130,12 +1150,13 @@ def default_branch(path=None):
|
|
|
1130
1150
|
return None
|
|
1131
1151
|
|
|
1132
1152
|
git_branches = branches(path=path)
|
|
1153
|
+
default_branches = config_get('skilleter-thingy', 'defaultBranches', defaultvalue=DEFAULT_DEFAULT_BRANCHES).split(',')
|
|
1133
1154
|
|
|
1134
|
-
for branch in
|
|
1155
|
+
for branch in default_branches:
|
|
1135
1156
|
if branch in git_branches:
|
|
1136
1157
|
return branch
|
|
1137
1158
|
|
|
1138
|
-
|
|
1159
|
+
raise GitError('Unable to determine default branch in the repo')
|
|
1139
1160
|
|
|
1140
1161
|
################################################################################
|
|
1141
1162
|
|
skilleter_thingy/thingy/run.py
CHANGED
|
@@ -3,23 +3,22 @@ skilleter_thingy/addpath.py,sha256=4Yhhgjjz1XDI98j0dAiQpNA2ejLefeWUTeSg3nIXQq0,3
|
|
|
3
3
|
skilleter_thingy/console_colours.py,sha256=BOS9mo3jChx_FE8L1j488MDoVNgib11KjTRhrz_YRYE,1781
|
|
4
4
|
skilleter_thingy/docker_purge.py,sha256=PRQ7EBXymjYIHuJL4pk4r6KNn09IF28OGZ0ln57xtNg,3314
|
|
5
5
|
skilleter_thingy/ffind.py,sha256=rEgotUaMj9JxDCwz-7H5vdqxH_bXllaHqttwsOUGKj8,19235
|
|
6
|
-
skilleter_thingy/ggit.py,sha256=
|
|
7
|
-
skilleter_thingy/ggrep.py,sha256=
|
|
8
|
-
skilleter_thingy/git_br.py,sha256=
|
|
9
|
-
skilleter_thingy/git_ca.py,sha256=
|
|
10
|
-
skilleter_thingy/git_cleanup.py,sha256=
|
|
11
|
-
skilleter_thingy/git_co.py,sha256=
|
|
12
|
-
skilleter_thingy/git_common.py,sha256=
|
|
13
|
-
skilleter_thingy/git_hold.py,sha256=
|
|
14
|
-
skilleter_thingy/git_mr.py,sha256=
|
|
15
|
-
skilleter_thingy/git_parent.py,sha256=
|
|
16
|
-
skilleter_thingy/git_retag.py,sha256=
|
|
17
|
-
skilleter_thingy/
|
|
18
|
-
skilleter_thingy/
|
|
19
|
-
skilleter_thingy/
|
|
20
|
-
skilleter_thingy/git_wt.py,sha256=93mbh8AKej8_y3aL6mVxKjKLEqMczaDtHoYcWf70eU0,2231
|
|
6
|
+
skilleter_thingy/ggit.py,sha256=rUa7rGxdw5ZcBN2u2tJw_beTI6tg0wBNsdPIyVajd6A,2488
|
|
7
|
+
skilleter_thingy/ggrep.py,sha256=GMBWmRnAxqjFri3F_X6LqX04Q0VuwDB5nzO8D_tsrfw,5910
|
|
8
|
+
skilleter_thingy/git_br.py,sha256=97wtkPx9sgBGR34Z62I2qYCg9iz_Fz-ndvOe3TqjC20,6027
|
|
9
|
+
skilleter_thingy/git_ca.py,sha256=6nC5MxkBVC1fr2SHEc1XH0BO3vUWHaxV5gjCVBgPoWY,5191
|
|
10
|
+
skilleter_thingy/git_cleanup.py,sha256=O8t6HiIjMmG4oz4LsvYdHaq1xsgCjICTWAcec-wBdTM,10564
|
|
11
|
+
skilleter_thingy/git_co.py,sha256=Mc-6jEUpVWAJJ-2PTpQ4tjDw03_zJMJDX9SGIxCqzJQ,8404
|
|
12
|
+
skilleter_thingy/git_common.py,sha256=W9vN03x3_0--8b5jUslpgglltQsLjzrEu7ik1x4LbFs,2134
|
|
13
|
+
skilleter_thingy/git_hold.py,sha256=L9qY19NgDg-B6vaGtI4Z4d6WD6BZ3bcNW4NxcRs8P78,4943
|
|
14
|
+
skilleter_thingy/git_mr.py,sha256=IpzKhhtrPGle7P8x55WBlz3AGfo6XikMORbt9HPh8UU,3449
|
|
15
|
+
skilleter_thingy/git_parent.py,sha256=xnA634w_4bzdBkl3ltYfrJJ69DH46FU1F4INJdBNNVc,2961
|
|
16
|
+
skilleter_thingy/git_retag.py,sha256=rGLtBwHdYRpHK-qAmSMCxB8nIeisPBwdxXnP-Zf8HI8,1829
|
|
17
|
+
skilleter_thingy/git_review.py,sha256=F2R-DS3IpQX7wUQpS0G19mdy4gOX1lXa2A9-R-Yn1ck,52599
|
|
18
|
+
skilleter_thingy/git_update.py,sha256=W4e5mqzgLPwcb0Hh5CT5oZYO6KiCTcaf8_tiqVezC_g,14371
|
|
19
|
+
skilleter_thingy/git_wt.py,sha256=8SN-rnzKbbOQ-Rx3Cgr-EyIueR4k4YGDd47QjM0fL1M,2356
|
|
21
20
|
skilleter_thingy/gitcmp_helper.py,sha256=NgQ0BZfa4TVA-XV6YKvrm5147boWUpGw-jDPUsktiMg,11346
|
|
22
|
-
skilleter_thingy/gitprompt.py,sha256=
|
|
21
|
+
skilleter_thingy/gitprompt.py,sha256=UNmhmvB_O-WstrVUmdV_kB8afsG3nwqX-VTuup5ADpg,8935
|
|
23
22
|
skilleter_thingy/gl.py,sha256=9zbGpKxw6lX9RghLkdy-Q5sZlqtbB3uGFO04qTu1dH8,5954
|
|
24
23
|
skilleter_thingy/linecount.py,sha256=ehTN6VD76i4U5k6dXuYoiqSRHI67_BP-bziklNAJSKY,4309
|
|
25
24
|
skilleter_thingy/multigit.py,sha256=rnQ0YGkEy6H54PRt8nCt-G02LGy-wiKRJVk8ovR_pTw,35179
|
|
@@ -43,20 +42,19 @@ skilleter_thingy/thingy/dc_util.py,sha256=Df73imXhHx3HzcPHiRcHAoea0e3HURdLcrolUs
|
|
|
43
42
|
skilleter_thingy/thingy/dircolors.py,sha256=aBcq9ci855GSOIjrZWm8kG0ksCodvUmc4FlIOEOyBcA,12292
|
|
44
43
|
skilleter_thingy/thingy/docker.py,sha256=9EFatudoVPfB1UbDEtzdJDB3o6ToHiNHv8-oLsUeqiQ,2449
|
|
45
44
|
skilleter_thingy/thingy/files.py,sha256=oW6E6WWwVFSUPdrZnKMx7P_w_hh3etjoN7RrqvYHCHc,4705
|
|
46
|
-
skilleter_thingy/thingy/git.py,sha256=
|
|
47
|
-
skilleter_thingy/thingy/git2.py,sha256=
|
|
45
|
+
skilleter_thingy/thingy/git.py,sha256=yJRfPG08AyPtpcWiywp1--z5IXp22JAiu_LsR6wdtME,39703
|
|
46
|
+
skilleter_thingy/thingy/git2.py,sha256=V6LUHrJXj70zUl4oYSv40Bs7A4eOgMoxdETT13vqeD0,39732
|
|
48
47
|
skilleter_thingy/thingy/gitlab.py,sha256=uXAF918xnPk6qQyiwPQDbMZfqtJzhiRqDS7yEtJEIAg,6079
|
|
49
48
|
skilleter_thingy/thingy/path.py,sha256=8uM2Q9zFRWv_SaVOX49PeecQXttl7J6lsmBuRXWsXKY,4732
|
|
50
49
|
skilleter_thingy/thingy/popup.py,sha256=hNfA9yh4jCv2su8XK33udcTWwgf98noBdYRRkFX1mxc,2517
|
|
51
50
|
skilleter_thingy/thingy/process.py,sha256=WJLg3js1zdgI7Nlkt7e5ICltkjXcA9P1f-LWPSZCdWs,3570
|
|
52
|
-
skilleter_thingy/thingy/run.py,sha256=
|
|
51
|
+
skilleter_thingy/thingy/run.py,sha256=2fmiAxb2xjx5__sLiVP81BJlR37ghO-2KxiKCWWzyZA,12580
|
|
53
52
|
skilleter_thingy/thingy/tfm_pane.py,sha256=XTTpSm71CyQyGmlVLuCthioOwech0jhUiFUXb-chS_Q,19792
|
|
54
53
|
skilleter_thingy/thingy/tidy.py,sha256=AQ2RawsZJg6WHrgayi_ZptFL9occ7suSdCHbU3P-cys,5971
|
|
55
54
|
skilleter_thingy/thingy/venv_template.py,sha256=SsVNvSwojd8NnFeQaZPCRQYTNdwJRplpZpygbUEXRnY,1015
|
|
56
|
-
skilleter_thingy-0.2.
|
|
57
|
-
skilleter_thingy-0.2.
|
|
58
|
-
skilleter_thingy-0.2.
|
|
59
|
-
skilleter_thingy-0.2.
|
|
60
|
-
skilleter_thingy-0.2.
|
|
61
|
-
skilleter_thingy-0.2.
|
|
62
|
-
skilleter_thingy-0.2.3.dist-info/RECORD,,
|
|
55
|
+
skilleter_thingy-0.2.6.dist-info/licenses/LICENSE,sha256=ljOS4DjXvqEo5VzGfdaRwgRZPbNScGBmfwyC8PChvmQ,32422
|
|
56
|
+
skilleter_thingy-0.2.6.dist-info/METADATA,sha256=o8kyfCtR801HU6Y9Rk02L7ArI5YRWN2iKIXprcnrDRA,28913
|
|
57
|
+
skilleter_thingy-0.2.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
58
|
+
skilleter_thingy-0.2.6.dist-info/entry_points.txt,sha256=MTNWf8jOx8Fy3tSwVLCZPlEyzlDF36odw-IN-cSefP8,1784
|
|
59
|
+
skilleter_thingy-0.2.6.dist-info/top_level.txt,sha256=8-JhgToBBiWURunmvfpSxEvNkDHQQ7r25-aBXtZv61g,17
|
|
60
|
+
skilleter_thingy-0.2.6.dist-info/RECORD,,
|
|
@@ -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.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|