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

RE: [PATCH 1/2] format-patch: have progress option while generating patches

From
KWKevin Willford <kewillf@microsoft.com>
Date
May 31, 2017, 19:31 UTC
Message-ID
<SN2PR03MB23337CC1D9BBB4DF5923D9CBB7F10@SN2PR03MB2333.namprd03.prod.outlook.com>
In-Reply-To
<CAGZ79kYVN4JHq273-AWhpFVbOQR=qU6AfPT8O16N+9siacXvqA@mail.gmail.com>
Show 34 quoted lines
> -----Original Message-----
> From: git-owner@vger.kernel.org [mailto:git-owner@vger.kernel.org] On
> Behalf Of Stefan Beller
> Sent: Wednesday, May 31, 2017 12:40 PM
> To: Kevin Willford <kcwillford@gmail.com>
> Cc: git@vger.kernel.org; Junio C Hamano <gitster@pobox.com>; Kevin
> Willford <kewillf@microsoft.com>
> Subject: Re: [PATCH 1/2] format-patch: have progress option while
> generating patches
> 
> On Wed, May 31, 2017 at 8:04 AM, Kevin Willford <kcwillford@gmail.com>
> wrote:
> > When generating patches for the rebase command if the user does not
> > realize the branch they are rebasing onto is thousands of commits
> > different there is no progress indication after initial rewinding
> > message.
> >
> > This patch allows a progress option to be passed to format-patch so
> > that the user can be informed the progress of generating the patch.
> > This option will then be used by the rebase command when calling
> > format-patch.
> 
> After reading the code, I was looking for some explanation on the underlying
> assumptions, such as:
> 
>   The progress meter as presented in this patch assumes the thousands of
>   patches to have a fine granularity as well as assuming to require all the
>   same amount of work/time for each, such that a steady progress bar
>   is achieved.
> 
>   We do not want to estimate the time for each patch based e.g.
>   on their size or number of touched files (or parents) as that is too
>   expensive for just a progress meter.
> 
Sounds good.  I will add some explanation to the commit message.
Show 104 quoted lines
> 
> >
> > Signed-off-by: Kevin Willford <kewillf@microsoft.com>
> > ---
> >  Documentation/git-format-patch.txt |  8 ++++++++
> >  builtin/log.c                      | 10 ++++++++++
> >  2 files changed, 18 insertions(+)
> >
> > diff --git a/Documentation/git-format-patch.txt
> > b/Documentation/git-format-patch.txt
> > index c890328b02..ee5f99f606 100644
> > --- a/Documentation/git-format-patch.txt
> > +++ b/Documentation/git-format-patch.txt
> > @@ -23,6 +23,7 @@ SYNOPSIS
> >                    [(--reroll-count|-v) <n>]
> >                    [--to=<email>] [--cc=<email>]
> >                    [--[no-]cover-letter] [--quiet] [--notes[=<ref>]]
> > +                  [--progress]
> >                    [<common diff options>]
> >                    [ <since> | <revision range> ]
> >
> > @@ -260,6 +261,7 @@ you can use `--suffix=-patch` to get `0001-
> description-of-my-change-patch`.
> >  -q::
> >  --quiet::
> >         Do not print the names of the generated files to standard output.
> > +       Progress is not reported to the standard error stream.
> >
> >  --no-binary::
> >         Do not output contents of changes in binary files, instead @@
> > -283,6 +285,12 @@ you can use `--suffix=-patch` to get `0001-description-
> of-my-change-patch`.
> >         range are always formatted as creation patches, independently
> >         of this flag.
> >
> > +--progress::
> > +       Progress status is reported on the standard error stream
> > +       by default when it is attached to a terminal, unless -q
> > +       is specified. This flag forces progress status even if the
> > +       standard error stream is not directed to a terminal.
> > +
> >  CONFIGURATION
> >  -------------
> >  You can specify extra mail header lines to be added to each message,
> > diff --git a/builtin/log.c b/builtin/log.c index
> > 631fbc984f..02c50431b6 100644
> > --- a/builtin/log.c
> > +++ b/builtin/log.c
> > @@ -26,6 +26,7 @@
> >  #include "version.h"
> >  #include "mailmap.h"
> >  #include "gpg-interface.h"
> > +#include "progress.h"
> >
> >  /* Set a default date-time format for git log ("log.date" config
> > variable) */  static const char *default_date_mode = NULL; @@ -1409,6
> > +1410,8 @@ int cmd_format_patch(int argc, const char **argv, const char
> *prefix)
> >         char *branch_name = NULL;
> >         char *base_commit = NULL;
> >         struct base_tree_info bases;
> > +       int show_progress = 0;
> > +       struct progress *progress = NULL;
> >
> >         const struct option builtin_format_patch_options[] = {
> >                 { OPTION_CALLBACK, 'n', "numbered", &numbered, NULL,
> > @@ -1480,6 +1483,8 @@ int cmd_format_patch(int argc, const char **argv,
> const char *prefix)
> >                 OPT_FILENAME(0, "signature-file", &signature_file,
> >                                 N_("add a signature from a file")),
> >                 OPT__QUIET(&quiet, N_("don't print the patch
> > filenames")),
> > +               OPT_BOOL(0, "progress", &show_progress,
> > +                        N_("show progress")),
> >                 OPT_END()
> >         };
> >
> > @@ -1739,8 +1744,12 @@ int cmd_format_patch(int argc, const char
> **argv, const char *prefix)
> >                 start_number--;
> >         }
> >         rev.add_signoff = do_signoff;
> > +
> > +       if (show_progress && !quiet)
> > +               progress = start_progress(_("Generating patch"),
> > + total);
> >         while (0 <= --nr) {
> >                 int shown;
> > +               display_progress(progress, total - nr);
> >                 commit = list[nr];
> >                 rev.nr = total - nr + (start_number - 1);
> >                 /* Make the second and subsequent mails replies to the
> > first */ @@ -1805,6 +1814,7 @@ int cmd_format_patch(int argc, const char
> **argv, const char *prefix)
> >                 if (!use_stdout)
> >                         fclose(rev.diffopt.file);
> >         }
> > +       stop_progress(&progress);
> >         free(list);
> >         free(branch_name);
> >         string_list_clear(&extra_to, 0);
> > --
> > 2.13.0.92.g73a4ce6a77
> >
Previous: Stefan BellerNext: Jeff King
Message 4 of 34 in “Add progress to format-patch and rebase”
  1. 0/2 Add progress to format-patch and rebaseKevin Willford, May 31, 2017
  2. 1/2 format-patch: have progress option while generating patchesKevin Willford, May 31, 2017
  3. Stefan BellerMay 31, 2017
  4. Kevin WillfordMay 31, 2017
  5. Jeff KingMay 31, 2017
  6. Junio C HamanoJun 1, 2017
  7. Johannes SchindelinJun 1, 2017
  8. Jeff KingJun 1, 2017
  9. 2/2 rebase: turn on progress option by default for format-patchKevin Willford, May 31, 2017
  10. Stefan BellerMay 31, 2017
  11. Kevin WillfordMay 31, 2017
  12. Stefan BellerMay 31, 2017
  13. Johannes SchindelinJun 1, 2017
  14. Jeff KingMay 31, 2017
  15. Junio C HamanoJun 3, 2017
  16. 0/2 Add progress for format-patch and rebaseKevin Willford, Aug 10, 2017
  17. 2/2 rebase: turn on progress option by default for format-patchKevin Willford, Aug 10, 2017
  18. Junio C HamanoAug 11, 2017
  19. 1/2 format-patch: have progress option while generating patchesKevin Willford, Aug 10, 2017
  20. Jeff KingAug 10, 2017
  21. Junio C HamanoAug 11, 2017
  22. Philip OakleyAug 12, 2017
  23. Jeff KingAug 13, 2017
  24. Junio C HamanoAug 14, 2017
  25. Junio C HamanoAug 14, 2017
  26. Jeff KingAug 14, 2017
  27. Junio C HamanoAug 14, 2017
  28. Jeff KingAug 14, 2017
  29. Junio C HamanoAug 14, 2017
  30. progress: simplify "delayed" progress APIJunio C Hamano, Aug 19, 2017
  31. Junio C HamanoAug 19, 2017
  32. Jeff KingAug 20, 2017
  33. Junio C HamanoAug 10, 2017
  34. Jeff KingAug 10, 2017

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.