skilleter-thingy 0.1.25__py3-none-any.whl → 0.1.26__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/multigit.py +45 -8
- {skilleter_thingy-0.1.25.dist-info → skilleter_thingy-0.1.26.dist-info}/METADATA +3 -1
- {skilleter_thingy-0.1.25.dist-info → skilleter_thingy-0.1.26.dist-info}/RECORD +7 -7
- {skilleter_thingy-0.1.25.dist-info → skilleter_thingy-0.1.26.dist-info}/WHEEL +0 -0
- {skilleter_thingy-0.1.25.dist-info → skilleter_thingy-0.1.26.dist-info}/entry_points.txt +0 -0
- {skilleter_thingy-0.1.25.dist-info → skilleter_thingy-0.1.26.dist-info}/licenses/LICENSE +0 -0
- {skilleter_thingy-0.1.25.dist-info → skilleter_thingy-0.1.26.dist-info}/top_level.txt +0 -0
skilleter_thingy/multigit.py
CHANGED
|
@@ -6,6 +6,7 @@ import os
|
|
|
6
6
|
import sys
|
|
7
7
|
import fnmatch
|
|
8
8
|
import configparser
|
|
9
|
+
import subprocess
|
|
9
10
|
|
|
10
11
|
from dataclasses import dataclass, field
|
|
11
12
|
|
|
@@ -66,7 +67,7 @@ DEFAULT_BRANCH = 'DEFAULT'
|
|
|
66
67
|
# commands are parameters so we have to manually create the help and parse the command line
|
|
67
68
|
|
|
68
69
|
HELP_INFO = """usage: multigit [--help|-h] [--verbose|-v] [--quiet|-q] [--config|-c CONFIG] [--repos|-r REPOS] [--modified|-m] [--branched|-b] [--sub|-s] [--tag|-t TAGS] [--continue|-o] [--path|-C PATH]
|
|
69
|
-
{+clone, +init, +config, +dir, +list, GIT_COMMAND} ...
|
|
70
|
+
{+clone, +init, +config, +dir, +list, +run, GIT_COMMAND} ...
|
|
70
71
|
|
|
71
72
|
Run git commands in multiple Git repos. DISCLAIMER: This is beta-quality software, with missing features and liable to fail with a stack trace, but shouldn't eat your data
|
|
72
73
|
|
|
@@ -86,7 +87,7 @@ options:
|
|
|
86
87
|
--path, -C PATH Run as if the command was started in PATH instead of the current working directory
|
|
87
88
|
|
|
88
89
|
Sub-commands:
|
|
89
|
-
{+clone, +init, +dir, +config, +list, GIT_COMMAND}
|
|
90
|
+
{+clone, +init, +dir, +config, +list, +run, GIT_COMMAND}
|
|
90
91
|
+clone REPO {BRANCH} Clone a repo containing a multigit configuration file, then clone all the child repos and check out the default branch in each
|
|
91
92
|
+init Build or update the configuration file using the current branch in each repo as the default branch
|
|
92
93
|
+config Return the name and location of the configuration file
|
|
@@ -94,6 +95,7 @@ Sub-commands:
|
|
|
94
95
|
+list Return a list of the top level directories of each of the Git repos
|
|
95
96
|
+tag TAG Apply a configuration tag to repos filtered by the command line options (list configuration tags if no parameter specified)
|
|
96
97
|
+untag TAG Remove a configuration tag to repos filtered by the command line options
|
|
98
|
+
+run COMMAND Run the specified command in repos filtered by the command line options
|
|
97
99
|
GIT_COMMAND Any git command, including options and parameters - this is then run in all specified working trees
|
|
98
100
|
|
|
99
101
|
"""
|
|
@@ -421,7 +423,8 @@ def mg_init(args, config, console):
|
|
|
421
423
|
else:
|
|
422
424
|
config[repo]['repo name'] = os.path.basename(repo)
|
|
423
425
|
|
|
424
|
-
|
|
426
|
+
if not args.quiet:
|
|
427
|
+
colour.write(f'Added [BLUE:{repo}] with default branch [BLUE:{default_branch}]')
|
|
425
428
|
|
|
426
429
|
if not args.quiet:
|
|
427
430
|
colour.write(cleareol=True)
|
|
@@ -571,12 +574,43 @@ def mg_list(args, config, console):
|
|
|
571
574
|
|
|
572
575
|
################################################################################
|
|
573
576
|
|
|
574
|
-
def
|
|
577
|
+
def mg_run(args, config, console):
|
|
575
578
|
"""Run a command in each of the working trees, optionally continuing if
|
|
576
579
|
there's an error"""
|
|
577
580
|
|
|
578
581
|
_ = console
|
|
579
582
|
|
|
583
|
+
if not args.parameters:
|
|
584
|
+
colour.error('[BOLD:+run] command - missing parameter(s)')
|
|
585
|
+
|
|
586
|
+
# Run the command in each of the working trees
|
|
587
|
+
|
|
588
|
+
for repo in select_git_repos(args, config):
|
|
589
|
+
if not args.quiet:
|
|
590
|
+
colour.write(f'\n[BLUE:{os.path.relpath(repo.name)}]\n')
|
|
591
|
+
|
|
592
|
+
repo_path = absolute_repo_path(args, repo.name)
|
|
593
|
+
|
|
594
|
+
try:
|
|
595
|
+
status = subprocess.run(args.parameters, cwd=repo_path)
|
|
596
|
+
except FileNotFoundError:
|
|
597
|
+
err_msg = f'"[BLUE:{args.parameters[0]}]" - Command not found'
|
|
598
|
+
if args.error_continue:
|
|
599
|
+
colour.write(f'[RED:WARNING]: {err_msg}')
|
|
600
|
+
else:
|
|
601
|
+
colour.error(f'[RED:ERROR]: {err_msg}')
|
|
602
|
+
else:
|
|
603
|
+
if status.returncode and not args.error_continue:
|
|
604
|
+
sys.exit(status)
|
|
605
|
+
|
|
606
|
+
################################################################################
|
|
607
|
+
|
|
608
|
+
def run_git_command(args, config, console):
|
|
609
|
+
"""Run a Git command in each of the working trees, optionally continuing if
|
|
610
|
+
there's an error"""
|
|
611
|
+
|
|
612
|
+
_ = console
|
|
613
|
+
|
|
580
614
|
for repo in select_git_repos(args, config):
|
|
581
615
|
repo_command = [args.command]
|
|
582
616
|
|
|
@@ -585,9 +619,10 @@ def run_git_command(args, config, console):
|
|
|
585
619
|
for cmd in args.parameters:
|
|
586
620
|
repo_command.append(branch_name(cmd, repo['default branch']))
|
|
587
621
|
|
|
588
|
-
|
|
622
|
+
if not args.quiet:
|
|
623
|
+
colour.write(f'\n[BLUE:{os.path.relpath(repo.name)}]\n')
|
|
589
624
|
|
|
590
|
-
# Run the command in the
|
|
625
|
+
# Run the command in the working tree
|
|
591
626
|
|
|
592
627
|
repo_path = absolute_repo_path(args, repo.name)
|
|
593
628
|
|
|
@@ -680,11 +715,12 @@ def parse_command_line():
|
|
|
680
715
|
colour.error('The "[BOLD:--path]" option takes a path parameter')
|
|
681
716
|
|
|
682
717
|
try:
|
|
683
|
-
|
|
718
|
+
workingdir = arg_list.pop(0)
|
|
719
|
+
os.chdir(workingdir)
|
|
684
720
|
except IndexError:
|
|
685
721
|
colour.error('The "[BOLD:-C]" option takes a path parameter', prefix=True)
|
|
686
722
|
except FileNotFoundError:
|
|
687
|
-
colour.error('"[BOLD:--path]" - path not found', prefix=True)
|
|
723
|
+
colour.error(f'"[BOLD:--path]" - path "[BLUE:{workingdir}]" not found', prefix=True)
|
|
688
724
|
|
|
689
725
|
elif option in ('help', 'h'):
|
|
690
726
|
colour.write(HELP_INFO)
|
|
@@ -729,6 +765,7 @@ COMMANDS = {
|
|
|
729
765
|
'tag': mg_tag,
|
|
730
766
|
'untag': mg_untag,
|
|
731
767
|
'list': mg_list,
|
|
768
|
+
'run': mg_run,
|
|
732
769
|
}
|
|
733
770
|
|
|
734
771
|
def main():
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: skilleter_thingy
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.26
|
|
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
|
|
@@ -118,6 +118,8 @@ Multigit supports a small list of subcommands, each of which are prefixed with a
|
|
|
118
118
|
|
|
119
119
|
`+untag TAG` - Remove the tag from the specified working trees (do nothing if the tag is not applied in the first place).
|
|
120
120
|
|
|
121
|
+
`+run COMMAND` - Run the specified command in each of the specified working trees
|
|
122
|
+
|
|
121
123
|
Any command *not* prefixed with `+` is run in each of the working trees (filtered by the various multigit options) as a git command.
|
|
122
124
|
|
|
123
125
|
For example; `multigit -m commit -ab` would run `git commit -a` in each of the working trees that is branched and contains modified files.
|
|
@@ -25,7 +25,7 @@ skilleter_thingy/gl.py,sha256=9zbGpKxw6lX9RghLkdy-Q5sZlqtbB3uGFO04qTu1dH8,5954
|
|
|
25
25
|
skilleter_thingy/linecount.py,sha256=ehTN6VD76i4U5k6dXuYoiqSRHI67_BP-bziklNAJSKY,4309
|
|
26
26
|
skilleter_thingy/localphotosync.py,sha256=WF0TcCvLfl7cVOLzYYQK_t2WebLfQ-5FM6UB3r7Fpvw,5952
|
|
27
27
|
skilleter_thingy/moviemover.py,sha256=QzUAWQzQ1AWWREIhl-VMaLo2h8MMhOekBnao5jGWV1s,4470
|
|
28
|
-
skilleter_thingy/multigit.py,sha256=
|
|
28
|
+
skilleter_thingy/multigit.py,sha256=ZLL0AN2ZmrWY2BPBaHsdVqqGeyk3pJo1jMFRm2zZXoU,33056
|
|
29
29
|
skilleter_thingy/photodupe.py,sha256=2hw4EhDKH37_BgdXKkPm9GrftfIORmubQi38Yn0b4Mg,4084
|
|
30
30
|
skilleter_thingy/phototidier.py,sha256=BOu-cKHMivDlBqlRqv7sL3J6Ix1K2dxWWNcderldyZo,7818
|
|
31
31
|
skilleter_thingy/py_audit.py,sha256=4CAdqBAIIVcpTCn_7dGm56bdfGpUtUJofqTGZomClkY,4417
|
|
@@ -61,9 +61,9 @@ skilleter_thingy/thingy/run.py,sha256=6SNKWF01fSxzB10GMU9ajraXYZqAL1w0PXkqjJdr1U
|
|
|
61
61
|
skilleter_thingy/thingy/tfm_pane.py,sha256=XTTpSm71CyQyGmlVLuCthioOwech0jhUiFUXb-chS_Q,19792
|
|
62
62
|
skilleter_thingy/thingy/tidy.py,sha256=AQ2RawsZJg6WHrgayi_ZptFL9occ7suSdCHbU3P-cys,5971
|
|
63
63
|
skilleter_thingy/thingy/venv_template.py,sha256=SsVNvSwojd8NnFeQaZPCRQYTNdwJRplpZpygbUEXRnY,1015
|
|
64
|
-
skilleter_thingy-0.1.
|
|
65
|
-
skilleter_thingy-0.1.
|
|
66
|
-
skilleter_thingy-0.1.
|
|
67
|
-
skilleter_thingy-0.1.
|
|
68
|
-
skilleter_thingy-0.1.
|
|
69
|
-
skilleter_thingy-0.1.
|
|
64
|
+
skilleter_thingy-0.1.26.dist-info/licenses/LICENSE,sha256=ljOS4DjXvqEo5VzGfdaRwgRZPbNScGBmfwyC8PChvmQ,32422
|
|
65
|
+
skilleter_thingy-0.1.26.dist-info/METADATA,sha256=F2AzaiFif-DiP2_J1ZKEGymC4jcf_eiQN49tKcxYpOM,30260
|
|
66
|
+
skilleter_thingy-0.1.26.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
67
|
+
skilleter_thingy-0.1.26.dist-info/entry_points.txt,sha256=mklrWFvNKw9Hyem9RG3x0PoVYjlx2fDnJ3xWMTMOmfs,2258
|
|
68
|
+
skilleter_thingy-0.1.26.dist-info/top_level.txt,sha256=8-JhgToBBiWURunmvfpSxEvNkDHQQ7r25-aBXtZv61g,17
|
|
69
|
+
skilleter_thingy-0.1.26.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|