skilleter-thingy 0.0.96__py3-none-any.whl → 0.0.98__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 +95 -57
- skilleter_thingy/thingy/colour.py +17 -3
- skilleter_thingy/thingy/git2.py +0 -4
- {skilleter_thingy-0.0.96.dist-info → skilleter_thingy-0.0.98.dist-info}/METADATA +99 -20
- {skilleter_thingy-0.0.96.dist-info → skilleter_thingy-0.0.98.dist-info}/RECORD +9 -9
- {skilleter_thingy-0.0.96.dist-info → skilleter_thingy-0.0.98.dist-info}/WHEEL +1 -1
- {skilleter_thingy-0.0.96.dist-info → skilleter_thingy-0.0.98.dist-info}/LICENSE +0 -0
- {skilleter_thingy-0.0.96.dist-info → skilleter_thingy-0.0.98.dist-info}/entry_points.txt +0 -0
- {skilleter_thingy-0.0.96.dist-info → skilleter_thingy-0.0.98.dist-info}/top_level.txt +0 -0
skilleter_thingy/multigit.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
|
|
3
|
-
"""mg - MultiGit - utility for managing multiple Git
|
|
3
|
+
"""mg - MultiGit - utility for managing multiple Git working trees in a hierarchical directory tree"""
|
|
4
4
|
|
|
5
5
|
import os
|
|
6
6
|
import sys
|
|
@@ -14,29 +14,32 @@ import thingy.colour as colour
|
|
|
14
14
|
|
|
15
15
|
################################################################################
|
|
16
16
|
|
|
17
|
-
# DONE: / Output name of each
|
|
18
|
-
# DONE: Better error-handling - e.g. continue/abort option after failure in one
|
|
17
|
+
# DONE: / Output name of each working tree as it is processed as command sits there seeming to do nothing otherwise.
|
|
18
|
+
# DONE: Better error-handling - e.g. continue/abort option after failure in one working tree
|
|
19
19
|
# DONE: Currently doesn't handle single letter options in concatenated form - e.g. -dv
|
|
20
20
|
# DONE: Don't save the configuration on exit if it hasn't changed
|
|
21
21
|
# DONE: Don't use a fixed list of default branch names
|
|
22
22
|
# DONE: If the config file isn't in the current directory then search up the directory tree for it but run in the current directory
|
|
23
23
|
# DONE: Use the configuration file
|
|
24
|
-
# DONE: command to categorise
|
|
24
|
+
# DONE: command to categorise working trees then command line filter to only act on working trees in category (in addition to other filtering options) - +tag <TAG> command tags all selected working trees and updates the configuration, +untag <TAG> command to remove tags in the same way
|
|
25
25
|
# DONE: init function
|
|
26
26
|
# NOPE: Dry-run option - just pass the option to the Git command
|
|
27
27
|
# NOPE: Is it going to be a problem if the same repo is checked out twice or more in the same workspace - user problem
|
|
28
28
|
# NOPE: Pull/fetch - only output after running command and only if something updated
|
|
29
29
|
# NOPE: Switch to tomlkit
|
|
30
30
|
# TODO: -j option to run in parallel - yes, but it will only work with non-interactive Git commands
|
|
31
|
-
# TODO: Command that takes partial
|
|
31
|
+
# TODO: Command that takes partial working tree name and either returns full path or pops up window to autocomplete until single match found
|
|
32
32
|
# TODO: Consistent colours in output
|
|
33
|
-
# TODO: If run in a subdirectory, only process repos in that tree (or have an option to do so)
|
|
34
33
|
# TODO: Option to +dir to return all matches so that caller can select one they want
|
|
35
34
|
# TODO: Verbose option
|
|
36
35
|
# TODO: When filtering by tag, if tag starts with '!' only match if tag isn't present (and don't allow '!' at start of tag otherwise)
|
|
37
|
-
#
|
|
36
|
+
# DONE: When specifying list of working trees, if name doesn't contain '/' prefix it with '*'?
|
|
38
37
|
# TODO: select_git_repos() and +dir should use consist way of selecting repos if possible
|
|
39
38
|
# TODO: +run command to do things other than git commands
|
|
39
|
+
# TODO: init option '--update' to update the configuration file with new working trees and remove ones that are no longer there
|
|
40
|
+
# TODO: init option '--set-default' to update the default branch to the current one for specified working trees
|
|
41
|
+
# TODO: Integrate completion with fzf if installed?
|
|
42
|
+
# TODO: If run in a subdirectory, only process working trees in that tree (or have an option to do so, or an option _not_ to do so; --all)
|
|
40
43
|
################################################################################
|
|
41
44
|
|
|
42
45
|
DEFAULT_CONFIG_FILE = 'multigit.toml'
|
|
@@ -48,7 +51,7 @@ DEFAULT_BRANCH = 'DEFAULT'
|
|
|
48
51
|
|
|
49
52
|
################################################################################
|
|
50
53
|
|
|
51
|
-
HELP_INFO = """usage: multigit [-h] [--verbose] [--quiet] [--config CONFIG] [--
|
|
54
|
+
HELP_INFO = """usage: multigit [-h] [--verbose] [--quiet] [--config CONFIG] [--repos REPOS] [--modified] [--branched] [--tag TAGS]
|
|
52
55
|
{+init, +config, +dir, GIT_COMMAND} ...
|
|
53
56
|
|
|
54
57
|
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
|
|
@@ -59,8 +62,6 @@ options:
|
|
|
59
62
|
--quiet, -q Minimal console output
|
|
60
63
|
--config CONFIG, -c CONFIG
|
|
61
64
|
The configuration file (defaults to multigit.toml)
|
|
62
|
-
--directory DIRECTORY, --dir DIRECTORY
|
|
63
|
-
The top-level directory of the multigit tree (defaults to the current directory)
|
|
64
65
|
--repos REPOS, -r REPOS
|
|
65
66
|
The repo names to work on (defaults to all repos and can contain shell wildcards and can be issued multiple times on the command line)
|
|
66
67
|
--modified, -m Select repos that have local modifications
|
|
@@ -85,18 +86,38 @@ Sub-commands:
|
|
|
85
86
|
class Arguments():
|
|
86
87
|
"""Data class to contain command line options and parameters"""
|
|
87
88
|
|
|
89
|
+
# Command line options for output noise
|
|
90
|
+
|
|
88
91
|
quiet: bool = False
|
|
89
92
|
verbose: bool = False
|
|
90
|
-
|
|
91
|
-
|
|
93
|
+
|
|
94
|
+
# True if we continue after a git command returns an error
|
|
95
|
+
|
|
96
|
+
error_continue: bool = False
|
|
97
|
+
|
|
98
|
+
# Default and current configuration file
|
|
99
|
+
|
|
100
|
+
default_configuration_file: str = DEFAULT_CONFIG_FILE
|
|
101
|
+
configuration_file: str = None
|
|
102
|
+
|
|
103
|
+
# Command line filter options
|
|
104
|
+
|
|
92
105
|
repos: list[str] = field(default_factory=list)
|
|
93
106
|
tag: list[str] = field(default_factory=list)
|
|
94
107
|
modified: bool = False
|
|
95
108
|
branched: bool = False
|
|
109
|
+
|
|
110
|
+
# Command to run with parameters
|
|
111
|
+
|
|
96
112
|
command: str = None
|
|
97
|
-
error_continue: bool = False
|
|
98
113
|
parameters: list[str] = field(default_factory=list)
|
|
114
|
+
|
|
115
|
+
# True if running an internal command
|
|
116
|
+
|
|
99
117
|
internal_command: bool = False
|
|
118
|
+
|
|
119
|
+
# True if the configuration data needs to be written back on completion
|
|
120
|
+
|
|
100
121
|
config_modified: bool = False
|
|
101
122
|
|
|
102
123
|
################################################################################
|
|
@@ -109,21 +130,21 @@ def error(msg, status=1):
|
|
|
109
130
|
|
|
110
131
|
################################################################################
|
|
111
132
|
|
|
112
|
-
def find_configuration(
|
|
133
|
+
def find_configuration(default_config_file):
|
|
113
134
|
"""If the configuration file name has path elements, try and read it, otherwise
|
|
114
135
|
search up the directory tree looking for the configuration file.
|
|
115
136
|
Returns configuration file path or None if the configuration file
|
|
116
137
|
could not be found."""
|
|
117
138
|
|
|
118
|
-
if '/' in
|
|
119
|
-
config_file =
|
|
139
|
+
if '/' in default_config_file:
|
|
140
|
+
config_file = default_config_file
|
|
120
141
|
else:
|
|
121
142
|
config_path = os.getcwd()
|
|
122
|
-
config_file = os.path.join(config_path,
|
|
143
|
+
config_file = os.path.join(config_path, default_config_file)
|
|
123
144
|
|
|
124
145
|
while not os.path.isfile(config_file) and config_path != '/':
|
|
125
146
|
config_path = os.path.dirname(config_path)
|
|
126
|
-
config_file = os.path.join(config_path,
|
|
147
|
+
config_file = os.path.join(config_path, default_config_file)
|
|
127
148
|
|
|
128
149
|
return config_file if os.path.isfile(config_file) else None
|
|
129
150
|
|
|
@@ -132,18 +153,11 @@ def find_configuration(args):
|
|
|
132
153
|
def show_progress(width, msg):
|
|
133
154
|
"""Show a single line progress message"""
|
|
134
155
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
colour.write(f'{name}', newline=False)
|
|
138
|
-
|
|
139
|
-
if len(name) < width-1:
|
|
140
|
-
colour.write(' '*(width-len(name)), newline=False)
|
|
141
|
-
|
|
142
|
-
colour.write('\r', newline=False)
|
|
156
|
+
colour.write(msg[:width-1], newline=False, cleareol=True, cr=True)
|
|
143
157
|
|
|
144
158
|
################################################################################
|
|
145
159
|
|
|
146
|
-
def
|
|
160
|
+
def find_working_trees(args):
|
|
147
161
|
"""Locate and return a list of '.git' directory parent directories in the
|
|
148
162
|
specified path.
|
|
149
163
|
|
|
@@ -250,29 +264,49 @@ def mg_init(args, config, console):
|
|
|
250
264
|
|
|
251
265
|
if args.modified or args.branched or args.tag:
|
|
252
266
|
error('The "--tag", "--modified" and "--branched" options cannot be used with the "init" subcommand')
|
|
253
|
-
elif not config:
|
|
254
|
-
error(f'Unable to location configuration file "{args.configuration_file}"')
|
|
255
|
-
|
|
256
|
-
# TODO: Update should remove or warn about repos that are no longer present
|
|
257
267
|
|
|
258
|
-
# Search for .git directories
|
|
268
|
+
# Search for .git directories and add any that aren't already in the configuration
|
|
259
269
|
|
|
260
|
-
|
|
270
|
+
repo_list = []
|
|
271
|
+
for repo in find_working_trees(args):
|
|
261
272
|
if not args.quiet:
|
|
262
|
-
show_progress(console.columns, repo
|
|
273
|
+
show_progress(console.columns, repo)
|
|
274
|
+
|
|
275
|
+
repo_list.append(repo)
|
|
263
276
|
|
|
264
277
|
if repo not in config:
|
|
278
|
+
default_branch = git.branch(path=repo)
|
|
279
|
+
|
|
265
280
|
config[repo] = {
|
|
266
|
-
'default branch':
|
|
281
|
+
'default branch': default_branch
|
|
267
282
|
}
|
|
268
283
|
|
|
269
|
-
|
|
284
|
+
remote = git.remotes(path=repo)
|
|
270
285
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
286
|
+
if 'origin' in remote:
|
|
287
|
+
config[repo]['origin'] = remote['origin']
|
|
288
|
+
config[repo]['repo name']= os.path.basename(remote['origin']).removesuffix('.git')
|
|
289
|
+
else:
|
|
290
|
+
config[repo]['repo name'] = os.path.basename(repo)
|
|
291
|
+
|
|
292
|
+
colour.write(f'Added [BOLD:{repo}] with default branch [BLUE:{default_branch}]')
|
|
293
|
+
|
|
294
|
+
if not args.quiet:
|
|
295
|
+
colour.write(cleareol=True)
|
|
296
|
+
|
|
297
|
+
# Look for configuration entries that are no longer present and delete them
|
|
298
|
+
|
|
299
|
+
removals = []
|
|
300
|
+
|
|
301
|
+
for repo in config:
|
|
302
|
+
if repo != 'DEFAULT' and repo not in repo_list:
|
|
303
|
+
removals.append(repo)
|
|
304
|
+
|
|
305
|
+
for entry in removals:
|
|
306
|
+
del config[repo]
|
|
307
|
+
colour.write(f'Removed [BOLD:{repo}] as it no longer exists')
|
|
308
|
+
|
|
309
|
+
# The configuration file needs to be updated
|
|
276
310
|
|
|
277
311
|
args.config_modified = True
|
|
278
312
|
|
|
@@ -445,7 +479,7 @@ def parse_command_line():
|
|
|
445
479
|
elif param in ('--config', '-c'):
|
|
446
480
|
try:
|
|
447
481
|
i += 1
|
|
448
|
-
args.
|
|
482
|
+
args.default_configuration_file = argv[i]
|
|
449
483
|
except IndexError:
|
|
450
484
|
error('--config - missing configuration file parameter')
|
|
451
485
|
|
|
@@ -499,37 +533,41 @@ def parse_command_line():
|
|
|
499
533
|
|
|
500
534
|
args.parameters = argv[i+1:]
|
|
501
535
|
|
|
502
|
-
args.configuration_file = find_configuration(args)
|
|
536
|
+
args.configuration_file = find_configuration(args.default_configuration_file)
|
|
503
537
|
|
|
504
538
|
return args
|
|
505
539
|
|
|
506
540
|
################################################################################
|
|
507
541
|
|
|
542
|
+
COMMANDS = {
|
|
543
|
+
'init': mg_init,
|
|
544
|
+
'dir': mg_dir,
|
|
545
|
+
'config': mg_config,
|
|
546
|
+
'tag': mg_tag,
|
|
547
|
+
'untag': mg_untag,
|
|
548
|
+
}
|
|
549
|
+
|
|
508
550
|
def main():
|
|
509
551
|
"""Main function"""
|
|
510
552
|
|
|
511
|
-
commands = {
|
|
512
|
-
'init': mg_init,
|
|
513
|
-
'dir': mg_dir,
|
|
514
|
-
'config': mg_config,
|
|
515
|
-
'tag': mg_tag,
|
|
516
|
-
'untag': mg_untag,
|
|
517
|
-
}
|
|
518
|
-
|
|
519
553
|
args = parse_command_line()
|
|
520
554
|
|
|
521
|
-
if args.internal_command and args.command not in
|
|
555
|
+
if args.internal_command and args.command not in COMMANDS:
|
|
522
556
|
error(f'Invalid command "{args.command}"')
|
|
523
557
|
|
|
524
558
|
# If the configuration file exists, read it
|
|
525
559
|
|
|
526
560
|
config = configparser.ConfigParser()
|
|
527
561
|
|
|
528
|
-
|
|
529
|
-
|
|
562
|
+
# If running the '+init' command without an existing configuration file
|
|
563
|
+
# use the default one (which may have been overridden on the command line)
|
|
564
|
+
# Otherwise, fail if we can't find the configuration file.
|
|
565
|
+
|
|
566
|
+
if not args.configuration_file:
|
|
567
|
+
if args.internal_command and args.command == 'init':
|
|
568
|
+
args.configuration_file = os.path.abspath(args.default_configuration_file)
|
|
569
|
+
else:
|
|
530
570
|
error('Cannot locate configuration file')
|
|
531
|
-
elif not os.path.isfile(args.configuration_file):
|
|
532
|
-
error(f'Cannot read configuration file {args.configuration_file}')
|
|
533
571
|
|
|
534
572
|
if os.path.isfile(args.configuration_file):
|
|
535
573
|
config.read(args.configuration_file)
|
|
@@ -548,7 +586,7 @@ def main():
|
|
|
548
586
|
if args.internal_command:
|
|
549
587
|
# Run the subcommand
|
|
550
588
|
|
|
551
|
-
|
|
589
|
+
COMMANDS[args.command](args, config, console)
|
|
552
590
|
|
|
553
591
|
# Save the updated configuration file if it has changed (currently, only the init command will do this).
|
|
554
592
|
|
|
@@ -42,6 +42,8 @@ _ANSI_BMAGENTA = '\x1b[45m'
|
|
|
42
42
|
_ANSI_BCYAN = '\x1b[46m'
|
|
43
43
|
_ANSI_BWHITE = '\x1b[47m'
|
|
44
44
|
|
|
45
|
+
_ANSI_CLEAREOL = '\x1b[K'
|
|
46
|
+
|
|
45
47
|
# Looking up tables for converting textual colour codes to ANSI codes
|
|
46
48
|
|
|
47
49
|
ANSI_REGEXES = \
|
|
@@ -144,7 +146,7 @@ def format(txt):
|
|
|
144
146
|
|
|
145
147
|
################################################################################
|
|
146
148
|
|
|
147
|
-
def write(txt=None, newline=True, stream=sys.stdout, indent=0, strip=False):
|
|
149
|
+
def write(txt=None, newline=True, stream=sys.stdout, indent=0, strip=False, cleareol=False, cr=False):
|
|
148
150
|
""" Write to the specified stream (defaulting to stdout), converting colour codes to ANSI
|
|
149
151
|
txt can be None, a string or a list of strings."""
|
|
150
152
|
|
|
@@ -163,10 +165,22 @@ def write(txt=None, newline=True, stream=sys.stdout, indent=0, strip=False):
|
|
|
163
165
|
|
|
164
166
|
stream.write(line)
|
|
165
167
|
|
|
168
|
+
if cleareol:
|
|
169
|
+
stream.write(_ANSI_CLEAREOL)
|
|
170
|
+
|
|
166
171
|
if newline or n < len(txt) - 1:
|
|
167
172
|
stream.write('\n')
|
|
168
|
-
|
|
169
|
-
|
|
173
|
+
elif cr:
|
|
174
|
+
stream.write('\r')
|
|
175
|
+
|
|
176
|
+
else:
|
|
177
|
+
if cleareol:
|
|
178
|
+
stream.write(_ANSI_CLEAREOL)
|
|
179
|
+
|
|
180
|
+
if newline:
|
|
181
|
+
stream.write('\n')
|
|
182
|
+
elif cr:
|
|
183
|
+
stream.write('\r')
|
|
170
184
|
|
|
171
185
|
################################################################################
|
|
172
186
|
|
skilleter_thingy/thingy/git2.py
CHANGED
|
@@ -1106,10 +1106,6 @@ def default_branch():
|
|
|
1106
1106
|
|
|
1107
1107
|
return None
|
|
1108
1108
|
|
|
1109
|
-
################################################################################
|
|
1110
|
-
|
|
1111
|
-
return None
|
|
1112
|
-
|
|
1113
1109
|
################################################################################
|
|
1114
1110
|
|
|
1115
1111
|
def matching_branch(branchname, case=False):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: skilleter_thingy
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.98
|
|
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
|
|
@@ -36,53 +36,59 @@ This README just contains a summary of the functionality of each command.
|
|
|
36
36
|
|
|
37
37
|
# Git Repo Management
|
|
38
38
|
|
|
39
|
-
##
|
|
39
|
+
## Multigit
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
Multigit is a tool for managing a collection of related git working trees.
|
|
42
42
|
|
|
43
|
-
This is intended for use in a situation where you have a collection of related git working trees organised in a directory hierarchy
|
|
43
|
+
This is intended for use in a situation where you have a collection of related git working trees organised in a directory hierarchy which aren't managed using git submodules or any other tool. It allows you to run git commands on multiple working trees at once, without navigating around the different working trees to do so and to select which working trees commands are run in.
|
|
44
|
+
|
|
45
|
+
## Initialisation
|
|
44
46
|
|
|
45
47
|
Start by running ensuring that the default branch (e.g. `main`) is checked out in each of the working trees and, in the top-level directory, run `multigit init` to create the configuration file which, by default is called `multigit.toml` - this is just a text file that sets the configuration for each working tree in terms of name, origin, default branch and location.
|
|
46
48
|
|
|
49
|
+
## Multigit Command Line
|
|
50
|
+
|
|
47
51
|
The multigit command line format is:
|
|
48
52
|
|
|
49
53
|
multigit OPTIONS COMMAND
|
|
50
54
|
|
|
51
|
-
Where COMMAND is an internal multigit command if it starts with a
|
|
55
|
+
Where COMMAND is an internal multigit command if it starts with a `+` and is a git command otherwise (including the additional git commands described in this document).
|
|
52
56
|
|
|
53
57
|
By default, when multigit is invoked with a git command, it runs a the command in each of the working trees selected by the command line options passed to multigit (if no options are specified then the command is run in *all* the working trees.
|
|
54
58
|
|
|
55
59
|
The command takes a number of options that can be used to select the list of working trees that each of the subcommands that it supports runs in:
|
|
56
60
|
|
|
57
|
-
|
|
61
|
+
`--repos REPO` / `-r REPO` Allows a list of working trees to be specfied, either by path, name or a wildcard matching either.
|
|
58
62
|
|
|
59
|
-
|
|
63
|
+
`--modified` / `-m` Run only in working trees containing locally modified files
|
|
60
64
|
|
|
61
|
-
|
|
65
|
+
`--branched` / `-b` Run only in working trees where the current branch that is checked out is NOT the default branch
|
|
62
66
|
|
|
63
|
-
|
|
67
|
+
`--tag TAG` / `-t TAG` Run only in working trees that are tagged with the specified tag
|
|
64
68
|
|
|
65
|
-
These options are AND-ed together, so specifying `--modified --branched --tag WOMBAT` will select only working trees that are modified AND branched AND tagged with
|
|
69
|
+
These options are AND-ed together, so specifying `--modified --branched --tag WOMBAT` will select only working trees that are modified AND branched AND tagged with `WOMBAT`, but the parameters to the `--repos` and `--tag` options are OR-ed together, so specifying `--tag WOMBAT --tag EMU` will select repos that are tagged as `WOMBAT` *OR* `EMU`.
|
|
66
70
|
|
|
67
71
|
Multigit tags are stored in the configuration file, not within the working tree and each working tree can have multiple tags.
|
|
68
72
|
|
|
73
|
+
## Multigit Commands
|
|
74
|
+
|
|
69
75
|
Multigit supports a small list of subcommands, each of which are prefixed with a `+` to distinguish them from Git commands:
|
|
70
76
|
|
|
71
|
-
|
|
77
|
+
`+init` - Create or update the configuration file
|
|
72
78
|
|
|
73
|
-
|
|
79
|
+
`+dir` - Given the name of a working tree, output the location within the multigit tree of that working tree if the name matches uniquely, or the name of the directory where the multigit configuration file resides if no parameter is specified.
|
|
74
80
|
|
|
75
|
-
|
|
81
|
+
`+config` - Print the name and location of the multigit configuration file.
|
|
76
82
|
|
|
77
|
-
|
|
83
|
+
`+tag TAG` - If no tag specified list tags applied to the specified working trees. If a tag *is* specified, then *apply* the tag to the specified working trees.
|
|
78
84
|
|
|
79
|
-
|
|
85
|
+
`+untag TAG` - Remove the tag from the specified working trees (do nothing if the tag is not applied in the first place).
|
|
80
86
|
|
|
81
|
-
Any command not prefixed with
|
|
87
|
+
Any command *not* prefixed with `+` is run in each of the working trees (filtered by the various multigit options) as a git command.
|
|
82
88
|
|
|
83
89
|
For example; `multigit -m commit -ab` would run `git commit -a` in each of the working trees that is branched and contains modified files.
|
|
84
90
|
|
|
85
|
-
The `+dir` command can be used with shell aliases (or their equivalent in the user's shell of choice) to create an alias to run, for example, `cd (multigit +dir "$@")` (Bash) or `cd (multigit +dir $argv)` (for the Fish shell) that would cd to the top level
|
|
91
|
+
The `+dir` command can be used with shell aliases (or their equivalent in the user's shell of choice) to create an alias to run, for example, `cd (multigit +dir "$@")` (Bash) or `cd (multigit +dir $argv)` (for the Fish shell) that would cd to the top level directory.
|
|
86
92
|
|
|
87
93
|
# Miscellaneous Git Utilities
|
|
88
94
|
|
|
@@ -92,23 +98,96 @@ Output a string containing colour-coded shell nesting level, current directory a
|
|
|
92
98
|
|
|
93
99
|
# Git Extensions
|
|
94
100
|
|
|
95
|
-
Due to the way that the git command works, these can be run as they were additional git subcommands.
|
|
101
|
+
Due to the way that the git command works, these can be run as they were additional git subcommands, although, due to a limitation in git, the only things that does not work is the `--help` option where the command has to be run with a hyphen between `git` and the subcommand - for example `git ca --help` does not work, but `git-ca --help` does.
|
|
102
|
+
|
|
103
|
+
## Branch Names
|
|
104
|
+
|
|
105
|
+
Where one of the git extensions takes an existing branch name as a parameter, the branch name can be abbreviated and the abbreviated form is expanded according to the following rules:
|
|
106
|
+
|
|
107
|
+
* If the specified branch name exactly matches an existing branch, tag or commit ID then that is used (this includes remote branches where appropriate, if no local branches match).
|
|
108
|
+
* Otherwise, the branch name is compared to existing branches (again, including remote branches where appropriate, if no local branches match) and, if the specified name uniquely partially matches an existing branch (optionally using `*` and `?` wildcard characters) that branch is used. If it matches multiple branches than an error is reported.
|
|
109
|
+
|
|
110
|
+
For example, given a repo with the following branches:
|
|
111
|
+
|
|
112
|
+
origin/wombat
|
|
113
|
+
origin/platypus
|
|
114
|
+
wombat
|
|
115
|
+
emu
|
|
116
|
+
battery
|
|
117
|
+
chaos
|
|
118
|
+
|
|
119
|
+
Then:
|
|
120
|
+
|
|
121
|
+
* 'emu' will match 'emu'
|
|
122
|
+
* 'wombat' will match 'wombat' but not 'origin/wombat' since the local branch takes precedence
|
|
123
|
+
* 'at' will match both 'wombat' and 'battery' and will report an error
|
|
124
|
+
* 'pus' will match 'origin/platypus'
|
|
125
|
+
|
|
126
|
+
This is most useful where branches contain ticket numbers so, for instance given a branch called `feature/SKIL-103` you can check it out using `git co 103` assuming no other local branches contain `103` in their name.
|
|
127
|
+
|
|
128
|
+
Note that the concept of the default branch `DEFAULT` mentioned above *only* applies when using the `multigit` command, although some of the commands will treat branches called `master` or `main` as special cases (see the individual command documentation).
|
|
96
129
|
|
|
97
130
|
## git ca
|
|
98
131
|
|
|
99
132
|
Improved version of 'git commit --amend'. Updates files that are already in the commit and, optionally, adds and commits additional files.
|
|
100
133
|
|
|
134
|
+
usage: git-ca [-h] [--added] [--all] [--everything] [--ignored] [--patch] [--verbose] [--dry-run] [files ...]
|
|
135
|
+
|
|
136
|
+
positional arguments:
|
|
137
|
+
files List of files to add to the commit
|
|
138
|
+
|
|
139
|
+
options:
|
|
140
|
+
-h, --help show this help message and exit
|
|
141
|
+
--added, -A Update files in the current commit, including files added with `git add`
|
|
142
|
+
--all, -a Append all locally-modified, tracked files to the current commit
|
|
143
|
+
--everything, -e Append all modified and untracked files to the current commit (implies `~--all`)
|
|
144
|
+
--ignored, -i Include files normally hidden by `.gitignore`
|
|
145
|
+
--patch, -p Use the interactive patch selection interface to chose which changes to commit.
|
|
146
|
+
--verbose, -v Verbose mode
|
|
147
|
+
--dry-run, -D Dry-run
|
|
148
|
+
|
|
101
149
|
## git cleanup
|
|
102
150
|
|
|
103
151
|
List or delete branches that have already been merged and delete tracking branches that are no longer on the remote.
|
|
104
152
|
|
|
153
|
+
git-cleanup [-h] [--delete] [--master MASTER] [--force] [--unmerged] [--yes] [--debug] [branches ...]
|
|
154
|
+
|
|
155
|
+
positional arguments:
|
|
156
|
+
|
|
157
|
+
branches List of branches to check (default is all branches)
|
|
158
|
+
|
|
159
|
+
options:
|
|
160
|
+
-h, --help show this help message and exit
|
|
161
|
+
--delete, -d Delete all branches that have been merged
|
|
162
|
+
--master MASTER, -m MASTER, --main MASTER
|
|
163
|
+
Specify the master branch (Attempts to read this from GitLab or defaults to "develop" if present or "master" or "main" otherwise
|
|
164
|
+
--force, -f Allow protected branches (e.g. master) to be removed
|
|
165
|
+
--unmerged, -u List branches that have NOT been merged
|
|
166
|
+
--yes, -y Assume "yes" in response to any prompts (e.g. to delete branches)
|
|
167
|
+
--debug Enable debug output
|
|
168
|
+
|
|
105
169
|
## git co
|
|
106
170
|
|
|
107
|
-
Equivalent to
|
|
171
|
+
Equivalent to `git checkout` but with enhanced branch matching as described above. The command does not support the full range of options supported by the `git checkout` comamnd which should still be used where additional functionality is required.
|
|
172
|
+
|
|
173
|
+
git-co [-h] [--branch] [--update] [--rebase] [--force] [--exact] [--debug] branchname
|
|
174
|
+
|
|
175
|
+
positional arguments:
|
|
176
|
+
|
|
177
|
+
branchname The branch name (or a partial name that matches uniquely against a local branch, remote branch, commit ID or tag)
|
|
178
|
+
|
|
179
|
+
options:
|
|
180
|
+
-h, --help show this help message and exit
|
|
181
|
+
--branch, -b Create the specified branch
|
|
182
|
+
--update, -u If a remote branch exists, delete any local branch and check out the remote version
|
|
183
|
+
--rebase, -r Rebase the branch onto its parent after checking it out
|
|
184
|
+
--force, -f When using the update option, recreate the local branch even if it is owned by the current user (based on the author of the most recent commit)
|
|
185
|
+
--exact, -e Do not use branch name matching - check out the branch as specified (if it exists)
|
|
186
|
+
--debug Enable debug output
|
|
108
187
|
|
|
109
188
|
## git parent
|
|
110
189
|
|
|
111
|
-
Attempt to determine the parent branch for the specified branch (defaulting to the current one)
|
|
190
|
+
Attempt to determine the parent branch for the specified branch (defaulting to the current one).
|
|
112
191
|
|
|
113
192
|
## git update
|
|
114
193
|
|
|
@@ -25,7 +25,7 @@ skilleter_thingy/gl.py,sha256=9zbGpKxw6lX9RghLkdy-Q5sZlqtbB3uGFO04qTu1dH8,5954
|
|
|
25
25
|
skilleter_thingy/gphotosync.py,sha256=Vb2zYTEFp26BYdkG810SRg9afyfDqvq4CLHTk-MFf60,22388
|
|
26
26
|
skilleter_thingy/linecount.py,sha256=ehTN6VD76i4U5k6dXuYoiqSRHI67_BP-bziklNAJSKY,4309
|
|
27
27
|
skilleter_thingy/moviemover.py,sha256=QzUAWQzQ1AWWREIhl-VMaLo2h8MMhOekBnao5jGWV1s,4470
|
|
28
|
-
skilleter_thingy/multigit.py,sha256=
|
|
28
|
+
skilleter_thingy/multigit.py,sha256=mYEppth-mt_BPT9UTpSOOoNTyk5b1hIb4QZ4h_Q9EwI,22090
|
|
29
29
|
skilleter_thingy/photodupe.py,sha256=l0hbzSLb2Vk2ceteg-x9fHXCEE1uUuFo84hz5rsZUPA,4184
|
|
30
30
|
skilleter_thingy/phototidier.py,sha256=BOu-cKHMivDlBqlRqv7sL3J6Ix1K2dxWWNcderldyZo,7818
|
|
31
31
|
skilleter_thingy/py_audit.py,sha256=xJm5k5qyeA6ii8mODa4dOkmP8L1drv94UHuxR54RsIM,4384
|
|
@@ -44,7 +44,7 @@ skilleter_thingy/window_rename.py,sha256=dCBgZqih_3YKHt35hsOAhARFp3QxOi8w8huC63s
|
|
|
44
44
|
skilleter_thingy/xchmod.py,sha256=T89xiH_po0nvH5T1AGgQOD5yhjKd9-LcHcmez3IORww,4604
|
|
45
45
|
skilleter_thingy/yamlcheck.py,sha256=FXylZ5NtHirDlPVhVEUZUZkTugVR-g51BbjaN06akAc,2868
|
|
46
46
|
skilleter_thingy/thingy/__init__.py,sha256=rVPTxm8L5w52U0YdTd7r_D44SBP7pS3JCJtsf0iIsow,110
|
|
47
|
-
skilleter_thingy/thingy/colour.py,sha256
|
|
47
|
+
skilleter_thingy/thingy/colour.py,sha256=mx7pXXoykQTiCu_BNA-JJSgFpsaUW3noY89d8YKrwBs,7411
|
|
48
48
|
skilleter_thingy/thingy/dc_curses.py,sha256=fuuQPR11zV_akAhygL_cAhVLC5YAgKgowzlITVbETE8,8539
|
|
49
49
|
skilleter_thingy/thingy/dc_defaults.py,sha256=ahcteQvoWZrO5iTU68zkIY1Zex6iX5uR5ubwI4CCYBk,6170
|
|
50
50
|
skilleter_thingy/thingy/dc_util.py,sha256=Df73imXhHx3HzcPHiRcHAoea0e3HURdLcrolUsMhOFs,1783
|
|
@@ -52,7 +52,7 @@ skilleter_thingy/thingy/dircolors.py,sha256=5NbXMsGWdABLvvZfB70VPmN6N5HyyihfpgoQ
|
|
|
52
52
|
skilleter_thingy/thingy/docker.py,sha256=9EFatudoVPfB1UbDEtzdJDB3o6ToHiNHv8-oLsUeqiQ,2449
|
|
53
53
|
skilleter_thingy/thingy/files.py,sha256=oW6E6WWwVFSUPdrZnKMx7P_w_hh3etjoN7RrqvYHCHc,4705
|
|
54
54
|
skilleter_thingy/thingy/git.py,sha256=qXWIduF4jbP5pKFYt_hW9Ex5iL9mSBBrcNKBkULhRTg,38834
|
|
55
|
-
skilleter_thingy/thingy/git2.py,sha256=
|
|
55
|
+
skilleter_thingy/thingy/git2.py,sha256=9BOBfQs1WNmrJy5MvPbPwJME1XwyMMq_2hyFzXzPU5c,37057
|
|
56
56
|
skilleter_thingy/thingy/gitlab.py,sha256=uXAF918xnPk6qQyiwPQDbMZfqtJzhiRqDS7yEtJEIAg,6079
|
|
57
57
|
skilleter_thingy/thingy/path.py,sha256=8uM2Q9zFRWv_SaVOX49PeecQXttl7J6lsmBuRXWsXKY,4732
|
|
58
58
|
skilleter_thingy/thingy/popup.py,sha256=jW-nbpdeswqEMTli7OmBv1J8XQsvFoMI0J33O6dOeu8,2529
|
|
@@ -61,9 +61,9 @@ skilleter_thingy/thingy/run.py,sha256=6SNKWF01fSxzB10GMU9ajraXYZqAL1w0PXkqjJdr1U
|
|
|
61
61
|
skilleter_thingy/thingy/tfm_pane.py,sha256=oqy5zBzKwfbjbGqetbbhpKi4x5He7sl4qkmhUeqtdZc,19789
|
|
62
62
|
skilleter_thingy/thingy/tidy.py,sha256=71DCyj0VJrj52RmjQyj1eOiQJIfy5EIPHuThOrS6ZTA,5876
|
|
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.98.dist-info/LICENSE,sha256=ljOS4DjXvqEo5VzGfdaRwgRZPbNScGBmfwyC8PChvmQ,32422
|
|
65
|
+
skilleter_thingy-0.0.98.dist-info/METADATA,sha256=9NyNkqOkkoHBkkx7jXFZRCfKpGIjUDd-DkKJ8-E0XOE,14528
|
|
66
|
+
skilleter_thingy-0.0.98.dist-info/WHEEL,sha256=nn6H5-ilmfVryoAQl3ZQ2l8SH5imPWFpm1A5FgEuFV4,91
|
|
67
|
+
skilleter_thingy-0.0.98.dist-info/entry_points.txt,sha256=u5ymS-KPljIGTnprV5yJsAjz7qgeT2BZ-Qo_Con_PFM,2145
|
|
68
|
+
skilleter_thingy-0.0.98.dist-info/top_level.txt,sha256=8-JhgToBBiWURunmvfpSxEvNkDHQQ7r25-aBXtZv61g,17
|
|
69
|
+
skilleter_thingy-0.0.98.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|