git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luke Diamand <luke@diamand.org>
To: Joel Holdsworth <jholdsworth@nvidia.com>
Cc: Git Users <git@vger.kernel.org>,
	Tzadik Vanderhoof <tzadik.vanderhoof@gmail.com>,
	Dorgon Chang <dorgonman@hotmail.com>,
	Joachim Kuebart <joachim.kuebart@gmail.com>,
	Daniel Levin <dendy.ua@gmail.com>,
	Johannes Schindelin <johannes.schindelin@gmx.de>,
	Ben Keene <seraphire@gmail.com>,
	Andrew Oakley <andrew@adoakley.name>
Subject: Re: [PATCH v2 2/2] git-p4: show progress as an integer
Date: Sat, 18 Dec 2021 10:12:11 +0000	[thread overview]
Message-ID: <CAE5ih7_uq2xos46tH_dR+gietA_5bhr3JzYNJOLmrjhuijy1Ng@mail.gmail.com> (raw)
In-Reply-To: <20211217203856.2339161-3-jholdsworth@nvidia.com>

On Fri, 17 Dec 2021 at 20:39, Joel Holdsworth <jholdsworth@nvidia.com> wrote:
>
> When importing files from Perforce, git-p4 periodically logs the
> progress of file transfers as a percentage. However, the value is
> printed as a float with an excessive number of decimal places.
>
> For example a typical update might contain the following message:
>
> Importing revision 12345 (26.199617677553135%)
>
> This patch simply rounds the value down to the nearest integer
> percentage value, greatly improving readability.
>
> Signed-off-by: Joel Holdsworth <jholdsworth@nvidia.com>
> ---
>  git-p4.py | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/git-p4.py b/git-p4.py
> index 4d8a249b85..3c621a6efd 100755
> --- a/git-p4.py
> +++ b/git-p4.py
> @@ -3635,7 +3635,8 @@ def importChanges(self, changes, origin_revision=0):
>              self.updateOptionDict(description)
>
>              if not self.silent:
> -                sys.stdout.write("\rImporting revision %s (%s%%)" % (change, cnt * 100 / len(changes)))
> +                sys.stdout.write("\rImporting revision %s (%d%%)" % (
> +                    change, (cnt * 100) // len(changes)))
>                  sys.stdout.flush()
>              cnt = cnt + 1

Thanks for fixing this - this is one of those small python2->python3
bugs that's still left over.

Looks good to me, ack.

Luke

  reply	other threads:[~2021-12-18 10:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-17 20:38 [PATCH v2 0/2] git-p4: improve formatting of numeric values Joel Holdsworth
2021-12-17 20:38 ` [PATCH v2 1/2] git-p4: print size values in appropriate units Joel Holdsworth
2021-12-18  7:44   ` Joachim Kuebart
2021-12-18 10:09     ` Luke Diamand
2021-12-17 20:38 ` [PATCH v2 2/2] git-p4: show progress as an integer Joel Holdsworth
2021-12-18 10:12   ` Luke Diamand [this message]
2021-12-20 20:02     ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAE5ih7_uq2xos46tH_dR+gietA_5bhr3JzYNJOLmrjhuijy1Ng@mail.gmail.com \
    --to=luke@diamand.org \
    --cc=andrew@adoakley.name \
    --cc=dendy.ua@gmail.com \
    --cc=dorgonman@hotmail.com \
    --cc=git@vger.kernel.org \
    --cc=jholdsworth@nvidia.com \
    --cc=joachim.kuebart@gmail.com \
    --cc=johannes.schindelin@gmx.de \
    --cc=seraphire@gmail.com \
    --cc=tzadik.vanderhoof@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).