skilleter-thingy 0.1.24__tar.gz → 0.1.25__tar.gz

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.

Files changed (74) hide show
  1. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/PKG-INFO +19 -14
  2. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/README.md +18 -13
  3. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/pyproject.toml +1 -1
  4. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/multigit.py +95 -53
  5. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy.egg-info/PKG-INFO +19 -14
  6. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/LICENSE +0 -0
  7. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/setup.cfg +0 -0
  8. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/__init__.py +0 -0
  9. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/addpath.py +0 -0
  10. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/borger.py +0 -0
  11. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/console_colours.py +0 -0
  12. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/diskspacecheck.py +0 -0
  13. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/docker_purge.py +0 -0
  14. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/ffind.py +0 -0
  15. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/ggit.py +0 -0
  16. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/ggrep.py +0 -0
  17. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/git_br.py +0 -0
  18. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/git_ca.py +0 -0
  19. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/git_cleanup.py +0 -0
  20. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/git_co.py +0 -0
  21. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/git_common.py +0 -0
  22. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/git_hold.py +0 -0
  23. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/git_mr.py +0 -0
  24. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/git_parent.py +0 -0
  25. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/git_retag.py +0 -0
  26. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/git_review.py +0 -0
  27. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/git_update.py +0 -0
  28. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/git_wt.py +0 -0
  29. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/gitcmp_helper.py +0 -0
  30. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/gitprompt.py +0 -0
  31. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/gl.py +0 -0
  32. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/linecount.py +0 -0
  33. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/localphotosync.py +0 -0
  34. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/moviemover.py +0 -0
  35. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/photodupe.py +0 -0
  36. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/phototidier.py +0 -0
  37. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/py_audit.py +0 -0
  38. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/readable.py +0 -0
  39. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/remdir.py +0 -0
  40. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/rmdupe.py +0 -0
  41. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/rpylint.py +0 -0
  42. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/splitpics.py +0 -0
  43. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/strreplace.py +0 -0
  44. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/sysmon.py +0 -0
  45. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/tfm.py +0 -0
  46. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/tfparse.py +0 -0
  47. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/thingy/__init__.py +0 -0
  48. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/thingy/colour.py +0 -0
  49. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/thingy/dc_curses.py +0 -0
  50. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/thingy/dc_defaults.py +0 -0
  51. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/thingy/dc_util.py +0 -0
  52. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/thingy/dircolors.py +0 -0
  53. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/thingy/docker.py +0 -0
  54. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/thingy/files.py +0 -0
  55. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/thingy/git.py +0 -0
  56. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/thingy/git2.py +0 -0
  57. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/thingy/gitlab.py +0 -0
  58. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/thingy/path.py +0 -0
  59. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/thingy/popup.py +0 -0
  60. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/thingy/process.py +0 -0
  61. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/thingy/run.py +0 -0
  62. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/thingy/tfm_pane.py +0 -0
  63. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/thingy/tidy.py +0 -0
  64. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/thingy/venv_template.py +0 -0
  65. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/trimpath.py +0 -0
  66. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/venv_create.py +0 -0
  67. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/window_rename.py +0 -0
  68. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/xchmod.py +0 -0
  69. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy/yamlcheck.py +0 -0
  70. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy.egg-info/SOURCES.txt +0 -0
  71. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy.egg-info/dependency_links.txt +0 -0
  72. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy.egg-info/entry_points.txt +0 -0
  73. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy.egg-info/requires.txt +0 -0
  74. {skilleter_thingy-0.1.24 → skilleter_thingy-0.1.25}/skilleter_thingy.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: skilleter_thingy
3
- Version: 0.1.24
3
+ Version: 0.1.25
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
@@ -90,7 +90,11 @@ The command takes a number of options that can be used to select the list of wor
90
90
 
91
91
  `--tag TAG` / `-t TAG` Run only in working trees that are tagged with the specified tag
92
92
 
93
- `--subdir` / `-s` Run only in working trees that are in the current directory tree.
93
+ `--sub` / `-s` Run only in working trees that are in the current directory tree.
94
+
95
+ `--continue` / `-o` Continue if a git command returns an error (by default, executation terminates when a command fails)
96
+
97
+ `--path PATH` / `-C PATH` Run as if the command was started in PATH instead of the current working directory
94
98
 
95
99
  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`.
96
100
 
@@ -106,6 +110,8 @@ Multigit supports a small list of subcommands, each of which are prefixed with a
106
110
 
107
111
  `+dir NAME` - Given the name of a working tree, output relative path(s) to one or more matching working trees. If `NAME` does NOT contains wildcard characters (`*` or `?`) then matching takes place as if `*` were prefixed and appended to it, otherwise, the wildcards are used as specified. If `NAME` is not specified then the location of the directory where the multigit configuration file resides is output.
108
112
 
113
+ `+list` - Return a list of the top level directories of each of the Git repos
114
+
109
115
  `+config` - Print the name and location of the multigit configuration file.
110
116
 
111
117
  `+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.
@@ -179,10 +185,10 @@ Note that the concept of the default branch `DEFAULT` mentioned above *only* app
179
185
  Improved version of 'git commit --amend'. Updates files that are already in the commit and, optionally, adds and commits additional files.
180
186
 
181
187
  usage: git-ca [-h] [--added] [--all] [--everything] [--ignored] [--patch] [--verbose] [--dry-run] [files ...]
182
-
188
+
183
189
  positional arguments:
184
190
  files List of files to add to the commit
185
-
191
+
186
192
  options:
187
193
  -h, --help show this help message and exit
188
194
  --added, -A Update files in the current commit, including files added with `git add`
@@ -198,11 +204,11 @@ Improved version of 'git commit --amend'. Updates files that are already in the
198
204
  List or delete branches that have already been merged and delete tracking branches that are no longer on the remote.
199
205
 
200
206
  git-cleanup [-h] [--delete] [--master MASTER] [--force] [--unmerged] [--yes] [--debug] [branches ...]
201
-
207
+
202
208
  positional arguments:
203
-
209
+
204
210
  branches List of branches to check (default is all branches)
205
-
211
+
206
212
  options:
207
213
  -h, --help show this help message and exit
208
214
  --delete, -d Delete all branches that have been merged
@@ -218,11 +224,11 @@ List or delete branches that have already been merged and delete tracking branch
218
224
  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.
219
225
 
220
226
  git-co [-h] [--branch] [--update] [--rebase] [--force] [--exact] [--debug] branchname
221
-
227
+
222
228
  positional arguments:
223
-
229
+
224
230
  branchname The branch name (or a partial name that matches uniquely against a local branch, remote branch, commit ID or tag)
225
-
231
+
226
232
  options:
227
233
  -h, --help show this help message and exit
228
234
  --branch, -b Create the specified branch
@@ -237,12 +243,12 @@ Equivalent to `git checkout` but with enhanced branch matching as described abov
237
243
  Attempt to determine the parent branch for the specified branch (defaulting to the current one).
238
244
 
239
245
  git-parent [-h] [--all] [--verbose] [branch]
240
-
246
+
241
247
  Attempt to determine the parent branch for the specified branch (defaulting to the current one)
242
-
248
+
243
249
  positional arguments:
244
250
  branch Branch, commit or commit (defaults to current branch; main)
245
-
251
+
246
252
  options:
247
253
  -h, --help show this help message and exit
248
254
  --all, -a Include feature branches as possible parents
@@ -324,7 +330,6 @@ Add or remove entries from a path list (e.g. as used by the PATH environment var
324
330
  --separator SEPARATOR
325
331
  Override the default path separator
326
332
 
327
-
328
333
  ## docker-purge
329
334
 
330
335
  Stop or kill docker instances and/or remove docker images.
@@ -67,7 +67,11 @@ The command takes a number of options that can be used to select the list of wor
67
67
 
68
68
  `--tag TAG` / `-t TAG` Run only in working trees that are tagged with the specified tag
69
69
 
70
- `--subdir` / `-s` Run only in working trees that are in the current directory tree.
70
+ `--sub` / `-s` Run only in working trees that are in the current directory tree.
71
+
72
+ `--continue` / `-o` Continue if a git command returns an error (by default, executation terminates when a command fails)
73
+
74
+ `--path PATH` / `-C PATH` Run as if the command was started in PATH instead of the current working directory
71
75
 
72
76
  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`.
73
77
 
@@ -83,6 +87,8 @@ Multigit supports a small list of subcommands, each of which are prefixed with a
83
87
 
84
88
  `+dir NAME` - Given the name of a working tree, output relative path(s) to one or more matching working trees. If `NAME` does NOT contains wildcard characters (`*` or `?`) then matching takes place as if `*` were prefixed and appended to it, otherwise, the wildcards are used as specified. If `NAME` is not specified then the location of the directory where the multigit configuration file resides is output.
85
89
 
90
+ `+list` - Return a list of the top level directories of each of the Git repos
91
+
86
92
  `+config` - Print the name and location of the multigit configuration file.
87
93
 
88
94
  `+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.
@@ -156,10 +162,10 @@ Note that the concept of the default branch `DEFAULT` mentioned above *only* app
156
162
  Improved version of 'git commit --amend'. Updates files that are already in the commit and, optionally, adds and commits additional files.
157
163
 
158
164
  usage: git-ca [-h] [--added] [--all] [--everything] [--ignored] [--patch] [--verbose] [--dry-run] [files ...]
159
-
165
+
160
166
  positional arguments:
161
167
  files List of files to add to the commit
162
-
168
+
163
169
  options:
164
170
  -h, --help show this help message and exit
165
171
  --added, -A Update files in the current commit, including files added with `git add`
@@ -175,11 +181,11 @@ Improved version of 'git commit --amend'. Updates files that are already in the
175
181
  List or delete branches that have already been merged and delete tracking branches that are no longer on the remote.
176
182
 
177
183
  git-cleanup [-h] [--delete] [--master MASTER] [--force] [--unmerged] [--yes] [--debug] [branches ...]
178
-
184
+
179
185
  positional arguments:
180
-
186
+
181
187
  branches List of branches to check (default is all branches)
182
-
188
+
183
189
  options:
184
190
  -h, --help show this help message and exit
185
191
  --delete, -d Delete all branches that have been merged
@@ -195,11 +201,11 @@ List or delete branches that have already been merged and delete tracking branch
195
201
  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.
196
202
 
197
203
  git-co [-h] [--branch] [--update] [--rebase] [--force] [--exact] [--debug] branchname
198
-
204
+
199
205
  positional arguments:
200
-
206
+
201
207
  branchname The branch name (or a partial name that matches uniquely against a local branch, remote branch, commit ID or tag)
202
-
208
+
203
209
  options:
204
210
  -h, --help show this help message and exit
205
211
  --branch, -b Create the specified branch
@@ -214,12 +220,12 @@ Equivalent to `git checkout` but with enhanced branch matching as described abov
214
220
  Attempt to determine the parent branch for the specified branch (defaulting to the current one).
215
221
 
216
222
  git-parent [-h] [--all] [--verbose] [branch]
217
-
223
+
218
224
  Attempt to determine the parent branch for the specified branch (defaulting to the current one)
219
-
225
+
220
226
  positional arguments:
221
227
  branch Branch, commit or commit (defaults to current branch; main)
222
-
228
+
223
229
  options:
224
230
  -h, --help show this help message and exit
225
231
  --all, -a Include feature branches as possible parents
@@ -301,7 +307,6 @@ Add or remove entries from a path list (e.g. as used by the PATH environment var
301
307
  --separator SEPARATOR
302
308
  Override the default path separator
303
309
 
304
-
305
310
  ## docker-purge
306
311
 
307
312
  Stop or kill docker instances and/or remove docker images.
@@ -7,7 +7,7 @@ name = "skilleter_thingy"
7
7
 
8
8
  # Version must be incremented to install updated Thingy
9
9
 
10
- version = "0.1.24"
10
+ version = "0.1.25"
11
11
 
12
12
  authors = [
13
13
  {name="John Skilleter", email="john@skilleter.org.uk"},
@@ -13,7 +13,8 @@ import thingy.git2 as git
13
13
  import thingy.colour as colour
14
14
 
15
15
  ################################################################################
16
-
16
+ # TODO List:
17
+ #
17
18
  # DONE: ***MUST use relative paths in config file, or we can't store in git and clone and use somewhere else!***
18
19
  # DONE: / Output name of each working tree as it is processed as command sits there seeming to do nothing otherwise.
19
20
  # DONE: Better error-handling - e.g. continue/abort option after failure in one working tree
@@ -25,11 +26,17 @@ import thingy.colour as colour
25
26
  # DONE: When specifying list of working trees, if name doesn't contain '/' prefix it with '*'?
26
27
  # 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
27
28
  # DONE: init function
29
+ # DONE Consistent colours in output
30
+ #
28
31
  # NOPE: Clone to have option to update - as discussed, should be part of init
29
32
  # NOPE: Dry-run option - just pass the option to the Git command
30
33
  # NOPE: Is it going to be a problem if the same repo is checked out twice or more in the same workspace - user problem
31
- # NOPE: Pull/fetch - only output after running command and only if something updated
34
+ # NOPE: Pull/fetch - only output after running command and only if something updated - nope, git commands should run as-is without interference
32
35
  # NOPE: Switch to tomlkit
36
+ # NOPE: Use PathLib - Don't really see the need
37
+ # NOPE: When we have something with multiple matches display a menu for user to select the one that they one - make it a library routine so can be used, for instance, for branch selection - Use fzf
38
+ # NOPE: Use pygit2 directly - don't see the need
39
+ #
33
40
  # TODO: 2 .init option '--update' to update the configuration file with new working trees and remove ones that are no longer there
34
41
  # TODO: 2. +run command to do things other than git commands
35
42
  # TODO: 2. 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)
@@ -39,13 +46,12 @@ import thingy.colour as colour
39
46
  # TODO: 3. Command that takes partial working tree name and either returns full path or pops up window to autocomplete until single match found
40
47
  # TODO: 3. Verbose option
41
48
  # TODO: 3. When filtering by tag or by repo name, if name starts with '!' only match if tag isn't present or repo name doesn't match (and don't allow '!' at start of tag otherwise)
49
+ # TODO: 3. (alternative to above) A '--not' option that inverts all the matching criteria, so '--not --branched --modified' selects all unmodified repos which aren't branched
50
+ # TODO: 3. (alternative to both above) Additional options; --!modified --!branched --!tag which act as the inverse of each option, so --!branched selects all unbranched repos.
51
+ # TODO: 3. (another alternative) - Use 'not-' instead of '!', so have --not-branched, --not-modified, --not-tag (single-letter options -B, -M, -T).
42
52
  # TODO: 4. Option to +dir to return all matches so that caller can select one they want
43
53
  # TODO: 4. Shell autocomplete for +dir
44
54
  # TODO: 5. -j option to run in parallel - yes, but it will only work with non-interactive Git commands
45
- # TODO: 5. Consistent colours in output
46
- # TODO: 6. Use PathLib
47
- # TODO: 6. When we have something with multiple matches display a menu for user to select the one that they one - make it a library routine so can be used, for instance, for branch selection
48
- # TODO: 7. Use pygit2 directly
49
55
  ################################################################################
50
56
 
51
57
  DEFAULT_CONFIG_FILE = 'multigit.toml'
@@ -59,8 +65,8 @@ DEFAULT_BRANCH = 'DEFAULT'
59
65
  # Command line help - we aren't using argparse since it isn't flexible enough to handle arbtirary git
60
66
  # commands are parameters so we have to manually create the help and parse the command line
61
67
 
62
- HELP_INFO = """usage: multigit [-h] [--verbose] [--quiet] [--config CONFIG] [--repos REPOS] [--modified] [--branched] [--sub] [--tag TAGS]
63
- {+clone, +init, +config, +dir, GIT_COMMAND} ...
68
+ 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} ...
64
70
 
65
71
  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
66
72
 
@@ -76,14 +82,16 @@ options:
76
82
  --branched, -b Select repos that do not have the default branch checked out
77
83
  --tag TAG, -t TAG Select repos that have the specified tag (can be issued multiple times on the command line)
78
84
  --sub, -s Select only the repos in the current directory and subdirectories
79
- --continue, -C Continue if a git command returns an error (by default, executation terminates when a command fails)
85
+ --continue, -o Continue if a git command returns an error (by default, executation terminates when a command fails)
86
+ --path, -C PATH Run as if the command was started in PATH instead of the current working directory
80
87
 
81
88
  Sub-commands:
82
- {+clone, +init,+dir,+config, GIT_COMMAND}
89
+ {+clone, +init, +dir, +config, +list, GIT_COMMAND}
83
90
  +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
84
91
  +init Build or update the configuration file using the current branch in each repo as the default branch
85
92
  +config Return the name and location of the configuration file
86
93
  +dir Return the location of a working tree, given the repo name, or if no parameter specified, the root directory of the multigit tree
94
+ +list Return a list of the top level directories of each of the Git repos
87
95
  +tag TAG Apply a configuration tag to repos filtered by the command line options (list configuration tags if no parameter specified)
88
96
  +untag TAG Remove a configuration tag to repos filtered by the command line options
89
97
  GIT_COMMAND Any git command, including options and parameters - this is then run in all specified working trees
@@ -310,10 +318,10 @@ def mg_clone(args, config, console):
310
318
  # Sanity checks
311
319
 
312
320
  if not args.parameters:
313
- colour.error('The "clone" subcommand takes 1 or 2 parameters - the repo to clone and, optionally, the branch to check out', prefix=True)
321
+ colour.error('The "[BOLD:clone]" subcommand takes 1 or 2 parameters - the repo to clone and, optionally, the branch to check out', prefix=True)
314
322
 
315
323
  if args.branched or args.modified:
316
- colour.error('The "modified" and "branched" options cannot be used with the "clone" subcommand', prefix=True)
324
+ colour.error('The "[BOLD:modified]" and "[BOLD:branched]" options cannot be used with the "[BOLD:clone]" subcommand', prefix=True)
317
325
 
318
326
  # Destination directory is the last portion of the repo URL with the extension removed
319
327
 
@@ -345,7 +353,7 @@ def mg_clone(args, config, console):
345
353
  args.configuration_file = args.default_configuration_file
346
354
 
347
355
  if not os.path.isfile(args.configuration_file):
348
- colour.error(f'Cannot find the configuration file: [BOLD:{args.default_configuration_file}]', prefix=True)
356
+ colour.error(f'Cannot find the configuration file: [BLUE:{args.default_configuration_file}]', prefix=True)
349
357
 
350
358
  config.read(args.configuration_file)
351
359
 
@@ -360,7 +368,7 @@ def mg_clone(args, config, console):
360
368
  os.makedirs(directory, exist_ok=True)
361
369
 
362
370
  if not args.quiet:
363
- colour.write(f'Cloning [BOLD:{repo["origin"]}] into [BLUE:{directory}]')
371
+ colour.write(f'Cloning [BLUE:{repo["origin"]}] into [BLUE:{directory}]')
364
372
 
365
373
  git.clone(repo['origin'], path=repo.name)
366
374
 
@@ -379,7 +387,7 @@ def mg_init(args, config, console):
379
387
  # Sanity checks
380
388
 
381
389
  if args.modified or args.branched or args.tag or args.subdirectories:
382
- colour.error('The "--tag", "--modified" "--sub", and "--branched" options cannot be used with the "init" subcommand', prefix=True)
390
+ colour.error('The "[BOLD:--tag]", "[BOLD:--modified]" "[BOLD:--sub]", and "[BOLD:--branched]" options cannot be used with the "[BOLD:init]" subcommand', prefix=True)
383
391
 
384
392
  # Search for .git directories and add any that aren't already in the configuration
385
393
 
@@ -413,7 +421,7 @@ def mg_init(args, config, console):
413
421
  else:
414
422
  config[repo]['repo name'] = os.path.basename(repo)
415
423
 
416
- colour.write(f'Added [BOLD:{repo}] with default branch [BLUE:{default_branch}]')
424
+ colour.write(f'Added [BLUE:{repo}] with default branch [BLUE:{default_branch}]')
417
425
 
418
426
  if not args.quiet:
419
427
  colour.write(cleareol=True)
@@ -428,7 +436,7 @@ def mg_init(args, config, console):
428
436
 
429
437
  for entry in removals:
430
438
  del config[entry]
431
- colour.write(f'Removed [BOLD:{repo}] as it no longer exists')
439
+ colour.write(f'Removed [BLUE:{repo}] as it no longer exists')
432
440
 
433
441
  # The configuration file needs to be updated
434
442
 
@@ -447,12 +455,12 @@ def mg_dir(args, config, console):
447
455
  verbose(args, f'dir: Parameters: {", ".join(args.parameters)}')
448
456
 
449
457
  if len(args.parameters) > 1:
450
- colour.error('The +dir command takes no more than one parameter - the name of the working tree to search for', prefix=True)
458
+ colour.error('The "[BOLD:+dir]" command takes no more than one parameter - the name of the working tree to search for', prefix=True)
451
459
 
452
460
  # TODO: mg_dir _should_ use these options
453
461
 
454
462
  if args.modified or args.branched or args.tag or args.subdirectories:
455
- colour.error('The "--tag", "--modified" "--sub", and "--branched" options cannot be used with the "dir" subcommand', prefix=True)
463
+ colour.error('The "[BOLD:--tag]", "[BOLD:--modified]" "[BOLD:--sub]", and "[BOLD:--branched]" options cannot be used with the "[BOLD:+dir]" subcommand', prefix=True)
456
464
 
457
465
  # If a parameter is specified, look for matches, otherwise just return the location of the
458
466
  # configuration file
@@ -501,7 +509,7 @@ def mg_tag(args, config, console):
501
509
  _ = console
502
510
 
503
511
  if len(args.parameters) > 1:
504
- colour.error('The +tag command takes no more than one parameter', prefix=True)
512
+ colour.error('The "[BOLD:+tag]" command takes no more than one parameter', prefix=True)
505
513
 
506
514
  for repo in select_git_repos(args, config):
507
515
  try:
@@ -515,7 +523,7 @@ def mg_tag(args, config, console):
515
523
  repo['tags'] = ','.join(tags)
516
524
  args.config_modified = True
517
525
  elif tags:
518
- colour.write(f'[BOLD:{repo["repo name"]}] - {", ".join(tags)}')
526
+ colour.write(f'[BLUE:{repo["repo name"]}] - {", ".join(tags)}')
519
527
 
520
528
  ################################################################################
521
529
 
@@ -525,7 +533,7 @@ def mg_untag(args, config, console):
525
533
  _ = console
526
534
 
527
535
  if len(args.parameters) > 1:
528
- colour.error('The +tag command takes no more than one parameter', prefix=True)
536
+ colour.error('The "[BOLD:+tag]" command takes no more than one parameter', prefix=True)
529
537
 
530
538
  for repo in select_git_repos(args, config):
531
539
  try:
@@ -547,12 +555,22 @@ def mg_config(args, config, console):
547
555
  _ = console
548
556
 
549
557
  if len(args.parameters):
550
- colour.error('The +config command does not take parameters', prefix=True)
558
+ colour.error('The "[BOLD:+config]" command does not take parameters', prefix=True)
551
559
 
552
560
  colour.write(os.path.relpath(args.configuration_file))
553
561
 
554
562
  ################################################################################
555
563
 
564
+ def mg_list(args, config, console):
565
+ """List the top-level directories of the Git repos in the configuration"""
566
+
567
+ _ = console
568
+
569
+ for repo in select_git_repos(args, config):
570
+ print(repo.name)
571
+
572
+ ################################################################################
573
+
556
574
  def run_git_command(args, config, console):
557
575
  """Run a command in each of the working trees, optionally continuing if
558
576
  there's an error"""
@@ -567,7 +585,7 @@ def run_git_command(args, config, console):
567
585
  for cmd in args.parameters:
568
586
  repo_command.append(branch_name(cmd, repo['default branch']))
569
587
 
570
- colour.write(f'\n[BOLD:{os.path.relpath(repo.name)}]\n')
588
+ colour.write(f'\n[BLUE:{os.path.relpath(repo.name)}]\n')
571
589
 
572
590
  # Run the command in the workng tree
573
591
 
@@ -590,67 +608,90 @@ def parse_command_line():
590
608
 
591
609
  arg_list = sys.argv[1:]
592
610
 
611
+ # Iterate through each lump of options (e.g. '-xyz' is a lump of 3 options and
612
+ # '--config' is a lump containing a single option, as is just '-x')
613
+
593
614
  while arg_list and arg_list[0].startswith('-'):
594
615
  # Split a parameter into a list, so --x becomes [x] but -xyz becomes [x, y, z]
616
+ # Note that this means that an option with a parameter must always have a space
617
+ # between the option and the parameter (e.g. '-C path' not '-Cpath'
618
+ # Also note that we don't support '--option=VALUE' - it must be '--option VALUE'
595
619
 
596
620
  arg_entry = arg_list.pop(0)
597
621
  if arg_entry.startswith('--'):
598
- params = [arg_entry[2:]]
622
+ option_list = [arg_entry[2:]]
599
623
  else:
600
- params = list(arg_entry[1:])
624
+ option_list = list(arg_entry[1:])
625
+
626
+ # Process each option in the current option lump.
627
+ # For short options that take a parameter (e.g. '-C PATH') we check that the option list
628
+ # is empty as '-Cx PATH' expands to '-C', '-x PATH', not '-C PATH', '-x'
601
629
 
602
- while params:
603
- param = params.pop(0)
630
+ while option_list:
631
+ option = option_list.pop(0)
604
632
 
605
- if param in ('verbose', 'v'):
633
+ if option in ('verbose', 'v'):
606
634
  args.verbose = True
607
635
 
608
- elif param in ('quiet', 'q'):
636
+ elif option in ('quiet', 'q'):
609
637
  args.quiet = True
610
638
 
611
- elif param in ('config', 'c'):
612
- if params:
613
- colour.error('--config - missing configuration file parameter', prefix=True)
614
- else:
615
- try:
616
- args.default_configuration_file = arg_list.pop(0)
617
- except IndexError:
618
- colour.error('--config - missing configuration file parameter', prefix=True)
619
-
620
- elif param in ('repos', 'r'):
621
- if params:
622
- colour.error('--repos - missing repo parameter', prefix=True)
639
+ elif option in ('config', 'c'):
640
+ if option_list:
641
+ colour.error('The "[BLUE:--config]" option takes a configuration file parameter', prefix=True)
642
+
643
+ try:
644
+ args.default_configuration_file = arg_list.pop(0)
645
+ except IndexError:
646
+ colour.error('"The [BLUE:--config]" option takes a configuration file parameter', prefix=True)
647
+
648
+ elif option in ('repos', 'r'):
649
+ if option_list:
650
+ colour.error('The "[BLUE:--repos]" option takes a repo parameter', prefix=True)
651
+
623
652
  try:
624
653
  args.repos.append(arg_list.pop(0))
625
654
  except IndexError:
626
- colour.error('--repos - missing repo parameter', prefix=True)
655
+ colour.error('The "[BLUE:--repos]" option takes a repo parameter', prefix=True)
656
+
657
+ elif option in ('tag', 't'):
658
+ if option_list:
659
+ colour.error('The "[BLUE:--tag]" option takes a tag parameter', prefix=True)
627
660
 
628
- elif param in ('tag', 't'):
629
- if params:
630
- colour.error('--tag - missing tag parameter', prefix=True)
631
661
  try:
632
662
  args.tag.append(arg_list.pop(0))
633
663
  except IndexError:
634
- colour.error('--tag - missing tag parameter', prefix=True)
664
+ colour.error('The "[BLUE:--tag]" option takes a tag parameter', prefix=True)
635
665
 
636
- elif param in ('modified', 'm'):
666
+ elif option in ('modified', 'm'):
637
667
  args.modified = True
638
668
 
639
- elif param in ('branched', 'b'):
669
+ elif option in ('branched', 'b'):
640
670
  args.branched = True
641
671
 
642
- elif param in ('sub', 's'):
672
+ elif option in ('sub', 's'):
643
673
  args.subdirectories = True
644
674
 
645
- elif param in ('continue', 'C'):
675
+ elif option in ('continue', 'o'):
646
676
  args.error_continue = True
647
677
 
648
- elif param in ('help', 'h'):
678
+ elif option in ('path', 'C'):
679
+ if option_list:
680
+ colour.error('The "[BOLD:--path]" option takes a path parameter')
681
+
682
+ try:
683
+ os.chdir(arg_list.pop(0))
684
+ except IndexError:
685
+ colour.error('The "[BOLD:-C]" option takes a path parameter', prefix=True)
686
+ except FileNotFoundError:
687
+ colour.error('"[BOLD:--path]" - path not found', prefix=True)
688
+
689
+ elif option in ('help', 'h'):
649
690
  colour.write(HELP_INFO)
650
691
  sys.exit(0)
651
692
 
652
693
  else:
653
- colour.error(f'Invalid option: "{param}"', prefix=True)
694
+ colour.error(f'Invalid option: "[BOLD:{option}]"', prefix=True)
654
695
 
655
696
  # After the options, we either have a multigit command (prefixed with '+') or a git command
656
697
  # followed by parameter
@@ -687,6 +728,7 @@ COMMANDS = {
687
728
  'config': mg_config,
688
729
  'tag': mg_tag,
689
730
  'untag': mg_untag,
731
+ 'list': mg_list,
690
732
  }
691
733
 
692
734
  def main():
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: skilleter_thingy
3
- Version: 0.1.24
3
+ Version: 0.1.25
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
@@ -90,7 +90,11 @@ The command takes a number of options that can be used to select the list of wor
90
90
 
91
91
  `--tag TAG` / `-t TAG` Run only in working trees that are tagged with the specified tag
92
92
 
93
- `--subdir` / `-s` Run only in working trees that are in the current directory tree.
93
+ `--sub` / `-s` Run only in working trees that are in the current directory tree.
94
+
95
+ `--continue` / `-o` Continue if a git command returns an error (by default, executation terminates when a command fails)
96
+
97
+ `--path PATH` / `-C PATH` Run as if the command was started in PATH instead of the current working directory
94
98
 
95
99
  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`.
96
100
 
@@ -106,6 +110,8 @@ Multigit supports a small list of subcommands, each of which are prefixed with a
106
110
 
107
111
  `+dir NAME` - Given the name of a working tree, output relative path(s) to one or more matching working trees. If `NAME` does NOT contains wildcard characters (`*` or `?`) then matching takes place as if `*` were prefixed and appended to it, otherwise, the wildcards are used as specified. If `NAME` is not specified then the location of the directory where the multigit configuration file resides is output.
108
112
 
113
+ `+list` - Return a list of the top level directories of each of the Git repos
114
+
109
115
  `+config` - Print the name and location of the multigit configuration file.
110
116
 
111
117
  `+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.
@@ -179,10 +185,10 @@ Note that the concept of the default branch `DEFAULT` mentioned above *only* app
179
185
  Improved version of 'git commit --amend'. Updates files that are already in the commit and, optionally, adds and commits additional files.
180
186
 
181
187
  usage: git-ca [-h] [--added] [--all] [--everything] [--ignored] [--patch] [--verbose] [--dry-run] [files ...]
182
-
188
+
183
189
  positional arguments:
184
190
  files List of files to add to the commit
185
-
191
+
186
192
  options:
187
193
  -h, --help show this help message and exit
188
194
  --added, -A Update files in the current commit, including files added with `git add`
@@ -198,11 +204,11 @@ Improved version of 'git commit --amend'. Updates files that are already in the
198
204
  List or delete branches that have already been merged and delete tracking branches that are no longer on the remote.
199
205
 
200
206
  git-cleanup [-h] [--delete] [--master MASTER] [--force] [--unmerged] [--yes] [--debug] [branches ...]
201
-
207
+
202
208
  positional arguments:
203
-
209
+
204
210
  branches List of branches to check (default is all branches)
205
-
211
+
206
212
  options:
207
213
  -h, --help show this help message and exit
208
214
  --delete, -d Delete all branches that have been merged
@@ -218,11 +224,11 @@ List or delete branches that have already been merged and delete tracking branch
218
224
  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.
219
225
 
220
226
  git-co [-h] [--branch] [--update] [--rebase] [--force] [--exact] [--debug] branchname
221
-
227
+
222
228
  positional arguments:
223
-
229
+
224
230
  branchname The branch name (or a partial name that matches uniquely against a local branch, remote branch, commit ID or tag)
225
-
231
+
226
232
  options:
227
233
  -h, --help show this help message and exit
228
234
  --branch, -b Create the specified branch
@@ -237,12 +243,12 @@ Equivalent to `git checkout` but with enhanced branch matching as described abov
237
243
  Attempt to determine the parent branch for the specified branch (defaulting to the current one).
238
244
 
239
245
  git-parent [-h] [--all] [--verbose] [branch]
240
-
246
+
241
247
  Attempt to determine the parent branch for the specified branch (defaulting to the current one)
242
-
248
+
243
249
  positional arguments:
244
250
  branch Branch, commit or commit (defaults to current branch; main)
245
-
251
+
246
252
  options:
247
253
  -h, --help show this help message and exit
248
254
  --all, -a Include feature branches as possible parents
@@ -324,7 +330,6 @@ Add or remove entries from a path list (e.g. as used by the PATH environment var
324
330
  --separator SEPARATOR
325
331
  Override the default path separator
326
332
 
327
-
328
333
  ## docker-purge
329
334
 
330
335
  Stop or kill docker instances and/or remove docker images.