[MERGED] osmo-dev[master]: git_branch_summary.py: add usage, make py3 compatible

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/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Tue Sep 5 10:29:15 UTC 2017


Neels Hofmeyr has submitted this change and it was merged.

Change subject: git_branch_summary.py: add usage, make py3 compatible
......................................................................


git_branch_summary.py: add usage, make py3 compatible

Change-Id: Ia8cc461fd0f1fb43e19ee8846cc48a828d153b2f
---
M src/git_branch_summary.py
1 file changed, 7 insertions(+), 3 deletions(-)

Approvals:
  Neels Hofmeyr: Looks good to me, approved; Verified



diff --git a/src/git_branch_summary.py b/src/git_branch_summary.py
index 6bd4378..cc86112 100755
--- a/src/git_branch_summary.py
+++ b/src/git_branch_summary.py
@@ -2,6 +2,10 @@
 
 import sys, subprocess, re
 
+if len(sys.argv) < 2:
+  print("Usage: %s <git_dir> [...]\nThis is mostly here for helping the 'st' script." % sys.argv[0])
+  exit(1)
+
 interesting_branch_names = [ 'master', 'sysmocom/iu', 'sysmocom/sccp', 'aper-prefix-onto-upstream' ]
 
 re_branch_name = re.compile('^..([^ ]+) .*')
@@ -15,7 +19,7 @@
 
 def do_one_git(git_dir):
   global interesting
-  branch_strs = subprocess.check_output(('git', '-C', git_dir, 'branch', '-vv')).splitlines()
+  branch_strs = subprocess.check_output(('git', '-C', git_dir, 'branch', '-vv')).decode().splitlines()
   interesting_branches = []
 
   for line in branch_strs:
@@ -35,7 +39,7 @@
     else:
       interesting_branches.append(br)
 
-  status = subprocess.check_output(('git', '-C', git_dir, 'status'))
+  status = subprocess.check_output(('git', '-C', git_dir, 'status')).decode()
   has_mods = 'modified:' in status
 
   interesting.append((git_dir, has_mods, interesting_branches))
@@ -59,6 +63,6 @@
       br.append('[%s]' % '|'.join(ahead))
     strs.append(''.join(br))
 
-  print ' '.join(strs)
+  print(' '.join(strs))
 
 # vim: shiftwidth=2 expandtab tabstop=2

-- 
To view, visit https://gerrit.osmocom.org/3806
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia8cc461fd0f1fb43e19ee8846cc48a828d153b2f
Gerrit-PatchSet: 1
Gerrit-Project: osmo-dev
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list