<p style="white-space: pre-wrap; word-wrap: break-word;">gits was not executable in the last patchset (chmod +x gits)</p><p>Patch set 5:<span style="border-radius: 3px; display: inline-block; margin: 0 2px; padding: 4px;background-color: #ffd4d4;">Code-Review -1</span></p><p><a href="https://gerrit.osmocom.org/11560">View Change</a></p><p>6 comments:</p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.osmocom.org/#/c/11560/4/src/gits">File src/gits:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/#/c/11560/4/src/gits@2">Patch Set #4, Line 2:</a> <code style="font-family:monospace,monospace"></code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">the reason why argparse will not work so well is passing arguments to git. consider: […]</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">this works well with argparse, see the example below</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/#/c/11560/4/src/gits@68">Patch Set #4, Line 68:</a> <code style="font-family:monospace,monospace">args):</code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">yeah, that's the main ultra drawback of this script so far. I really really shouldn't use porcelain. […]</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">This seems to work - do you get the same output with your version?</p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">  $ git status --porcelain --long<br>  On branch master<br>  Your branch is up-to-date with 'origin/master'.<br>  nothing to commit, working tree clean</pre></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/#/c/11560/4/src/gits@194">Patch Set #4, Line 194:</a> <code style="font-family:monospace,monospace">    lines = []</code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">I like more visible markers in this case</blockquote></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">What I meant: keep the ==== marker that is there, and add this line below:<br>  <br>        print('+ %s' % ' '.join(cmd))</pre></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/#/c/11560/4/src/gits@359">Patch Set #4, Line 359:</a> <code style="font-family:monospace,monospace">    for git_dir in git_dirs():</code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">but I want to write 'gits fetch' :) […]</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">you don't need a shim for every git command, you can just put them in a list and iterate over them:</p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">  import argparse<br>  <br>  def parse_args():<br>      parser = argparse.ArgumentParser()<br>      sub = parser.add_subparsers(title="action", dest="action")<br>      sub.required = True<br>      sub.add_parser("status", aliases=["s", "st"],<br>          help="show a branch summary...")</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">      do = sub.add_parser("do", help="run arbitrary git command...")<br>      do.add_argument("args_passed", nargs=argparse.REMAINDER)<br>    <br>      # direct pass-through to git<br>      for action in ["fetch"]:<br>          action_parser = sub.add_parser(action)<br>          action_parser.add_argument("args_passed", nargs=argparse.REMAINDER)<br>      return parser.parse_args()</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><br>  if __name__ == '__main__':<br>      args = parse_args()<br>      if args.action == "status":<br>          cmd_status()<br>      # ... (other commands here)<br>      elif args.action == "do":<br>          cmd_do(args.args_passed)<br>      else: # pass directly through to git<br>          cmd_do([args.action] + args.args_passed)</pre></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/#/c/11560/4/src/gits@362">Patch Set #4, Line 362:</a> <code style="font-family:monospace,monospace">            sys.stdout.flush()</code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">wow, you're just as obsessed with details like I am!</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">yeah :)</p></li></ul></li><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.osmocom.org/#/c/11560/5/src/gits">File src/gits:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/#/c/11560/5/src/gits@6">Patch Set #5, Line 6:</a> <code style="font-family:monospace,monospace"># This program is free software: you can redistribute it and/or modify</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">Out of curiosity: why not use the shorter SPDX form?</p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">  # SPDX-License-Identifier: GPL-3.0-or-later</pre></li></ul></li></ul><p>To view, visit <a href="https://gerrit.osmocom.org/11560">change 11560</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/11560"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-dev </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: comment </div>
<div style="display:none"> Gerrit-Change-Id: I579e7af26d76d5c5d83b2349695456bc7b54f5a2 </div>
<div style="display:none"> Gerrit-Change-Number: 11560 </div>
<div style="display:none"> Gerrit-PatchSet: 5 </div>
<div style="display:none"> Gerrit-Owner: Neels Hofmeyr <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: osmith <osmith@sysmocom.de> </div>
<div style="display:none"> Gerrit-Comment-Date: Wed, 07 Nov 2018 10:47:47 +0000 </div>
<div style="display:none"> Gerrit-HasComments: Yes </div>
<div style="display:none"> Gerrit-HasLabels: Yes </div>