Update the branch_comm script from to python2 to python3.
Test-Parameters: trivial
Signed-off-by: John L. Hammond <jhammond@whamcloud.com>
Change-Id: Icbb747c01e15cbe77c6dd6df3e913654ded84239
Reviewed-on: https://review.whamcloud.com/46856
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Jian Yu <yujian@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
import re
import subprocess
import re
import subprocess
def _change_from_record(rec):
change = Change()
def _change_from_record(rec):
change = Change()
- change.__dict__.update(dict(zip(GIT_LOG_FIELDS, rec.split('\x1f'))))
- change.author_date = long(change.author_date)
+ change.__dict__.update(dict(list(zip(GIT_LOG_FIELDS, rec.split('\x1f')))))
+ change.author_date = int(change.author_date)
for line in change.body.splitlines():
# Sometimes we have 'key : value' so we strip both sides.
lis = line.split(':', 1)
for line in change.body.splitlines():
# Sometimes we have 'key : value' so we strip both sides.
lis = line.split(':', 1)
'--reverse',
self.name
] + self.paths,
'--reverse',
self.name
] + self.paths,
- stdout=subprocess.PIPE)
+ stdout=subprocess.PIPE,
+ text=True)
out, _ = pipe.communicate()
rc = pipe.wait()
assert rc == 0
out, _ = pipe.communicate()
rc = pipe.wait()
assert rc == 0
i1 += 1
i2 += 1
# c1 is common to both branches.
i1 += 1
i2 += 1
# c1 is common to both branches.
- print '\t\t%s\t%s' % (c1.commit, c1.subject) # TODO Add a '*' if subjects different...
+ print('\t\t%s\t%s' % (c1.commit, c1.subject)) # TODO Add a '*' if subjects different...
continue
if p1 and not p2:
continue
if p1 and not p2:
change_set_printed(c1)
i1 += 1
# c1 is unique to b1.
change_set_printed(c1)
i1 += 1
# c1 is unique to b1.
- print '%s\t\t\t%s' % (c1.commit, c1.subject)
+ print('%s\t\t\t%s' % (c1.commit, c1.subject))
continue
if p2 and not p1:
continue
if p2 and not p1:
change_set_printed(c2)
i2 += 1
# c2 is unique to b2.
change_set_printed(c2)
i2 += 1
# c2 is unique to b2.
- print '\t%s\t\t%s' % (c2.commit, c2.subject)
+ print('\t%s\t\t%s' % (c2.commit, c2.subject))
continue
# Now neither is ported or both are ported (and the order is weird).
continue
# Now neither is ported or both are ported (and the order is weird).
change_set_printed(p2)
i1 += 1
# c1 is common to both branches.
change_set_printed(p2)
i1 += 1
# c1 is common to both branches.
- print '\t\t%s\t%s' % (c1.commit, c1.subject)
+ print('\t\t%s\t%s' % (c1.commit, c1.subject))
continue
else:
change_set_printed(c1)
i1 += 1
# c1 is unique to b1.
continue
else:
change_set_printed(c1)
i1 += 1
# c1 is unique to b1.
- print '%s\t\t\t%s' % (c1.commit, c1.subject)
+ print('%s\t\t\t%s' % (c1.commit, c1.subject))
continue
for c1 in b1.log[i1:]:
continue
for c1 in b1.log[i1:]:
# c1 is unique to b1 and must be printed.
change_set_printed(c1)
# c1 is unique to b1 and must be printed.
change_set_printed(c1)
- print '%s\t\t\t%s' % (c1.commit, c1.subject)
+ print('%s\t\t\t%s' % (c1.commit, c1.subject))
for c2 in b2.log[i2:]:
if change_is_printed(c2):
for c2 in b2.log[i2:]:
if change_is_printed(c2):
assert i1 == n1
# ...
change_set_printed(c2)
assert i1 == n1
# ...
change_set_printed(c2)
- print '\t%s\t\t%s' % (c2.commit, c2.subject)
+ print('\t%s\t\t%s' % (c2.commit, c2.subject))
USAGE = """usage: '_PROGNAME_ BRANCH1 BRANCH2 [PATH]...'
USAGE = """usage: '_PROGNAME_ BRANCH1 BRANCH2 [PATH]...'
def main():
if len(sys.argv) < 3:
def main():
if len(sys.argv) < 3:
- print >> sys.stderr, USAGE.replace('_PROGNAME_', sys.argv[0])
+ print(USAGE.replace('_PROGNAME_', sys.argv[0]), file=sys.stderr)
sys.exit(1)
paths = sys.argv[3:]
sys.exit(1)
paths = sys.argv[3:]