Skip to content

Commit 0f82962

Browse files
jholgitster
authored andcommitted
git-p4: show progress as an integer
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 <[email protected]> Acked-by: Luke Diamand <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ae9b950 commit 0f82962

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

git-p4.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3637,7 +3637,8 @@ def importChanges(self, changes, origin_revision=0):
36373637
self.updateOptionDict(description)
36383638

36393639
if not self.silent:
3640-
sys.stdout.write("\rImporting revision %s (%s%%)" % (change, cnt * 100 / len(changes)))
3640+
sys.stdout.write("\rImporting revision %s (%d%%)" % (
3641+
change, (cnt * 100) // len(changes)))
36413642
sys.stdout.flush()
36423643
cnt = cnt + 1
36433644

0 commit comments

Comments
 (0)