skilleter-thingy 0.2.15__py3-none-any.whl → 0.3.1__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.

@@ -298,8 +298,10 @@ def main():
298
298
  if not deleted_file or not skip_deleted:
299
299
  try:
300
300
  subprocess.run([difftool, args.old_file, args.new_file], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, check=True)
301
+
301
302
  except subprocess.CalledProcessError as exc:
302
303
  print(f'WARNING: Diff failed - status = {exc.returncode}')
304
+
303
305
  except FileNotFoundError:
304
306
  print(f'ERROR: Unable to locate diff tool {difftool}')
305
307
  sys.exit(1)
@@ -646,16 +646,18 @@ def mg_run(args, config, console):
646
646
  repo_path = absolute_repo_path(args, repo.name)
647
647
 
648
648
  try:
649
- status = subprocess.run(args.parameters, cwd=repo_path, check=False)
649
+ status = subprocess.run(args.parameters, cwd=repo_path, check=True)
650
+
650
651
  except FileNotFoundError:
651
652
  err_msg = f'"[BLUE:{args.parameters[0]}]" - Command not found'
652
653
  if args.error_continue:
653
654
  colour.write(f'[RED:WARNING]: {err_msg}')
654
655
  else:
655
656
  colour.error(f'[RED:ERROR]: {err_msg}')
656
- else:
657
- if status.returncode and not args.error_continue:
658
- sys.exit(status)
657
+
658
+ except subprocess.CalledProcessError as exc:
659
+ if not args.error_continue:
660
+ sys.exit(exc.returncode)
659
661
 
660
662
  ################################################################################
661
663
 
@@ -100,11 +100,12 @@ def main():
100
100
  f' && python3 -m pip {PIP_OPTIONS} list | tail -n+3 | tee {package_list.name}' \
101
101
  ' && deactivate'
102
102
 
103
- result = subprocess.run(script, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)
103
+ try:
104
+ subprocess.run(script, check=True, shell=True)
104
105
 
105
- if result.returncode:
106
- print(f'ERROR #{result.returncode}: {result.stdout}')
107
- sys.exit(result.returncode)
106
+ except subprocess.CalledProcessError as exc:
107
+ print(f'ERROR #{exc.returncode}: {exc.stdout}')
108
+ sys.exit(exc.returncode)
108
109
 
109
110
  with open(package_list.name) as infile:
110
111
  for package in infile.readlines():
@@ -85,7 +85,7 @@ def git(cmd, stdout=None, stderr=None, path=None):
85
85
  ################################################################################
86
86
 
87
87
  def git_run_status(cmd, stdout=None, stderr=None, path=None, redirect=True):
88
- """ Wrapper for run.run that returns the output and status, and
88
+ """ Wrapper for subprocess.run that returns the output and status, and
89
89
  does not raise an exception on error.
90
90
  Optionally redirect stdout and stderr as specified. """
91
91
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: skilleter_thingy
3
- Version: 0.2.15
3
+ Version: 0.3.1
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
@@ -52,7 +52,7 @@ For ease of use it is recommended that you create an alias for multigit called `
52
52
 
53
53
  alias mg="multigit $@"
54
54
 
55
- ## Initialisation
55
+ ### Initialisation
56
56
 
57
57
  To use multigit, start by creating working trees for the repositories that you want to use in a directory tree - the working trees can be at different levels or even nested, for example:
58
58
 
@@ -70,7 +70,7 @@ To use multigit, start by creating working trees for the repositories that you w
70
70
 
71
71
  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, tags and location.
72
72
 
73
- ## Multigit Command Line
73
+ ### Multigit Command Line
74
74
 
75
75
  The multigit command line format is:
76
76
 
@@ -100,7 +100,7 @@ These options are AND-ed together, so specifying `--modified --branched --tag WO
100
100
 
101
101
  Multigit tags are stored in the configuration file, not within the working tree and each working tree can have multiple tags.
102
102
 
103
- ## Multigit Commands
103
+ ### Multigit Commands
104
104
 
105
105
  Multigit supports a small list of subcommands, each of which are prefixed with a `+` to distinguish them from Git commands:
106
106
 
@@ -184,6 +184,21 @@ This is most useful where branches contain ticket numbers so, for instance given
184
184
 
185
185
  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).
186
186
 
187
+ ## git br
188
+
189
+ List or delete branches that have been merged
190
+
191
+ usage: git-br [-h] [--all] [--delete] [--path PATH] [branches ...]
192
+
193
+ positional arguments:
194
+ branches Filter the list of branches according to one or more patterns
195
+
196
+ options:
197
+ -h, --help show this help message and exit
198
+ --all, -a List all branches, including remotes
199
+ --delete, -d Delete the specified branch(es), even if it is the current one (list of branches to delete must be supplied as parameters)
200
+ --path PATH, -C PATH Run the command in the specified directory
201
+
187
202
  ## git ca
188
203
 
189
204
  Improved version of 'git commit --amend'. Updates files that are already in the commit and, optionally, adds and commits additional files.
@@ -242,6 +257,37 @@ Equivalent to `git checkout` but with enhanced branch matching as described abov
242
257
  --exact, -e Do not use branch name matching - check out the branch as specified (if it exists)
243
258
  --debug Enable debug output
244
259
 
260
+ ## git common
261
+
262
+ Find the most recent common ancestor for two commits
263
+
264
+ usage: git-common [-h] [--short] [--long] [--path PATH] [commit1] [commit2]
265
+
266
+ positional arguments:
267
+ commit1 First commit (default=HEAD)
268
+ commit2 Second commit (default=master)
269
+
270
+ options:
271
+ -h, --help show this help message and exit
272
+ --short, -s Just output the ancestor commit ID
273
+ --long, -l Output the log entry for the commit
274
+ --path PATH, -C PATH Run the command in the specified directory
275
+
276
+ ## git hold
277
+
278
+ Archive, list or recover one or more Git branches
279
+
280
+ usage: git-hold [-h] [--list] [--restore] [--path PATH] [branches ...]
281
+
282
+ positional arguments:
283
+ branches Branches
284
+
285
+ options:
286
+ -h, --help show this help message and exit
287
+ --list, -l List archived branches
288
+ --restore, -r Restore archived branches
289
+ --path PATH, -C PATH Run the command in the specified directory
290
+
245
291
  ## git parent
246
292
 
247
293
  Attempt to determine the parent branch for the specified branch (defaulting to the current one).
@@ -258,6 +304,21 @@ Attempt to determine the parent branch for the specified branch (defaulting to t
258
304
  --all, -a Include feature branches as possible parents
259
305
  --verbose, -v Report verbose results (includes number of commits between branch and parent)
260
306
 
307
+ ## git retag
308
+
309
+ Apply or update a tag, optionally updating it on the remote as well. If the specified tag exists, it is deleted
310
+ and re-applied, otherwise it is recreated.
311
+
312
+ usage: git-retag [-h] [--push] [--path PATH] tag
313
+
314
+ positional arguments:
315
+ tag The tag
316
+
317
+ options:
318
+ -h, --help show this help message and exit
319
+ --push, -p Push the tag to the remote
320
+ --path PATH, -C PATH Run the command in the specified directory
321
+
261
322
  ## git update
262
323
 
263
324
  Update the rworking tree from the remote, rebase local branch(es) against their parents and optionally run git cleanup.
@@ -313,6 +374,14 @@ Menu-driven Git code review tool
313
374
  --dir DIR Work in the specified directory
314
375
  --difftool DIFFTOOL Override the default git diff tool
315
376
 
377
+ ## ggit
378
+
379
+ Run a git command in all working trees under the current directory (somewhat superceded by multigit).
380
+
381
+ ## ggrep
382
+
383
+ Run 'git grep' in all repos under the current directory (somewhat superceded by multigit).
384
+
316
385
  # General Commands
317
386
 
318
387
  ## addpath
@@ -334,23 +403,9 @@ Add or remove entries from a path list (e.g. as used by the PATH environment var
334
403
  --separator SEPARATOR
335
404
  Override the default path separator
336
405
 
337
- ## docker-purge
338
-
339
- Stop or kill docker instances and/or remove docker images.
340
-
341
- docker-purge [-h] [--stop] [--kill] [--remove] [--list] [--force] [--debug] [images ...]
342
-
343
- positional arguments:
344
- images List of Docker containers (regular expression)
406
+ ## consolecolours
345
407
 
346
- options:
347
- -h, --help show this help message and exit
348
- --stop, -s Stop Docker instances
349
- --kill, -k Kill Docker instances
350
- --remove, -r Remove Docker images
351
- --list, -l List what would be done without doing it
352
- --force, -f Forcibly kill/remove instances
353
- --debug Enable debug output
408
+ Display all available colours in the console.
354
409
 
355
410
  ## ffind
356
411
 
@@ -470,24 +525,6 @@ Recursively delete empty directories
470
525
  Files to ignore when considering whether a directory is empty
471
526
  --keep KEEP, -K KEEP Directories that should be kept even if they are empty
472
527
 
473
- ## rmdupe
474
-
475
- Search for duplicate files.
476
-
477
- rmdupe [-h] [--debug] [--save SAVE] [--load LOAD] [--script SCRIPT] [--exclude EXCLUDE] [--ignore IGNORE] [path]
478
-
479
- positional arguments:
480
- path Path(s) to search for duplicates
481
-
482
- options:
483
- -h, --help show this help message and exit
484
- --debug Debug output
485
- --save SAVE Save duplicate file list
486
- --load LOAD Load duplicate file list
487
- --script SCRIPT Generate a shell script to delete the duplicates
488
- --exclude EXCLUDE Directories to skip when looking for duplicates
489
- --ignore IGNORE Wildcards to ignore when looking for duplicates
490
-
491
528
  ## rpylint
492
529
 
493
530
  Run pylint on all the Python source files in a directory tree
@@ -500,10 +537,6 @@ Run pylint on all the Python source files in a directory tree
500
537
  options:
501
538
  -h, --help show this help message and exit
502
539
 
503
- ## s3-sync
504
-
505
- Synchronise files from S3 to local storage.
506
-
507
540
  ## strreplace
508
541
 
509
542
  Simple search and replace utility for those times when trying to escape characters in a regexp to use sed is more hassle than it is worth.
@@ -592,33 +625,3 @@ YAML validator - checks that a file is valid YAML (use yamllint to verify that i
592
625
  --block Force block style when dumping the YAML data
593
626
  --flow Force flow style when dumping the YAML data
594
627
  --hiera Process the file as Puppet Hiera data
595
-
596
- # Obsolescent Utilities
597
-
598
- These will be moved to the skilleter-extras package in due course.
599
-
600
- ## consolecolours
601
-
602
- Display all available colours in the console.
603
-
604
- # Obsolescent Commands
605
-
606
- These commands will probably be retired in future versions of Thingy
607
-
608
- ## ggit
609
-
610
- Run a git command in all working trees under the current directory (superceded by multigit).
611
-
612
- ## ggrep
613
-
614
- Run 'git grep' in all repos under the current directory (superceded by multigit).
615
-
616
- ## GitLab Commands
617
-
618
- ### git mr
619
-
620
- Push a feature branch to GitLab and create a merge request
621
-
622
- ### gl
623
-
624
- Command line for GitLab
@@ -1,7 +1,6 @@
1
1
  skilleter_thingy/__init__.py,sha256=rVPTxm8L5w52U0YdTd7r_D44SBP7pS3JCJtsf0iIsow,110
2
2
  skilleter_thingy/addpath.py,sha256=4Yhhgjjz1XDI98j0dAiQpNA2ejLefeWUTeSg3nIXQq0,3842
3
3
  skilleter_thingy/console_colours.py,sha256=BOS9mo3jChx_FE8L1j488MDoVNgib11KjTRhrz_YRYE,1781
4
- skilleter_thingy/docker_purge.py,sha256=PRQ7EBXymjYIHuJL4pk4r6KNn09IF28OGZ0ln57xtNg,3314
5
4
  skilleter_thingy/ffind.py,sha256=kIMx3VDvNpvTbp0gDzsiOiSlV_R8xZowHxADjts9qI0,19571
6
5
  skilleter_thingy/ggit.py,sha256=BL-DhNcz4Nd3sA-3Kl6gZ-zFtbNqOpyufvas-0aD8nk,2465
7
6
  skilleter_thingy/ggrep.py,sha256=fnTzOI1Qbf7IY_TnStdx5uqeUhqSDkapxmhYgrONJHw,5887
@@ -11,28 +10,24 @@ skilleter_thingy/git_cleanup.py,sha256=3T8vkDJHsEVMTMkC2ARo8KHJ4zgPo6mmABVeuHcXh
11
10
  skilleter_thingy/git_co.py,sha256=Mc-6jEUpVWAJJ-2PTpQ4tjDw03_zJMJDX9SGIxCqzJQ,8404
12
11
  skilleter_thingy/git_common.py,sha256=FKXB6aT-y_a3N6wFnnwM6qJi4ClLFvDAivkSQ4iEYP4,2111
13
12
  skilleter_thingy/git_hold.py,sha256=coyHdl1bWivrWdmgs7smVPvHRNoXgsgmUjR6n-08lV4,4920
14
- skilleter_thingy/git_mr.py,sha256=MsrAkIKW27fVTljV__zAjMveIpufvDQ_j0jeKJu2rZM,3426
15
13
  skilleter_thingy/git_parent.py,sha256=VqP4v3zsWp6utJvxFxSB_GwCv82xNIiiBlAlkinO1Wk,2938
16
14
  skilleter_thingy/git_retag.py,sha256=JT-yD-uU4dL0mxDq9IRynugUKqIxjMCdU1dYDjiBSTU,1828
17
15
  skilleter_thingy/git_review.py,sha256=AsCVq2viAsNE527uHvbPOYASI3iVx0JgCfuA0J0Ocmg,52557
18
16
  skilleter_thingy/git_update.py,sha256=Ic5X_GZO2yez_nwrCqSTq3p07k3TyRAMSvQYpjP-yvE,14571
19
17
  skilleter_thingy/git_wt.py,sha256=tkGN_Bfz80icHNDVG8xuXVeUUR-xyZ3u8jopLRt1Ff4,2355
20
- skilleter_thingy/gitcmp_helper.py,sha256=SwYYHXYJQnPizCrLpHwOt-h0_O61zRwV1Ckr2XehyKc,11576
18
+ skilleter_thingy/gitcmp_helper.py,sha256=VqmKXQ44qn4gdRUdDPvcDqnySlBmaV4TsSqc8z-0SbQ,11578
21
19
  skilleter_thingy/gitprompt.py,sha256=19vBe2JSs6H_7us5MYmdmGnwEIKiP9K2JlUBWPxXuCg,8939
22
- skilleter_thingy/gl.py,sha256=9zbGpKxw6lX9RghLkdy-Q5sZlqtbB3uGFO04qTu1dH8,5954
23
20
  skilleter_thingy/linecount.py,sha256=ehTN6VD76i4U5k6dXuYoiqSRHI67_BP-bziklNAJSKY,4309
24
- skilleter_thingy/multigit.py,sha256=kTxEYinHCH1CQE7hzJF58XH1m-n0NZz5IGOtIJ3nL4Q,33979
25
- skilleter_thingy/py_audit.py,sha256=4CAdqBAIIVcpTCn_7dGm56bdfGpUtUJofqTGZomClkY,4417
21
+ skilleter_thingy/multigit.py,sha256=3pH5Lqvms6cTMKdGOU0mO63zGNoDsC_CYk9QWVDsm9I,34021
22
+ skilleter_thingy/py_audit.py,sha256=W21pnrCI-Cz3qUgfJ8HODtTjmZTtGlTOKoTTpz-Mo2o,4384
26
23
  skilleter_thingy/readable.py,sha256=LcMMOiuzf9j5TsxcMbO0sbj6m1QCuABl91Hrv-YyIww,15422
27
24
  skilleter_thingy/remdir.py,sha256=Ueg3a6_m7y50zWykhKk6pcuz4FKPjoLJVPo9gh_dsic,4653
28
- skilleter_thingy/rmdupe.py,sha256=RWtOHq__zY4yOf6_Y-H-8RRJy31Sr3c8DEyTd6Y4oV4,17213
29
25
  skilleter_thingy/rpylint.py,sha256=spdVVpNyElkV1fQknv-RESmqe7U0QZYneX96vSAEMSo,2875
30
26
  skilleter_thingy/strreplace.py,sha256=zMhqC38KF0BddTsRM5Pa99HU3KXvxXg942qxRK-LALA,2539
31
27
  skilleter_thingy/tfm.py,sha256=bw_S4bCAisZAEkzrbqnXqJsjC62oA08FM_xrbkuDQuQ,33787
32
28
  skilleter_thingy/tfparse.py,sha256=rRoinnbq6sLfkT38yzzXi2jQuJgBIJoC--G05TVTDIc,2991
33
29
  skilleter_thingy/trimpath.py,sha256=ijLowl-rxV53m0G75tGNuHWobObz5NreBy8yXP9l4eY,2373
34
30
  skilleter_thingy/venv_create.py,sha256=EV_oZh3JlDc5hX5h9T1hnt65AEABw6PufaKvPYabR00,1159
35
- skilleter_thingy/x.py,sha256=hFiinFX2p0x0OkPf7QnBdW6vAhSIfocwq4siZl2_MvQ,49
36
31
  skilleter_thingy/xchmod.py,sha256=T89xiH_po0nvH5T1AGgQOD5yhjKd9-LcHcmez3IORww,4604
37
32
  skilleter_thingy/yamlcheck.py,sha256=FXylZ5NtHirDlPVhVEUZUZkTugVR-g51BbjaN06akAc,2868
38
33
  skilleter_thingy/thingy/__init__.py,sha256=rVPTxm8L5w52U0YdTd7r_D44SBP7pS3JCJtsf0iIsow,110
@@ -41,9 +36,8 @@ skilleter_thingy/thingy/dc_curses.py,sha256=fuuQPR11zV_akAhygL_cAhVLC5YAgKgowzlI
41
36
  skilleter_thingy/thingy/dc_defaults.py,sha256=ahcteQvoWZrO5iTU68zkIY1Zex6iX5uR5ubwI4CCYBk,6170
42
37
  skilleter_thingy/thingy/dc_util.py,sha256=Df73imXhHx3HzcPHiRcHAoea0e3HURdLcrolUsMhOFs,1783
43
38
  skilleter_thingy/thingy/dircolors.py,sha256=aBcq9ci855GSOIjrZWm8kG0ksCodvUmc4FlIOEOyBcA,12292
44
- skilleter_thingy/thingy/docker.py,sha256=iT8PqX2hJfcR1e4hotQfSBBYNe0Qdcmeo-XJ6y7lw7Y,2477
45
39
  skilleter_thingy/thingy/files.py,sha256=nFIOEi2rl2SuYa6Zd7Nf1BWCKyKlF8D6hsbPlfnVefQ,4791
46
- skilleter_thingy/thingy/git.py,sha256=aa4vFwXiZ9JkH-zJuKZWACw4Ympcomi6EsPdlLIJiSs,43227
40
+ skilleter_thingy/thingy/git.py,sha256=AIPPhEg1KU98milewP_vazxDUVat3QFQUsK9cqmdsEw,43234
47
41
  skilleter_thingy/thingy/gitlab.py,sha256=uXAF918xnPk6qQyiwPQDbMZfqtJzhiRqDS7yEtJEIAg,6079
48
42
  skilleter_thingy/thingy/path.py,sha256=8uM2Q9zFRWv_SaVOX49PeecQXttl7J6lsmBuRXWsXKY,4732
49
43
  skilleter_thingy/thingy/popup.py,sha256=TY9rpj4q8uZxerSt641LGUTy0TZgUjgfEX-CkRMuyek,2540
@@ -51,9 +45,9 @@ skilleter_thingy/thingy/run.py,sha256=Q6uug_LucKbn36RB-r08QYaCzmeoU452ipzQ2YiVUP
51
45
  skilleter_thingy/thingy/tfm_pane.py,sha256=XTTpSm71CyQyGmlVLuCthioOwech0jhUiFUXb-chS_Q,19792
52
46
  skilleter_thingy/thingy/tidy.py,sha256=AQ2RawsZJg6WHrgayi_ZptFL9occ7suSdCHbU3P-cys,5971
53
47
  skilleter_thingy/thingy/venv_template.py,sha256=ZfUvi8qFNGrk7J030Zy57xjwMtfIArJyqa-MqafyjVk,1016
54
- skilleter_thingy-0.2.15.dist-info/licenses/LICENSE,sha256=ljOS4DjXvqEo5VzGfdaRwgRZPbNScGBmfwyC8PChvmQ,32422
55
- skilleter_thingy-0.2.15.dist-info/METADATA,sha256=NV9puo96TLDp25-yZ2LNqq95Q3eAAIcNX0rhciQJh58,28914
56
- skilleter_thingy-0.2.15.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
57
- skilleter_thingy-0.2.15.dist-info/entry_points.txt,sha256=MTNWf8jOx8Fy3tSwVLCZPlEyzlDF36odw-IN-cSefP8,1784
58
- skilleter_thingy-0.2.15.dist-info/top_level.txt,sha256=8-JhgToBBiWURunmvfpSxEvNkDHQQ7r25-aBXtZv61g,17
59
- skilleter_thingy-0.2.15.dist-info/RECORD,,
48
+ skilleter_thingy-0.3.1.dist-info/licenses/LICENSE,sha256=ljOS4DjXvqEo5VzGfdaRwgRZPbNScGBmfwyC8PChvmQ,32422
49
+ skilleter_thingy-0.3.1.dist-info/METADATA,sha256=J9OlzotB7aCdrmYT7Kl0dP-9Oj7BzzBpQVS7kmoweJ0,29526
50
+ skilleter_thingy-0.3.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
51
+ skilleter_thingy-0.3.1.dist-info/entry_points.txt,sha256=GVZW2krSQlttxWWkym-ZCc4W0nV97gaqtFi-emcvQMk,1449
52
+ skilleter_thingy-0.3.1.dist-info/top_level.txt,sha256=8-JhgToBBiWURunmvfpSxEvNkDHQQ7r25-aBXtZv61g,17
53
+ skilleter_thingy-0.3.1.dist-info/RECORD,,
@@ -1,7 +1,6 @@
1
1
  [console_scripts]
2
2
  addpath = skilleter_thingy:addpath.addpath
3
3
  consolecolours = skilleter_thingy:console_colours.console_colours
4
- docker-purge = skilleter_thingy:docker_purge.docker_purge
5
4
  ffind = skilleter_thingy:ffind.ffind
6
5
  ggit = skilleter_thingy:ggit.ggit
7
6
  ggrep = skilleter_thingy:ggrep.ggrep
@@ -11,7 +10,6 @@ git-cleanup = skilleter_thingy:git_cleanup.git_cleanup
11
10
  git-co = skilleter_thingy:git_co.git_co
12
11
  git-common = skilleter_thingy:git_common.git_common
13
12
  git-hold = skilleter_thingy:git_hold.git_hold
14
- git-mr = skilleter_thingy:git_mr.git_mr
15
13
  git-parent = skilleter_thingy:git_parent.git_parent
16
14
  git-retag = skilleter_thingy:git_retag.git_retag
17
15
  git-review = skilleter_thingy:git_review.git_review
@@ -19,22 +17,16 @@ git-update = skilleter_thingy:git_update.git_update
19
17
  git-wt = skilleter_thingy:git_wt.git_wt
20
18
  gitcmp-helper = skilleter_thingy:gitcmp_helper.gitcmp_helper
21
19
  gitprompt = skilleter_thingy:gitprompt.gitprompt
22
- gl = skilleter_thingy:gl.gl
23
- gphotosync = skilleter_thingy:gphotosync.gphotosync
24
20
  linecount = skilleter_thingy:linecount.linecount
25
- mg = skilleter_thingy:mg.mg
26
21
  multigit = skilleter_thingy:multigit.multigit
27
22
  py-audit = skilleter_thingy:py_audit.py_audit
28
23
  readable = skilleter_thingy:readable.readable
29
24
  remdir = skilleter_thingy:remdir.remdir
30
- rmdupe = skilleter_thingy:rmdupe.rmdupe
31
25
  rpylint = skilleter_thingy:rpylint.rpylint
32
- s3-sync = skilleter_thingy:s3_sync.s3_sync
33
26
  strreplace = skilleter_thingy:strreplace.strreplace
34
27
  tfm = skilleter_thingy:tfm.tfm
35
28
  tfparse = skilleter_thingy:tfparse.tfparse
36
29
  trimpath = skilleter_thingy:trimpath.trimpath
37
30
  venv-create = skilleter_thingy:venv_create.venv_create
38
- webwatch = skilleter_thingy:webwatch.webwatch
39
31
  xchmod = skilleter_thingy:xchmod.xchmod
40
32
  yamlcheck = skilleter_thingy:yamlcheck.yamlcheck
@@ -1,111 +0,0 @@
1
- #! /usr/bin/env python3
2
-
3
- ################################################################################
4
- """ Thingy docker-purge command
5
-
6
- Copyright (C) 2017 John Skilleter
7
-
8
- Initial version - contains only basic error checking and limited debug output.
9
- """
10
- ################################################################################
11
-
12
- import sys
13
- import re
14
- import argparse
15
- import logging
16
-
17
- from thingy import docker
18
-
19
- ################################################################################
20
-
21
- def initialise():
22
- """ Parse the command line """
23
-
24
- parser = argparse.ArgumentParser(description='Purge docker instances and images')
25
-
26
- parser.add_argument('--stop', '-s', action='store_true', help='Stop Docker instances')
27
- parser.add_argument('--kill', '-k', action='store_true', help='Kill Docker instances')
28
- parser.add_argument('--remove', '-r', action='store_true', help='Remove Docker images')
29
- parser.add_argument('--list', '-l', action='store_true', help='List what would be done without doing it')
30
- parser.add_argument('--force', '-f', action='store_true', help='Forcibly kill/remove instances')
31
- parser.add_argument('--debug', action='store_true', help='Enable debug output')
32
- parser.add_argument('images', nargs='*', help='List of Docker containers (regular expression)')
33
-
34
- args = parser.parse_args()
35
-
36
- # Configure logging
37
-
38
- if args.debug:
39
- logging.basicConfig(level=logging.DEBUG)
40
- logging.info('Debug logging enabled')
41
-
42
- # Default is to stop matching images
43
-
44
- if not args.stop and not args.kill and not args.remove:
45
- args.stop = True
46
-
47
- # Default is to match all containers
48
-
49
- if not args.images:
50
- args.images = '.*'
51
- else:
52
- args.images = '|'.join(args.images)
53
-
54
- logging.info('Arguments: %s', args)
55
- return args
56
-
57
- ################################################################################
58
-
59
- def main(args):
60
- """ Main code """
61
-
62
- try:
63
- if args.stop or args.kill:
64
- for instance in docker.instances():
65
- if re.match(args.images, instance):
66
-
67
- print(f'Stopping instance: {instance}')
68
-
69
- if not args.list:
70
- docker.stop(instance, force=args.force)
71
-
72
- if args.kill:
73
- for instance in docker.instances(all=True):
74
- if re.match(args.images, instance):
75
-
76
- print(f'Removing instance: {instance}')
77
-
78
- if not args.list:
79
- docker.rm(instance)
80
-
81
- if args.remove:
82
- for image in docker.images():
83
- if re.match(args.images, image):
84
-
85
- print(f'Removing image: {image}')
86
-
87
- if not args.list:
88
- docker.rmi(image, force=args.force)
89
-
90
- except docker.DockerError as exc:
91
- sys.stderr.write(f'{str(exc)}\n')
92
- sys.exit(1)
93
-
94
- ################################################################################
95
-
96
- def docker_purge():
97
- """Entry point"""
98
-
99
- try:
100
- config = initialise()
101
- main(config)
102
-
103
- except KeyboardInterrupt:
104
- sys.exit(1)
105
- except BrokenPipeError:
106
- sys.exit(2)
107
-
108
- ################################################################################
109
-
110
- if __name__ == '__main__':
111
- docker_purge()
@@ -1,103 +0,0 @@
1
- #! /usr/bin/env python3
2
-
3
- ################################################################################
4
- """ Push to Gitlab and create a merge request at the same time """
5
- ################################################################################
6
-
7
- import os
8
- import logging
9
- import sys
10
- import argparse
11
-
12
- import thingy.git as git
13
- import thingy.colour as colour
14
-
15
- ################################################################################
16
-
17
- DESCRIPTION = 'Push a feature branch to GitLab and create a merge request'
18
-
19
- ################################################################################
20
-
21
- def parse_arguments():
22
- """ Parse and return command line arguments """
23
-
24
- parser = argparse.ArgumentParser(description=DESCRIPTION, formatter_class=argparse.RawTextHelpFormatter)
25
-
26
- parser.add_argument('--debug', action='store_true', help='Enable debug output')
27
- parser.add_argument('--force', '-f', action='store_true', help='Force-push the branch')
28
- parser.add_argument('--parent', '-p', action='store', help='Override the default parent and specify the branch to merge onto')
29
- parser.add_argument('--reviewer', '-r', action='store', help='Specify the name of the reviewer for the merge request')
30
- parser.add_argument('--keep', '-k', action='store_true', help='Keep the source branch after the merge (default is to delete it).')
31
- parser.add_argument('--path', '-C', nargs=1, type=str, default=None,
32
- help='Run the command in the specified directory')
33
-
34
- args = parser.parse_args()
35
-
36
- # Enable logging if requested
37
-
38
- if args.debug:
39
- logging.basicConfig(level=logging.INFO)
40
-
41
- # Change directory, if specified
42
-
43
- if args.path:
44
- os.chdir(args.path[0])
45
-
46
- return args
47
-
48
- ################################################################################
49
-
50
- def main():
51
- """ Main function - parse the command line and perform the pushing """
52
-
53
- args = parse_arguments()
54
-
55
- if args.parent:
56
- parents = [args.parent]
57
- else:
58
- parents, _ = git.parents()
59
-
60
- if not parents:
61
- colour.error('Unable to determine parent branch. Use the [BLUE]--parent[NORMAL] option to specify the appropriate one.')
62
-
63
- if len(parents) > 1:
64
- parent_list = ', '.join(parents)
65
- colour.error(
66
- f'Branch has multiple potential parents: [BLUE]{parent_list}[NORMAL]. Use the [BLUE]--parent[NORMAL] option to specify the appropriate one.')
67
-
68
- options = ['merge_request.create', f'merge_request.target={parents[0]}']
69
-
70
- if args.reviewer:
71
- options.append(f'merge_request.assign={args.reviewer}')
72
-
73
- if not args.keep:
74
- options.append('merge_request.remove_source_branch')
75
-
76
- logging.debug('Running git push with:')
77
- logging.debug(' force: %s', args.force)
78
- logging.debug(' push options: %s', options)
79
-
80
- result = git.push(force_with_lease=args.force, push_options=options)
81
-
82
- for text in result:
83
- print(text)
84
-
85
- ################################################################################
86
-
87
- def git_mr():
88
- """Entry point"""
89
-
90
- try:
91
- main()
92
-
93
- except KeyboardInterrupt:
94
- sys.exit(1)
95
- except BrokenPipeError:
96
- sys.exit(2)
97
- except git.GitError as exc:
98
- colour.error(exc.msg, status=exc.status, prefix=True)
99
-
100
- ################################################################################
101
-
102
- if __name__ == '__main__':
103
- git_mr()