rev1 = 'HEAD'
rev2 = None
+ diff_str = git.diff(args, git_id(crt_series, rev1),
+ git_id(crt_series, rev2),
+ diff_flags = options.diff_flags)
if options.stat:
- out.stdout_raw(git.diffstat(args, git_id(crt_series, rev1),
- git_id(crt_series, rev2)) + '\n')
+ out.stdout_raw(git.diffstat(diff_str) + '\n')
else:
- diff_str = git.diff(args, git_id(crt_series, rev1),
- git_id(crt_series, rev2),
- diff_flags = options.diff_flags)
if diff_str:
pager(diff_str)
'%(diffstat)s\n' \
'%(diff)s'
- tmpl_dict['diffstat'] = git.diffstat(rev1 = bottom, rev2 = top)
tmpl_dict['diff'] = git.diff(rev1 = bottom, rev2 = top,
diff_flags = options.diff_flags)
+ tmpl_dict['diffstat'] = git.diffstat(tmpl_dict['diff'])
for key in tmpl_dict:
# make empty strings if key is not available
long_descr = reduce(lambda x, y: x + '\n' + y,
descr_lines[1:], '').strip()
+ diff = git.diff(rev1 = patch.get_bottom(),
+ rev2 = patch.get_top(),
+ diff_flags = options.diff_flags)
tmpl_dict = {'description': patch.get_description().rstrip(),
'shortdescr': short_descr,
'longdescr': long_descr,
- 'diffstat': git.diffstat(rev1 = patch.get_bottom(),
- rev2 = patch.get_top()),
+ 'diffstat': git.diffstat(diff),
'authname': patch.get_authname(),
'authemail': patch.get_authemail(),
'authdate': patch.get_authdate(),
print '-'*79
f.write(descr)
- f.write(git.diff(rev1 = patch.get_bottom(),
- rev2 = patch.get_top(),
- diff_flags = options.diff_flags))
+ f.write(diff)
if not options.stdout:
f.close()
patch_no += 1
rev2 = git_id(crt_series, '%s//top' % patch)
if options.stat:
- out.stdout_raw(git.diffstat(rev1 = rev1, rev2 = rev2) + '\n')
+ out.stdout_raw(git.diffstat(git.diff(rev1 = rev1, rev2 = rev2)) + '\n')
elif options.bare:
out.stdout_raw(git.barefiles(rev1, rev2) + '\n')
else:
'number': number_str,
'shortlog': stack.shortlog(crt_series.get_patch(p)
for p in patches),
- 'diffstat': git.diffstat(
+ 'diffstat': git.diffstat(git.diff(
rev1 = git_id(crt_series, '%s//bottom' % patches[0]),
- rev2 = git_id(crt_series, '%s//top' % patches[-1]))}
+ rev2 = git_id(crt_series, '%s//top' % patches[-1])))}
try:
msg_string = tmpl % tmpl_dict
else:
number_str = ''
+ diff = git.diff(rev1 = git_id(crt_series, '%s//bottom' % patch),
+ rev2 = git_id(crt_series, '%s//top' % patch),
+ diff_flags = options.diff_flags)
tmpl_dict = {'patch': patch,
'sender': sender,
# for backward template compatibility
'longdescr': long_descr,
# for backward template compatibility
'endofheaders': '',
- 'diff': git.diff(
- rev1 = git_id(crt_series, '%s//bottom' % patch),
- rev2 = git_id(crt_series, '%s//top' % patch),
- diff_flags = options.diff_flags),
- 'diffstat': git.diffstat(
- rev1 = git_id(crt_series, '%s//bottom'%patch),
- rev2 = git_id(crt_series, '%s//top' % patch)),
+ 'diff': diff,
+ 'diffstat': git.diffstat(diff),
# for backward template compatibility
'date': '',
'version': version_str,
else:
return ''
-# TODO: take another parameter representing a diff string as we
-# usually invoke git.diff() form the calling functions
-def diffstat(files = None, rev1 = 'HEAD', rev2 = None):
- """Return the diffstat between rev1 and rev2."""
- return GRun('apply', '--stat', '--summary'
- ).raw_input(diff(files, rev1, rev2)).raw_output()
+def diffstat(diff):
+ """Return the diffstat of the supplied diff."""
+ return GRun('apply', '--stat', '--summary').raw_input(diff).raw_output()
def files(rev1, rev2, diff_flags = []):
"""Return the files modified between rev1 and rev2