skilleter-thingy 0.0.50__py3-none-any.whl → 0.0.52__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/git_mr.py +3 -2
- skilleter_thingy/thingy/files.py +16 -3
- skilleter_thingy/thingy/git.py +36 -15
- skilleter_thingy/thingy/git2.py +1 -1
- skilleter_thingy/thingy/run.py +1 -1
- skilleter_thingy/thingy/tfm_pane.py +3 -5
- {skilleter_thingy-0.0.50.dist-info → skilleter_thingy-0.0.52.dist-info}/METADATA +1 -1
- {skilleter_thingy-0.0.50.dist-info → skilleter_thingy-0.0.52.dist-info}/RECORD +12 -12
- {skilleter_thingy-0.0.50.dist-info → skilleter_thingy-0.0.52.dist-info}/WHEEL +1 -1
- {skilleter_thingy-0.0.50.dist-info → skilleter_thingy-0.0.52.dist-info}/LICENSE +0 -0
- {skilleter_thingy-0.0.50.dist-info → skilleter_thingy-0.0.52.dist-info}/entry_points.txt +0 -0
- {skilleter_thingy-0.0.50.dist-info → skilleter_thingy-0.0.52.dist-info}/top_level.txt +0 -0
skilleter_thingy/git_mr.py
CHANGED
|
@@ -49,12 +49,13 @@ def main():
|
|
|
49
49
|
else:
|
|
50
50
|
parents, _ = git.parents()
|
|
51
51
|
|
|
52
|
+
if not parents:
|
|
53
|
+
colour.error('Unable to determine parent branch. Use the [BLUE]--parent[NORMAL] option to specify the appropriate one.')
|
|
54
|
+
|
|
52
55
|
if len(parents) > 1:
|
|
53
56
|
parent_list = ', '.join(parents)
|
|
54
57
|
colour.error(
|
|
55
58
|
f'Branch has multiple potential parents: [BLUE]{parent_list}[NORMAL]. Use the [BLUE]--parent[NORMAL] option to specify the appropriate one.')
|
|
56
|
-
elif not parents:
|
|
57
|
-
colour.error('Unable to determine parent branch. Use the [BLUE]--parent[NORMAL] option to specify the appropriate one.')
|
|
58
59
|
|
|
59
60
|
options = ['merge_request.create', f'merge_request.target={parents[0]}']
|
|
60
61
|
|
skilleter_thingy/thingy/files.py
CHANGED
|
@@ -73,6 +73,8 @@ def format_size(size, always_suffix=False):
|
|
|
73
73
|
# to 1 (set to 0 when we don't have a divisor).
|
|
74
74
|
|
|
75
75
|
div *= 1024
|
|
76
|
+
else:
|
|
77
|
+
units = ' PiB'
|
|
76
78
|
|
|
77
79
|
# Calculate the size in 10ths so the we get the first digit after
|
|
78
80
|
# the decimal point, doing all the work in the integer domain to
|
|
@@ -89,9 +91,13 @@ def format_size(size, always_suffix=False):
|
|
|
89
91
|
|
|
90
92
|
################################################################################
|
|
91
93
|
|
|
92
|
-
def backup(filename, extension='bak', copyfile=True):
|
|
94
|
+
def backup(filename, extension='bak', copyfile=True, timestamps=True):
|
|
93
95
|
""" Create a backup of a file by copying or renaming it into a file with extension
|
|
94
|
-
.bak, deleting any existing file with that name
|
|
96
|
+
.bak, deleting any existing file with that name.
|
|
97
|
+
|
|
98
|
+
Copies the file by default, unless copyfile is False
|
|
99
|
+
Sets the timetamps of the backup file to be the same as the original, unless
|
|
100
|
+
timestamps is False."""
|
|
95
101
|
|
|
96
102
|
# Do nothing if the file does not exist
|
|
97
103
|
|
|
@@ -117,13 +123,20 @@ def backup(filename, extension='bak', copyfile=True):
|
|
|
117
123
|
if os.path.isfile(backupname):
|
|
118
124
|
os.unlink(backupname)
|
|
119
125
|
|
|
120
|
-
# Create the backup by copying or renaming the file
|
|
126
|
+
# Create the backup by copying or renaming the file, optionally preserving the
|
|
127
|
+
# timestamp of the original file
|
|
128
|
+
|
|
129
|
+
if timestamps:
|
|
130
|
+
file_info = os.stat(filename)
|
|
121
131
|
|
|
122
132
|
if copyfile:
|
|
123
133
|
shutil.copyfile(filename, backupname)
|
|
124
134
|
else:
|
|
125
135
|
os.rename(filename, backupname)
|
|
126
136
|
|
|
137
|
+
if timestamps:
|
|
138
|
+
os.utime(backupname, ns=(file_info.st_atime_ns, file_info.st_mtime_ns))
|
|
139
|
+
|
|
127
140
|
################################################################################
|
|
128
141
|
# Test code
|
|
129
142
|
|
skilleter_thingy/thingy/git.py
CHANGED
|
@@ -515,6 +515,13 @@ def difftool(commit_1=None, commit_2=None, files=None, tool=None):
|
|
|
515
515
|
|
|
516
516
|
################################################################################
|
|
517
517
|
|
|
518
|
+
# Match 'git diff --numstat' output - first re splits into lines added, removed
|
|
519
|
+
# and name. Second one is used if a file has been renamed, to get the old and
|
|
520
|
+
# new name components.
|
|
521
|
+
|
|
522
|
+
_DIFF_OUTPUT_RE = re.compile(r'(-|\d+)\s+(-|\d+)\s+(.*)')
|
|
523
|
+
_DIFF_OUTPUT_RENAME_RE = re.compile(r'(.*)\{(.*) => (.*)\}(.*)')
|
|
524
|
+
|
|
518
525
|
def commit_info(commit_1=None, commit_2=None, paths=None, diff_stats=False):
|
|
519
526
|
""" Return details of changes either in single commit (defaulting to the most
|
|
520
527
|
recent one) or between two commits, optionally restricted a path or paths
|
|
@@ -523,22 +530,35 @@ def commit_info(commit_1=None, commit_2=None, paths=None, diff_stats=False):
|
|
|
523
530
|
"""
|
|
524
531
|
|
|
525
532
|
def parse_diff_output(result):
|
|
526
|
-
"""Extract current filename and lines added/deleted
|
|
533
|
+
"""Extract previous and current filename (which may be the same) and lines added/deleted
|
|
534
|
+
from output from git diff --numstat"""
|
|
535
|
+
|
|
536
|
+
p = _DIFF_OUTPUT_RE.fullmatch(result)
|
|
537
|
+
|
|
538
|
+
# This shouldn't happen...
|
|
527
539
|
|
|
528
|
-
|
|
540
|
+
if not p:
|
|
541
|
+
return 'ERROR', 'ERROR', 0, 0
|
|
542
|
+
|
|
543
|
+
# Extract number of lines added/removed
|
|
529
544
|
|
|
530
545
|
lines_ins = 0 if p.group(1) == '-' else int(p.group(1))
|
|
531
546
|
lines_del = 0 if p.group(2) == '-' else int(p.group(2))
|
|
532
547
|
|
|
548
|
+
# Check for rename and get both old and new names
|
|
549
|
+
|
|
533
550
|
if ' => ' in p.group(3):
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
551
|
+
q = _DIFF_OUTPUT_RENAME_RE.fullmatch(p.group(3))
|
|
552
|
+
|
|
553
|
+
if q:
|
|
554
|
+
old_filename = q.group(1) + q.group(2) + q.group(4)
|
|
555
|
+
new_filename = q.group(1) + q.group(3) + q.group(4)
|
|
556
|
+
else:
|
|
557
|
+
old_filename, new_filename = p.group(3).split(' => ')
|
|
538
558
|
else:
|
|
539
|
-
|
|
559
|
+
old_filename = new_filename = p.group(3)
|
|
540
560
|
|
|
541
|
-
return
|
|
561
|
+
return old_filename, new_filename, lines_ins, lines_del
|
|
542
562
|
|
|
543
563
|
# Either get changes between the two commits, or changes in the specified commit
|
|
544
564
|
|
|
@@ -588,22 +608,23 @@ def commit_info(commit_1=None, commit_2=None, paths=None, diff_stats=False):
|
|
|
588
608
|
results = git(['diff', '--numstat'] + params)
|
|
589
609
|
|
|
590
610
|
for result in results:
|
|
591
|
-
|
|
611
|
+
old_filename, new_filename, lines_ins, lines_del = parse_diff_output(result)
|
|
592
612
|
|
|
593
|
-
info[
|
|
594
|
-
info[
|
|
613
|
+
info[new_filename]['deleted'] = lines_del
|
|
614
|
+
info[new_filename]['added'] = lines_ins
|
|
595
615
|
|
|
596
616
|
# Run git diff to get stats ignoring whitespace changes and add them
|
|
597
617
|
|
|
598
618
|
results = git(['diff', '--numstat', '--ignore-all-space', '--ignore-blank-lines'] + params)
|
|
599
619
|
|
|
600
620
|
for result in results:
|
|
601
|
-
|
|
621
|
+
old_filename, new_filename, lines_ins, lines_del = parse_diff_output(result)
|
|
602
622
|
|
|
603
|
-
info[
|
|
604
|
-
info[
|
|
623
|
+
info[new_filename]['non-ws deleted'] = lines_del
|
|
624
|
+
info[new_filename]['non-ws added'] = lines_ins
|
|
605
625
|
|
|
606
626
|
# Fill in the blanks - files
|
|
627
|
+
|
|
607
628
|
for filename in info:
|
|
608
629
|
if 'deleted' not in info[filename]:
|
|
609
630
|
info[filename]['deleted'] = info[filename]['added'] = 0
|
|
@@ -1326,7 +1347,7 @@ def run_tests():
|
|
|
1326
1347
|
if value is None:
|
|
1327
1348
|
print(' Successfully failed to read the newly-deleted config data')
|
|
1328
1349
|
else:
|
|
1329
|
-
raise GitError
|
|
1350
|
+
raise GitError('Unexpected lack of error reading configuration data', 1)
|
|
1330
1351
|
|
|
1331
1352
|
config_set('user', 'email', 'user@localhost')
|
|
1332
1353
|
config_set('user', 'name', 'User Name')
|
skilleter_thingy/thingy/git2.py
CHANGED
|
@@ -1259,7 +1259,7 @@ if __name__ == '__main__':
|
|
|
1259
1259
|
if value is None:
|
|
1260
1260
|
print(' Successfully failed to read the newly-deleted config data')
|
|
1261
1261
|
else:
|
|
1262
|
-
raise GitError
|
|
1262
|
+
raise GitError('Unexpectd lack of error reading configuration data', 1)
|
|
1263
1263
|
|
|
1264
1264
|
config_set('user', 'email', 'user@localhost')
|
|
1265
1265
|
config_set('user', 'name', 'User Name')
|
skilleter_thingy/thingy/run.py
CHANGED
|
@@ -60,7 +60,7 @@ def capture_output(cmd, input_stream, output_streams, ansi_clean):
|
|
|
60
60
|
if stream in (sys.stdout, sys.stderr):
|
|
61
61
|
stream.write(tidy.convert_ansi(output))
|
|
62
62
|
elif ansi_clean:
|
|
63
|
-
stream.write(
|
|
63
|
+
stream.write(tidy.remove_ansi(output))
|
|
64
64
|
else:
|
|
65
65
|
stream.write(output)
|
|
66
66
|
|
|
@@ -63,7 +63,7 @@ class Pane():
|
|
|
63
63
|
|
|
64
64
|
self.index = index
|
|
65
65
|
|
|
66
|
-
self.current_dir =
|
|
66
|
+
self.current_dir = ''
|
|
67
67
|
|
|
68
68
|
self.ino = inotify.adapters.Inotify() if sys.platform == 'linux' else None
|
|
69
69
|
|
|
@@ -290,13 +290,11 @@ class Pane():
|
|
|
290
290
|
else:
|
|
291
291
|
entry = name + ' ' * (self.width - len(name) - len(data)) + data
|
|
292
292
|
|
|
293
|
+
file_colour = self.dircolours.get_colour_pair(current_file['name'], current_file['mode'])
|
|
293
294
|
else:
|
|
294
295
|
filename = entry = None
|
|
295
296
|
current = False
|
|
296
|
-
|
|
297
|
-
# Render the current line
|
|
298
|
-
|
|
299
|
-
file_colour = self.dircolours.get_colour_pair(current_file['name'], current_file['mode']) if filename else normal_colour
|
|
297
|
+
file_colour = normal_colour
|
|
300
298
|
|
|
301
299
|
# Reverse the colours if this the cursor line
|
|
302
300
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: skilleter_thingy
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.52
|
|
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
|
|
@@ -14,7 +14,7 @@ skilleter_thingy/git_cleanup.py,sha256=TnUPYAUnByVyY_dwANzDg2BGGNh3jskNF1DgU3pc8
|
|
|
14
14
|
skilleter_thingy/git_co.py,sha256=gBES0ltlomy7vXX8IHh0-Vt1af54t2Ie5UnRYYfP4tM,8212
|
|
15
15
|
skilleter_thingy/git_common.py,sha256=ZjNkvIBRDGNLFYwOu9FjeqdDKJdm0sndX5QATtmq290,1879
|
|
16
16
|
skilleter_thingy/git_hold.py,sha256=Zk6YUhr08znUOdpVJkJAt0rOtrCXnKE0NHoZzoaEEGo,4616
|
|
17
|
-
skilleter_thingy/git_mr.py,sha256=
|
|
17
|
+
skilleter_thingy/git_mr.py,sha256=2vLzpd5waddNBRlOvQUxwqHVQaK9Rg6FYHb4VMEpS8c,3086
|
|
18
18
|
skilleter_thingy/git_parent.py,sha256=D47D01dPs6kActusA0ircJYTv8tBjDoe8MzMpJVWJpA,2683
|
|
19
19
|
skilleter_thingy/git_review.py,sha256=WCBw49OP3WHiaxku8jUUk6I_NqtjScLGaQHvPxX6LnU,52053
|
|
20
20
|
skilleter_thingy/git_update.py,sha256=uYd4ubnDbHzkwwrtzVatNIg-L15ap1X8UMO-2PafseY,13971
|
|
@@ -49,21 +49,21 @@ skilleter_thingy/thingy/dc_defaults.py,sha256=ahcteQvoWZrO5iTU68zkIY1Zex6iX5uR5u
|
|
|
49
49
|
skilleter_thingy/thingy/dc_util.py,sha256=Df73imXhHx3HzcPHiRcHAoea0e3HURdLcrolUsMhOFs,1783
|
|
50
50
|
skilleter_thingy/thingy/dircolors.py,sha256=5NbXMsGWdABLvvZfB70VPmN6N5HyyihfpgoQq1NRJbg,12264
|
|
51
51
|
skilleter_thingy/thingy/docker.py,sha256=9EFatudoVPfB1UbDEtzdJDB3o6ToHiNHv8-oLsUeqiQ,2449
|
|
52
|
-
skilleter_thingy/thingy/files.py,sha256=
|
|
53
|
-
skilleter_thingy/thingy/git.py,sha256=
|
|
54
|
-
skilleter_thingy/thingy/git2.py,sha256=
|
|
52
|
+
skilleter_thingy/thingy/files.py,sha256=oW6E6WWwVFSUPdrZnKMx7P_w_hh3etjoN7RrqvYHCHc,4705
|
|
53
|
+
skilleter_thingy/thingy/git.py,sha256=qXWIduF4jbP5pKFYt_hW9Ex5iL9mSBBrcNKBkULhRTg,38834
|
|
54
|
+
skilleter_thingy/thingy/git2.py,sha256=UgdAC1rZWf6Tdl9xB6PAIT6K_3OjD2juCOEQSHEEb90,35530
|
|
55
55
|
skilleter_thingy/thingy/gitlab.py,sha256=uXAF918xnPk6qQyiwPQDbMZfqtJzhiRqDS7yEtJEIAg,6079
|
|
56
56
|
skilleter_thingy/thingy/logger.py,sha256=xKgPAq8KGXmtaXIFjFs1AmZJXtYrXJn2sqL3oxHZjfQ,3107
|
|
57
57
|
skilleter_thingy/thingy/path.py,sha256=me__Ukw-7NiD70Yd9tOWyj7QX79-deFvsQaQ9AGzWzU,4732
|
|
58
58
|
skilleter_thingy/thingy/popup.py,sha256=jW-nbpdeswqEMTli7OmBv1J8XQsvFoMI0J33O6dOeu8,2529
|
|
59
59
|
skilleter_thingy/thingy/process.py,sha256=88pKHQZXBP1m3Ja7t3DtKJ4Njn7HS2OtcI0Z0i1KwUs,3560
|
|
60
|
-
skilleter_thingy/thingy/run.py,sha256=
|
|
61
|
-
skilleter_thingy/thingy/tfm_pane.py,sha256=
|
|
60
|
+
skilleter_thingy/thingy/run.py,sha256=6SNKWF01fSxzB10GMU9ajraXYZqAL1w0PXkqjJdr1Uo,12611
|
|
61
|
+
skilleter_thingy/thingy/tfm_pane.py,sha256=oqy5zBzKwfbjbGqetbbhpKi4x5He7sl4qkmhUeqtdZc,19789
|
|
62
62
|
skilleter_thingy/thingy/tidy.py,sha256=0EVUP2XyUTtoIpqaDwvrHL58YxM4Elvu5MO1nzhwLG4,5854
|
|
63
63
|
skilleter_thingy/thingy/venv_template.py,sha256=SsVNvSwojd8NnFeQaZPCRQYTNdwJRplpZpygbUEXRnY,1015
|
|
64
|
-
skilleter_thingy-0.0.
|
|
65
|
-
skilleter_thingy-0.0.
|
|
66
|
-
skilleter_thingy-0.0.
|
|
67
|
-
skilleter_thingy-0.0.
|
|
68
|
-
skilleter_thingy-0.0.
|
|
69
|
-
skilleter_thingy-0.0.
|
|
64
|
+
skilleter_thingy-0.0.52.dist-info/LICENSE,sha256=ljOS4DjXvqEo5VzGfdaRwgRZPbNScGBmfwyC8PChvmQ,32422
|
|
65
|
+
skilleter_thingy-0.0.52.dist-info/METADATA,sha256=buYbiQqFhFBdTi6MM02Jy8ZH8wuXmLxI2StMjulMVoo,5313
|
|
66
|
+
skilleter_thingy-0.0.52.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
|
|
67
|
+
skilleter_thingy-0.0.52.dist-info/entry_points.txt,sha256=IT6cZSbGHrd2UzIQbiMRotKiTJnYJBkESC4fAe8gjsE,2026
|
|
68
|
+
skilleter_thingy-0.0.52.dist-info/top_level.txt,sha256=8-JhgToBBiWURunmvfpSxEvNkDHQQ7r25-aBXtZv61g,17
|
|
69
|
+
skilleter_thingy-0.0.52.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|