changeset 107:8c83d2021b03

more pythonic way to calculate the magnitude
author Sverre Rabbelier <sverre@rabbelier.nl>
date Sun, 10 May 2009 11:04:12 -0700
parents 3aa2f6caed16
children f2ce096c4884
files git_handler.py
diffstat 1 files changed, 1 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/git_handler.py	Sun May 10 10:42:44 2009 -0700
+++ b/git_handler.py	Sun May 10 11:04:12 2009 -0700
@@ -161,9 +161,7 @@
     def export_git_objects(self):
         self.ui.status(_("exporting git objects\n"))
         total = len(self.repo.changelog)
-        magnitude = 1
-        if total > 0:
-            magnitude = int(math.log(total, 10)) + 1
+        magnitude = int(math.log(total, 10)) + 1 if total else 1
         for i, rev in enumerate(self.repo.changelog):
             if i%100 == 0:
                 self.ui.status(_("at: %*d/%d\n") % (magnitude, i, total))