This option allows showing of diffstat instead of patch diffs. Proposal
and initial implementation by Alex Chiang.
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Tested-by: Alex Chiang <achiang@hp.com>
from stgit.argparse import opt
from stgit.commands.common import *
from stgit import argparse, git
from stgit.argparse import opt
from stgit.commands.common import *
from stgit import argparse, git
+from stgit.lib import git as gitlib
help = 'Show the commit corresponding to a patch'
kind = 'patch'
help = 'Show the commit corresponding to a patch'
kind = 'patch'
short = 'Show the applied patches'),
opt('-u', '--unapplied', action = 'store_true',
short = 'Show the unapplied patches'),
short = 'Show the applied patches'),
opt('-u', '--unapplied', action = 'store_true',
short = 'Show the unapplied patches'),
+ opt('-s', '--stat', action = 'store_true',
+ short = 'Show a diffstat summary of the specified patches'),
] + argparse.diff_opts_option()
directory = DirectoryHasRepository(log = False)
] + argparse.diff_opts_option()
directory = DirectoryHasRepository(log = False)
# individual patches or commit ids
patches = args
# individual patches or commit ids
patches = args
- options.diff_flags.extend(color_diff_flags())
+ if not options.stat:
+ options.diff_flags.extend(color_diff_flags())
commit_ids = [git_id(crt_series, patch) for patch in patches]
commit_str = '\n'.join([git.pretty_commit(commit_id,
flags = options.diff_flags)
for commit_id in commit_ids])
commit_ids = [git_id(crt_series, patch) for patch in patches]
commit_str = '\n'.join([git.pretty_commit(commit_id,
flags = options.diff_flags)
for commit_id in commit_ids])
+ if options.stat:
+ commit_str = gitlib.diffstat(commit_str)
if commit_str:
pager(commit_str)
if commit_str:
pager(commit_str)