mirror of https://gerrit.osmocom.org/osmo-dev
git_branch_summary.py: add usage, make py3 compatible
Change-Id: Ia8cc461fd0f1fb43e19ee8846cc48a828d153b2f
This commit is contained in:
parent
f6402d8921
commit
f927c6f82c
|
@ -2,6 +2,10 @@
|
||||||
|
|
||||||
import sys, subprocess, re
|
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' ]
|
interesting_branch_names = [ 'master', 'sysmocom/iu', 'sysmocom/sccp', 'aper-prefix-onto-upstream' ]
|
||||||
|
|
||||||
re_branch_name = re.compile('^..([^ ]+) .*')
|
re_branch_name = re.compile('^..([^ ]+) .*')
|
||||||
|
@ -15,7 +19,7 @@ interesting = []
|
||||||
|
|
||||||
def do_one_git(git_dir):
|
def do_one_git(git_dir):
|
||||||
global interesting
|
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 = []
|
interesting_branches = []
|
||||||
|
|
||||||
for line in branch_strs:
|
for line in branch_strs:
|
||||||
|
@ -35,7 +39,7 @@ def do_one_git(git_dir):
|
||||||
else:
|
else:
|
||||||
interesting_branches.append(br)
|
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
|
has_mods = 'modified:' in status
|
||||||
|
|
||||||
interesting.append((git_dir, has_mods, interesting_branches))
|
interesting.append((git_dir, has_mods, interesting_branches))
|
||||||
|
@ -59,6 +63,6 @@ for git_dir, has_mods, interesting_branches in interesting:
|
||||||
br.append('[%s]' % '|'.join(ahead))
|
br.append('[%s]' % '|'.join(ahead))
|
||||||
strs.append(''.join(br))
|
strs.append(''.join(br))
|
||||||
|
|
||||||
print ' '.join(strs)
|
print(' '.join(strs))
|
||||||
|
|
||||||
# vim: shiftwidth=2 expandtab tabstop=2
|
# vim: shiftwidth=2 expandtab tabstop=2
|
||||||
|
|
Loading…
Reference in New Issue