Change in osmo-dev[master]: replace src/* git scripts with a single src/gits

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

osmith gerrit-no-reply at lists.osmocom.org
Wed Nov 7 10:47:47 UTC 2018


osmith has posted comments on this change. ( https://gerrit.osmocom.org/11560 )

Change subject: replace src/* git scripts with a single src/gits
......................................................................


Patch Set 5: Code-Review-1

(6 comments)

gits was not executable in the last patchset (chmod +x gits)

https://gerrit.osmocom.org/#/c/11560/4/src/gits
File src/gits:

https://gerrit.osmocom.org/#/c/11560/4/src/gits@2
PS4, Line 2: 
> the reason why argparse will not work so well is passing arguments to git. consider: […]
this works well with argparse, see the example below


https://gerrit.osmocom.org/#/c/11560/4/src/gits@68
PS4, Line 68: args):
> yeah, that's the main ultra drawback of this script so far. I really really shouldn't use porcelain. […]
This seems to work - do you get the same output with your version?

  $ git status --porcelain --long
  On branch master
  Your branch is up-to-date with 'origin/master'.
  nothing to commit, working tree clean


https://gerrit.osmocom.org/#/c/11560/4/src/gits@194
PS4, Line 194:     lines = []
> I like more visible markers in this case
What I meant: keep the ==== marker that is there, and add this line below:
  
        print('+ %s' % ' '.join(cmd))


https://gerrit.osmocom.org/#/c/11560/4/src/gits@359
PS4, Line 359:     for git_dir in git_dirs():
> but I want to write 'gits fetch' :) […]
you don't need a shim for every git command, you can just put them in a list and iterate over them:

  import argparse
  
  def parse_args():
      parser = argparse.ArgumentParser()
      sub = parser.add_subparsers(title="action", dest="action")
      sub.required = True
      sub.add_parser("status", aliases=["s", "st"],
          help="show a branch summary...")

      do = sub.add_parser("do", help="run arbitrary git command...")
      do.add_argument("args_passed", nargs=argparse.REMAINDER)
    
      # direct pass-through to git
      for action in ["fetch"]:
          action_parser = sub.add_parser(action)
          action_parser.add_argument("args_passed", nargs=argparse.REMAINDER)
      return parser.parse_args()


  if __name__ == '__main__':
      args = parse_args()
      if args.action == "status":
          cmd_status()
      # ... (other commands here)
      elif args.action == "do":
          cmd_do(args.args_passed)
      else: # pass directly through to git
          cmd_do([args.action] + args.args_passed)


https://gerrit.osmocom.org/#/c/11560/4/src/gits@362
PS4, Line 362:             sys.stdout.flush()
> wow, you're just as obsessed with details like I am!
yeah :)


https://gerrit.osmocom.org/#/c/11560/5/src/gits
File src/gits:

https://gerrit.osmocom.org/#/c/11560/5/src/gits@6
PS5, Line 6: # This program is free software: you can redistribute it and/or modify
Out of curiosity: why not use the shorter SPDX form?

  # SPDX-License-Identifier: GPL-3.0-or-later



-- 
To view, visit https://gerrit.osmocom.org/11560
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-dev
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I579e7af26d76d5c5d83b2349695456bc7b54f5a2
Gerrit-Change-Number: 11560
Gerrit-PatchSet: 5
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
Gerrit-Comment-Date: Wed, 07 Nov 2018 10:47:47 +0000
Gerrit-HasComments: Yes
Gerrit-HasLabels: Yes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181107/2aa60f22/attachment.htm>


More information about the gerrit-log mailing list