git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [StGit PATCH] teach --summary to stg show

From
ACAlex Chiang <achiang@hp.com>
Date
Jul 10, 2009, 18:56 UTC
Message-ID
<20090710185629.GA19324@ldl.fc.hp.com>
In-Reply-To
<b0943d9e0907100311n26af2e86j95cae2200298ff68@mail.gmail.com>
* Catalin Marinas <catalin.marinas@gmail.com>:
> Hi Alex,
> 
> Sorry for the loooong delay.
No problem.
Show 14 quoted lines
> 2009/6/19 Alex Chiang <achiang@hp.com>:
> > Add -s/--summary option to stg show, which will generate a nice
> > diffstat, similar to what you get in a cover mail if you specify
> > %(diffstat)s.
> 
> I would use --stat for consistency with the diff command.
> 
> > +        commit_str = gitlib.diffstat(git.diff(
> > +                                rev1 = git_id(crt_series, '%s^' % patches[0]),
> > +                                rev2 = git_id(crt_series, '%s' % patches[-1])))
> 
> This works only of the shown patches are consecutive. If you specify
> random patches, the diffstat isn't correct. I propose this form of the
> patch:
Looks much nicer than mine, thanks.
Tested-by: Alex Chiang <achiang@hp.com>
[how about that other patch "fix stg mail %(shortlog)s order"? :) ]
/ac
Show 41 quoted lines
> diff --git a/stgit/commands/show.py b/stgit/commands/show.py
> index b7a8aa9..45c3a56 100644
> --- a/stgit/commands/show.py
> +++ b/stgit/commands/show.py
> @@ -20,6 +20,7 @@ from pydoc import pager
>  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'
> @@ -38,6 +39,8 @@ options = [
>          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)
> @@ -61,10 +64,13 @@ def func(parser, options, 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])
> +    if options.stat:
> +        commit_str = gitlib.diffstat(commit_str)
>      if commit_str:
>          pager(commit_str)
> 
> 
> -- 
> Catalin
> 
Previous: Catalin MarinasNext: Catalin Marinas
Message 3 of 4 in “teach --summary to stg show”
  1. teach --summary to stg showAlex Chiang, Jun 19, 2009
  2. Catalin MarinasJul 10, 2009
  3. Alex ChiangJul 10, 2009
  4. Catalin MarinasJul 10, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.