Re: [PATCH v2 2/2] git-p4: show progress as an integer
- From
Luke Diamand <luke@diamand.org>
- Date
- Dec 18, 2021, 10:12 UTC
- Message-ID
- <CAE5ih7_uq2xos46tH_dR+gietA_5bhr3JzYNJOLmrjhuijy1Ng@mail.gmail.com>
- In-Reply-To
- <20211217203856.2339161-3-jholdsworth@nvidia.com>
On Fri, 17 Dec 2021 at 20:39, Joel Holdsworth <jholdsworth@nvidia.com> wrote:
Show 30 quoted lines
>
> 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 + 1Thanks for fixing this - this is one of those small python2->python3 bugs that's still left over.
Looks good to me, ack.
Luke