ScriptCollection 3.5.136__py3-none-any.whl → 3.5.138__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.
- ScriptCollection/ScriptCollectionCore.py +34 -29
- {scriptcollection-3.5.136.dist-info → scriptcollection-3.5.138.dist-info}/METADATA +1 -1
- {scriptcollection-3.5.136.dist-info → scriptcollection-3.5.138.dist-info}/RECORD +6 -6
- {scriptcollection-3.5.136.dist-info → scriptcollection-3.5.138.dist-info}/WHEEL +0 -0
- {scriptcollection-3.5.136.dist-info → scriptcollection-3.5.138.dist-info}/entry_points.txt +0 -0
- {scriptcollection-3.5.136.dist-info → scriptcollection-3.5.138.dist-info}/top_level.txt +0 -0
@@ -33,7 +33,7 @@ from .ProgramRunnerPopen import ProgramRunnerPopen
|
|
33
33
|
from .ProgramRunnerEpew import ProgramRunnerEpew, CustomEpewArgument
|
34
34
|
from .SCLog import SCLog, LogLevel
|
35
35
|
|
36
|
-
version = "3.5.
|
36
|
+
version = "3.5.138"
|
37
37
|
__version__ = version
|
38
38
|
|
39
39
|
|
@@ -154,7 +154,7 @@ class ScriptCollectionCore:
|
|
154
154
|
|
155
155
|
@GeneralUtilities.check_arguments
|
156
156
|
def commit_is_signed_by_key(self, repository_folder: str, revision_identifier: str, key: str) -> bool:
|
157
|
-
self.
|
157
|
+
self.is_git_or_bare_git_repository(repository_folder)
|
158
158
|
result = self.run_program("git", f"verify-commit {revision_identifier}", repository_folder, throw_exception_if_exitcode_is_not_zero=False)
|
159
159
|
if (result[0] != 0):
|
160
160
|
return False
|
@@ -168,12 +168,12 @@ class ScriptCollectionCore:
|
|
168
168
|
|
169
169
|
@GeneralUtilities.check_arguments
|
170
170
|
def get_parent_commit_ids_of_commit(self, repository_folder: str, commit_id: str) -> str:
|
171
|
-
self.
|
171
|
+
self.is_git_or_bare_git_repository(repository_folder)
|
172
172
|
return self.run_program("git", f'log --pretty=%P -n 1 "{commit_id}"', repository_folder, throw_exception_if_exitcode_is_not_zero=True)[1].replace("\r", GeneralUtilities.empty_string).replace("\n", GeneralUtilities.empty_string).split(" ")
|
173
173
|
|
174
174
|
@GeneralUtilities.check_arguments
|
175
175
|
def get_all_authors_and_committers_of_repository(self, repository_folder: str, subfolder: str = None, verbosity: int = 1) -> list[tuple[str, str]]:
|
176
|
-
self.
|
176
|
+
self.is_git_or_bare_git_repository(repository_folder)
|
177
177
|
space_character = "_"
|
178
178
|
if subfolder is None:
|
179
179
|
subfolder_argument = GeneralUtilities.empty_string
|
@@ -193,7 +193,7 @@ class ScriptCollectionCore:
|
|
193
193
|
|
194
194
|
@GeneralUtilities.check_arguments
|
195
195
|
def get_commit_ids_between_dates(self, repository_folder: str, since: datetime, until: datetime, ignore_commits_which_are_not_in_history_of_head: bool = True) -> None:
|
196
|
-
self.
|
196
|
+
self.is_git_or_bare_git_repository(repository_folder)
|
197
197
|
since_as_string = self.__datetime_to_string_for_git(since)
|
198
198
|
until_as_string = self.__datetime_to_string_for_git(until)
|
199
199
|
result = filter(lambda line: not GeneralUtilities.string_is_none_or_whitespace(line), self.run_program("git", f'log --since "{since_as_string}" --until "{until_as_string}" --pretty=format:"%H" --no-patch', repository_folder, throw_exception_if_exitcode_is_not_zero=True)[1].split("\n").replace("\r", GeneralUtilities.empty_string))
|
@@ -207,7 +207,7 @@ class ScriptCollectionCore:
|
|
207
207
|
|
208
208
|
@GeneralUtilities.check_arguments
|
209
209
|
def git_commit_is_ancestor(self, repository_folder: str, ancestor: str, descendant: str = "HEAD") -> bool:
|
210
|
-
self.
|
210
|
+
self.is_git_or_bare_git_repository(repository_folder)
|
211
211
|
result = self.run_program_argsasarray("git", ["merge-base", "--is-ancestor", ancestor, descendant], repository_folder, throw_exception_if_exitcode_is_not_zero=False)
|
212
212
|
exit_code = result[0]
|
213
213
|
if exit_code == 0:
|
@@ -261,13 +261,13 @@ class ScriptCollectionCore:
|
|
261
261
|
|
262
262
|
@GeneralUtilities.check_arguments
|
263
263
|
def git_get_commit_id(self, repository_folder: str, commit: str = "HEAD") -> str:
|
264
|
-
self.
|
264
|
+
self.is_git_or_bare_git_repository(repository_folder)
|
265
265
|
result: tuple[int, str, str, int] = self.run_program_argsasarray("git", ["rev-parse", "--verify", commit], repository_folder, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
|
266
266
|
return result[1].replace('\n', '')
|
267
267
|
|
268
268
|
@GeneralUtilities.check_arguments
|
269
269
|
def git_get_commit_date(self, repository_folder: str, commit: str = "HEAD") -> datetime:
|
270
|
-
self.
|
270
|
+
self.is_git_or_bare_git_repository(repository_folder)
|
271
271
|
result: tuple[int, str, str, int] = self.run_program_argsasarray("git", ["show", "-s", "--format=%ci", commit], repository_folder, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
|
272
272
|
date_as_string = result[1].replace('\n', '')
|
273
273
|
result = datetime.strptime(date_as_string, '%Y-%m-%d %H:%M:%S %z')
|
@@ -279,17 +279,17 @@ class ScriptCollectionCore:
|
|
279
279
|
|
280
280
|
@GeneralUtilities.check_arguments
|
281
281
|
def git_fetch(self, folder: str, remotename: str = "--all") -> None:
|
282
|
-
self.
|
282
|
+
self.is_git_or_bare_git_repository(folder)
|
283
283
|
self.run_program_argsasarray("git", ["fetch", remotename, "--tags", "--prune"], folder, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
|
284
284
|
|
285
285
|
@GeneralUtilities.check_arguments
|
286
286
|
def git_fetch_in_bare_repository(self, folder: str, remotename, localbranch: str, remotebranch: str) -> None:
|
287
|
-
self.
|
287
|
+
self.is_git_or_bare_git_repository(folder)
|
288
288
|
self.run_program_argsasarray("git", ["fetch", remotename, f"{remotebranch}:{localbranch}"], folder, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
|
289
289
|
|
290
290
|
@GeneralUtilities.check_arguments
|
291
291
|
def git_remove_branch(self, folder: str, branchname: str) -> None:
|
292
|
-
self.
|
292
|
+
self.is_git_or_bare_git_repository(folder)
|
293
293
|
self.run_program("git", f"branch -D {branchname}", folder, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
|
294
294
|
|
295
295
|
@GeneralUtilities.check_arguments
|
@@ -298,7 +298,7 @@ class ScriptCollectionCore:
|
|
298
298
|
|
299
299
|
@GeneralUtilities.check_arguments
|
300
300
|
def git_push(self, folder: str, remotename: str, localbranchname: str, remotebranchname: str, forcepush: bool = False, pushalltags: bool = True, verbosity: int = 0) -> None:
|
301
|
-
self.
|
301
|
+
self.is_git_or_bare_git_repository(folder)
|
302
302
|
argument = ["push", "--recurse-submodules=on-demand", remotename, f"{localbranchname}:{remotebranchname}"]
|
303
303
|
if (forcepush):
|
304
304
|
argument.append("--force")
|
@@ -313,7 +313,7 @@ class ScriptCollectionCore:
|
|
313
313
|
|
314
314
|
@GeneralUtilities.check_arguments
|
315
315
|
def git_pull(self, folder: str, remote: str, localbranchname: str, remotebranchname: str, force: bool = False) -> None:
|
316
|
-
self.
|
316
|
+
self.is_git_or_bare_git_repository(folder)
|
317
317
|
argument = f"pull {remote} {remotebranchname}:{localbranchname}"
|
318
318
|
if force:
|
319
319
|
argument = f"{argument} --force"
|
@@ -321,7 +321,7 @@ class ScriptCollectionCore:
|
|
321
321
|
|
322
322
|
@GeneralUtilities.check_arguments
|
323
323
|
def git_list_remote_branches(self, folder: str, remote: str, fetch: bool) -> list[str]:
|
324
|
-
self.
|
324
|
+
self.is_git_or_bare_git_repository(folder)
|
325
325
|
if fetch:
|
326
326
|
self.git_fetch(folder, remote)
|
327
327
|
run_program_result = self.run_program("git", f"branch -rl {remote}/*", folder, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
|
@@ -355,19 +355,19 @@ class ScriptCollectionCore:
|
|
355
355
|
|
356
356
|
@GeneralUtilities.check_arguments
|
357
357
|
def git_get_all_remote_names(self, directory: str) -> list[str]:
|
358
|
-
self.
|
358
|
+
self.is_git_or_bare_git_repository(directory)
|
359
359
|
result = GeneralUtilities.string_to_lines(self.run_program_argsasarray("git", ["remote"], directory, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)[1], False)
|
360
360
|
return result
|
361
361
|
|
362
362
|
@GeneralUtilities.check_arguments
|
363
363
|
def git_get_remote_url(self, directory: str, remote_name: str) -> str:
|
364
|
-
self.
|
364
|
+
self.is_git_or_bare_git_repository(directory)
|
365
365
|
result = GeneralUtilities.string_to_lines(self.run_program_argsasarray("git", ["remote", "get-url", remote_name], directory, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)[1], False)
|
366
366
|
return result[0].replace('\n', '')
|
367
367
|
|
368
368
|
@GeneralUtilities.check_arguments
|
369
369
|
def repository_has_remote_with_specific_name(self, directory: str, remote_name: str) -> bool:
|
370
|
-
self.
|
370
|
+
self.is_git_or_bare_git_repository(directory)
|
371
371
|
return remote_name in self.git_get_all_remote_names(directory)
|
372
372
|
|
373
373
|
@GeneralUtilities.check_arguments
|
@@ -448,7 +448,7 @@ class ScriptCollectionCore:
|
|
448
448
|
|
449
449
|
@GeneralUtilities.check_arguments
|
450
450
|
def git_create_tag(self, directory: str, target_for_tag: str, tag: str, sign: bool = False, message: str = None) -> None:
|
451
|
-
self.
|
451
|
+
self.is_git_or_bare_git_repository(directory)
|
452
452
|
argument = ["tag", tag, target_for_tag]
|
453
453
|
if sign:
|
454
454
|
if message is None:
|
@@ -458,7 +458,7 @@ class ScriptCollectionCore:
|
|
458
458
|
|
459
459
|
@GeneralUtilities.check_arguments
|
460
460
|
def git_delete_tag(self, directory: str, tag: str) -> None:
|
461
|
-
self.
|
461
|
+
self.is_git_or_bare_git_repository(directory)
|
462
462
|
self.run_program_argsasarray("git", ["tag", "--delete", tag], directory, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
|
463
463
|
|
464
464
|
@GeneralUtilities.check_arguments
|
@@ -532,7 +532,7 @@ class ScriptCollectionCore:
|
|
532
532
|
self.git_clone(target_repository, source_repository, include_submodules=True, mirror=True)
|
533
533
|
|
534
534
|
def get_git_submodules(self, directory: str) -> list[str]:
|
535
|
-
self.
|
535
|
+
self.is_git_or_bare_git_repository(directory)
|
536
536
|
e = self.run_program("git", "submodule status", directory)
|
537
537
|
result = []
|
538
538
|
for submodule_line in GeneralUtilities.string_to_lines(e[1], False, True):
|
@@ -541,7 +541,7 @@ class ScriptCollectionCore:
|
|
541
541
|
|
542
542
|
@GeneralUtilities.check_arguments
|
543
543
|
def file_is_git_ignored(self, file_in_repository: str, repositorybasefolder: str) -> None:
|
544
|
-
self.
|
544
|
+
self.is_git_or_bare_git_repository(repositorybasefolder)
|
545
545
|
exit_code = self.run_program_argsasarray("git", ['check-ignore', file_in_repository], repositorybasefolder, throw_exception_if_exitcode_is_not_zero=False, verbosity=0)[0]
|
546
546
|
if (exit_code == 0):
|
547
547
|
return True
|
@@ -563,21 +563,21 @@ class ScriptCollectionCore:
|
|
563
563
|
|
564
564
|
@GeneralUtilities.check_arguments
|
565
565
|
def git_get_commitid_of_tag(self, repository: str, tag: str) -> str:
|
566
|
-
self.
|
566
|
+
self.is_git_or_bare_git_repository(repository)
|
567
567
|
stdout = self.run_program_argsasarray("git", ["rev-list", "-n", "1", tag], repository, verbosity=0)
|
568
568
|
result = stdout[1].replace("\r", GeneralUtilities.empty_string).replace("\n", GeneralUtilities.empty_string)
|
569
569
|
return result
|
570
570
|
|
571
571
|
@GeneralUtilities.check_arguments
|
572
572
|
def git_get_tags(self, repository: str) -> list[str]:
|
573
|
-
self.
|
573
|
+
self.is_git_or_bare_git_repository(repository)
|
574
574
|
tags = [line.replace("\r", GeneralUtilities.empty_string) for line in self.run_program_argsasarray(
|
575
575
|
"git", ["tag"], repository)[1].split("\n") if len(line) > 0]
|
576
576
|
return tags
|
577
577
|
|
578
578
|
@GeneralUtilities.check_arguments
|
579
579
|
def git_move_tags_to_another_branch(self, repository: str, tag_source_branch: str, tag_target_branch: str, sign: bool = False, message: str = None) -> None:
|
580
|
-
self.
|
580
|
+
self.is_git_or_bare_git_repository(repository)
|
581
581
|
tags = self.git_get_tags(repository)
|
582
582
|
tags_count = len(tags)
|
583
583
|
counter = 0
|
@@ -598,13 +598,13 @@ class ScriptCollectionCore:
|
|
598
598
|
|
599
599
|
@GeneralUtilities.check_arguments
|
600
600
|
def get_current_git_branch_has_tag(self, repository_folder: str) -> bool:
|
601
|
-
self.
|
601
|
+
self.is_git_or_bare_git_repository(repository_folder)
|
602
602
|
result = self.run_program_argsasarray("git", ["describe", "--tags", "--abbrev=0"], repository_folder, verbosity=0, throw_exception_if_exitcode_is_not_zero=False)
|
603
603
|
return result[0] == 0
|
604
604
|
|
605
605
|
@GeneralUtilities.check_arguments
|
606
606
|
def get_latest_git_tag(self, repository_folder: str) -> str:
|
607
|
-
self.
|
607
|
+
self.is_git_or_bare_git_repository(repository_folder)
|
608
608
|
result = self.run_program_argsasarray("git", ["describe", "--tags", "--abbrev=0"], repository_folder, verbosity=0)
|
609
609
|
result = result[1].replace("\r", GeneralUtilities.empty_string).replace("\n", GeneralUtilities.empty_string)
|
610
610
|
return result
|
@@ -624,7 +624,7 @@ class ScriptCollectionCore:
|
|
624
624
|
|
625
625
|
@GeneralUtilities.check_arguments
|
626
626
|
def run_git_command_in_repository_and_submodules(self, repository_folder: str, arguments: list[str]) -> None:
|
627
|
-
self.
|
627
|
+
self.is_git_or_bare_git_repository(repository_folder)
|
628
628
|
self.run_program_argsasarray("git", arguments, repository_folder)
|
629
629
|
self.run_program_argsasarray("git", ["submodule", "foreach", "--recursive", "git"]+arguments, repository_folder)
|
630
630
|
|
@@ -690,13 +690,18 @@ class ScriptCollectionCore:
|
|
690
690
|
return self.is_folder(git_folder_path) or self.is_file(git_folder_path)
|
691
691
|
|
692
692
|
@GeneralUtilities.check_arguments
|
693
|
-
def
|
693
|
+
def is_bare_git_repository(self, folder: str) -> bool:
|
694
694
|
"""This function works platform-independent also for non-local-executions if the ScriptCollection commandline-commands are available as global command on the target-system."""
|
695
695
|
if folder.endswith("/") or folder.endswith("\\"):
|
696
696
|
folder = folder[:-1]
|
697
697
|
if not self.is_folder(folder):
|
698
698
|
raise ValueError(f"Folder '{folder}' does not exist.")
|
699
|
-
return
|
699
|
+
return folder.endswith(".git")
|
700
|
+
|
701
|
+
@GeneralUtilities.check_arguments
|
702
|
+
def is_git_or_bare_git_repository(self, folder: str) -> bool:
|
703
|
+
"""This function works platform-independent also for non-local-executions if the ScriptCollection commandline-commands are available as global command on the target-system."""
|
704
|
+
return self.is_git_repository(folder) or self.is_bare_git_repository(folder)
|
700
705
|
|
701
706
|
@GeneralUtilities.check_arguments
|
702
707
|
def assert_is_git_repository(self, folder: str) -> str:
|
@@ -7,11 +7,11 @@ ScriptCollection/ProgramRunnerBase.py,sha256=2kMIAqdc65UjBAddOZkzy_aFx9h5roZ5a4b
|
|
7
7
|
ScriptCollection/ProgramRunnerEpew.py,sha256=4pjEd0r9Fcz3TTDv0MdTSd5KkigYXcWUVI1X43regfU,6477
|
8
8
|
ScriptCollection/ProgramRunnerPopen.py,sha256=BPY7-ZMIlqT7JOKz8qlB5c0laF2Js-ijzqk09GxZC48,3821
|
9
9
|
ScriptCollection/SCLog.py,sha256=Dd2P8vH2PA830wAv6bchlMHHdGE_7At-F4WQY5w4XdA,4016
|
10
|
-
ScriptCollection/ScriptCollectionCore.py,sha256=
|
10
|
+
ScriptCollection/ScriptCollectionCore.py,sha256=pzQFBJgNTZ9a_2Qqt2AoyTEbYkH61HwsPFvgBezOaMc,131120
|
11
11
|
ScriptCollection/TasksForCommonProjectStructure.py,sha256=b3bb3kSHSce3HgaitDyuZdQ82KroU1HFryANBycKo0I,235854
|
12
12
|
ScriptCollection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
13
|
-
scriptcollection-3.5.
|
14
|
-
scriptcollection-3.5.
|
15
|
-
scriptcollection-3.5.
|
16
|
-
scriptcollection-3.5.
|
17
|
-
scriptcollection-3.5.
|
13
|
+
scriptcollection-3.5.138.dist-info/METADATA,sha256=hlsJXzIOxELAE14nqRobP7vzTmVQeRqWmBOC6U2y5q4,7694
|
14
|
+
scriptcollection-3.5.138.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
15
|
+
scriptcollection-3.5.138.dist-info/entry_points.txt,sha256=AhXNaa8RMBRFO_4TzKi9jc32C-ZNIiU12mRGu6wEpBk,3796
|
16
|
+
scriptcollection-3.5.138.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
|
17
|
+
scriptcollection-3.5.138.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|