]> git.ipfire.org Git - thirdparty/git.git/commitdiff
git-p4: show progress as an integer
authorJoel Holdsworth <jholdsworth@nvidia.com>
Sun, 19 Dec 2021 15:40:28 +0000 (15:40 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 20 Dec 2021 20:55:26 +0000 (12:55 -0800)
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>
Acked-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-p4.py

index 74834736fa4f22d9b7a24e59d50d280ef599bfdb..a625077b83462885e75e84e37e44c72f21f90f32 100755 (executable)
--- a/git-p4.py
+++ b/git-p4.py
@@ -3637,7 +3637,8 @@ class P4Sync(Command, P4UserMap):
             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