From 683840616efea425300859fe838add2b6b559a2c Mon Sep 17 00:00:00 2001 Message-Id: <683840616efea425300859fe838add2b6b559a2c.1715158138.git.mdw@distorted.org.uk> From: Mark Wooding Date: Fri, 7 Dec 2007 21:16:36 +0000 Subject: [PATCH] git.pretty_commit() re-implemented with "git show" (bug #10018) Organization: Straylight/Edgeware From: Catalin Marinas This way, it honours the diff.renames etc. options. Signed-off-by: Catalin Marinas --- stgit/commands/show.py | 12 ++++++------ stgit/git.py | 7 ++----- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/stgit/commands/show.py b/stgit/commands/show.py index e4e70a5..e6814d3 100644 --- a/stgit/commands/show.py +++ b/stgit/commands/show.py @@ -39,8 +39,8 @@ options = [make_option('-b', '--branch', make_option('-u', '--unapplied', help = 'show the unapplied patches', action = 'store_true'), - make_option('-O', '--diff-opts', - help = 'options to pass to git-diff')] + make_option('-O', '--show-opts', + help = 'options to pass to "git show"')] def func(parser, options, args): @@ -64,13 +64,13 @@ def func(parser, options, args): patches = parse_patches(args, applied + unapplied +\ crt_series.get_hidden(), len(applied)) - if options.diff_opts: - diff_flags = options.diff_opts.split() + if options.show_opts: + show_flags = options.show_opts.split() else: - diff_flags = [] + show_flags = [] commit_ids = [git_id(crt_series, patch) for patch in patches] - commit_str = '\n'.join([git.pretty_commit(commit_id, diff_flags=diff_flags) + commit_str = '\n'.join([git.pretty_commit(commit_id, flags = show_flags) for commit_id in commit_ids]) if commit_str: pager(commit_str) diff --git a/stgit/git.py b/stgit/git.py index 4cc35c9..27d2595 100644 --- a/stgit/git.py +++ b/stgit/git.py @@ -815,13 +815,10 @@ def barefiles(rev1, rev2): return '\n'.join(result) -def pretty_commit(commit_id = 'HEAD', diff_flags = []): +def pretty_commit(commit_id = 'HEAD', flags = []): """Return a given commit (log + diff) """ - return GRun('diff-tree', - *(diff_flags - + ['--cc', '--always', '--pretty', '-r', commit_id]) - ).raw_output() + return GRun('show', *(flags + [commit_id])).raw_output() def checkout(files = None, tree_id = None, force = False): """Check out the given or all files -- [mdw]