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

@@ -103,13 +103,26 @@ def mg_init(args, config, console):
103
103
  By default, it scans the tree for git directories and adds or updates them
104
104
  in the configuration, using the current branch as the default branch. """
105
105
 
106
+ # TODO: [ ] Update should remove or warn about repos that are no longer present
107
+
106
108
  # Search for .git directories
107
109
 
108
110
  for repo in find_git_repos(args.directory, args.repos):
109
111
  if not args.quiet:
110
112
  show_progress(console.columns, repo)
111
113
 
112
- config[repo] = {'default branch': git.branch(path=repo)}
114
+ if not repo in config:
115
+ config[repo] = {
116
+ 'default branch': git.branch(path=repo)
117
+ }
118
+
119
+ remote = git.remotes(path=repo)
120
+
121
+ if 'origin' in remote:
122
+ config[repo]['origin'] = remote['origin']
123
+ config[repo]['name']= os.path.basename(remote['origin']).removesuffix('.git')
124
+ else:
125
+ config[repo]['name'] = os.path.basename(repo)
113
126
 
114
127
  ################################################################################
115
128
 
@@ -259,7 +272,7 @@ def mg_push(args, config, console):
259
272
  result = git.push(path=repo, force_with_lease=args.force)
260
273
 
261
274
  if result:
262
- colour.write(result, indent=4)
275
+ colour.write(result, indent=4)
263
276
 
264
277
  colour.write()
265
278
 
@@ -371,6 +384,27 @@ def mg_clean(args, config, console):
371
384
 
372
385
  ################################################################################
373
386
 
387
+ def mg_dir(args, config, console):
388
+ """Return the location of a working tree, given the name. Returns an
389
+ error unless there is a unique match"""
390
+
391
+ location = []
392
+ search_dir = args.dir[0]
393
+
394
+ breakpoint()
395
+ for repo in find_git_repos(args.directory, args.repos):
396
+ if fnmatch.fnmatch(config[repo]['name'], search_dir):
397
+ location.append(repo)
398
+
399
+ if len(location) == 0:
400
+ error(f'No matches with {dir}')
401
+ elif len(location) > 1:
402
+ error(f'Multiple matches with {dir}')
403
+
404
+ colour.write(location[0])
405
+
406
+ ################################################################################
407
+
374
408
  def main():
375
409
  """Main function"""
376
410
 
@@ -384,6 +418,7 @@ def main():
384
418
  'commit': mg_commit,
385
419
  'update': mg_update,
386
420
  'clean': mg_clean,
421
+ 'dir': mg_dir,
387
422
  }
388
423
 
389
424
  # Parse args in the form COMMAND OPTIONS SUBCOMMAND SUBCOMMAND_OPTIONS PARAMETERS
@@ -431,6 +466,9 @@ def main():
431
466
  parser_clean.add_argument('-x', action='store_true', help='Don’t use the standard ignore rules, but still use the ignore rules given with -e options from the command line.')
432
467
  parser_clean.add_argument('-X', action='store_true', help='Remove only files ignored by Git. This may be useful to rebuild everything from scratch, but keep manually created files.')
433
468
 
469
+ parser_dir = subparsers.add_parser('dir', help='Return the location of a working tree, given the repo name')
470
+ parser_dir.add_argument('dir', nargs=1, action='store', help='The name of the working tree')
471
+
434
472
  # Parse the command line
435
473
 
436
474
  args = parser.parse_args()
@@ -317,10 +317,10 @@ def merging():
317
317
 
318
318
  ################################################################################
319
319
 
320
- def remotes():
320
+ def remotes(path=None):
321
321
  """ Return the list of git remotes """
322
322
 
323
- repo = pygit2.Repository(os.getcwd())
323
+ repo = pygit2.Repository(path or os.getcwd())
324
324
 
325
325
  git_remotes = {}
326
326
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: skilleter_thingy
3
- Version: 0.0.77
3
+ Version: 0.0.78
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
@@ -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=5voQtjJjDCVx4zjPwVRy620NpuLiwwFitzxjIsRGtxQ,4310
27
27
  skilleter_thingy/moviemover.py,sha256=j_Xb9_jFdgpFBAXcF4tEqbnKH_FonlnUU39LiCK980k,4470
28
- skilleter_thingy/multigit.py,sha256=DES_T2XpyR82jR30e26KvrXMgmSepUhSiSffjTru1AU,19026
28
+ skilleter_thingy/multigit.py,sha256=R7f4dxe-jTBypnY_tI9W3_qFcL8NOu7zLTqleOmFbgo,20362
29
29
  skilleter_thingy/photodupe.py,sha256=l0hbzSLb2Vk2ceteg-x9fHXCEE1uUuFo84hz5rsZUPA,4184
30
30
  skilleter_thingy/phototidier.py,sha256=5gSjlINUxf3ZQl3NG0o7CsWwODvTbokIMIafLFvn8Hc,7818
31
31
  skilleter_thingy/py_audit.py,sha256=xJm5k5qyeA6ii8mODa4dOkmP8L1drv94UHuxR54RsIM,4384
@@ -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=UEXeSyT5PlYGtdUAQDEZC7Sc7JmYdAlP6osa1tVmpO8,36620
55
+ skilleter_thingy/thingy/git2.py,sha256=0sICXJLUKuZ3gBMv7IFSeQGUl_9Y1SexHxWAXEoXPec,36637
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.77.dist-info/LICENSE,sha256=ljOS4DjXvqEo5VzGfdaRwgRZPbNScGBmfwyC8PChvmQ,32422
65
- skilleter_thingy-0.0.77.dist-info/METADATA,sha256=OuTAQKPCHRzc4K-j1oHaFnpO8piPz-pKO5uT-0uPs3s,5938
66
- skilleter_thingy-0.0.77.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
67
- skilleter_thingy-0.0.77.dist-info/entry_points.txt,sha256=uW11ofmIbfPP_5B-pxb8YDkHbeZ_xeCoO6358R9wGVI,2146
68
- skilleter_thingy-0.0.77.dist-info/top_level.txt,sha256=8-JhgToBBiWURunmvfpSxEvNkDHQQ7r25-aBXtZv61g,17
69
- skilleter_thingy-0.0.77.dist-info/RECORD,,
64
+ skilleter_thingy-0.0.78.dist-info/LICENSE,sha256=ljOS4DjXvqEo5VzGfdaRwgRZPbNScGBmfwyC8PChvmQ,32422
65
+ skilleter_thingy-0.0.78.dist-info/METADATA,sha256=QXlQ8Q0gkgAgAJzzWv6moFcG16C8kYMSDy0Ep4f6GLA,5938
66
+ skilleter_thingy-0.0.78.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
67
+ skilleter_thingy-0.0.78.dist-info/entry_points.txt,sha256=uW11ofmIbfPP_5B-pxb8YDkHbeZ_xeCoO6358R9wGVI,2146
68
+ skilleter_thingy-0.0.78.dist-info/top_level.txt,sha256=8-JhgToBBiWURunmvfpSxEvNkDHQQ7r25-aBXtZv61g,17
69
+ skilleter_thingy-0.0.78.dist-info/RECORD,,