changeset 9029:0001e49f1c11

compat: use // for integer division
author Alejandro Santos <alejolp@alejolp.com>
date Sun, 05 Jul 2009 11:00:44 +0200
parents bea567ae3ff6
children 3f56055ff1d7
files mercurial/patch.py mercurial/pure/base85.py mercurial/revlog.py mercurial/templatefilters.py mercurial/util.py
diffstat 5 files changed, 10 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/patch.py	Sun Jul 05 10:59:54 2009 +0200
+++ b/mercurial/patch.py	Sun Jul 05 11:00:44 2009 +0200
@@ -1422,8 +1422,8 @@
         # If diffstat runs out of room it doesn't print anything, which
         # isn't very useful, so always print at least one + or - if there
         # were at least some changes
-        pluses = '+' * max(adds/factor, int(bool(adds)))
-        minuses = '-' * max(removes/factor, int(bool(removes)))
+        pluses = '+' * max(adds // factor, int(bool(adds)))
+        minuses = '-' * max(removes // factor, int(bool(removes)))
         output.append(' %-*s |  %*.d %s%s\n' % (maxname, filename, countwidth,
                                                 adds+removes, pluses, minuses))
 
--- a/mercurial/pure/base85.py	Sun Jul 05 10:59:54 2009 +0200
+++ b/mercurial/pure/base85.py	Sun Jul 05 11:00:44 2009 +0200
@@ -25,8 +25,8 @@
     longs = len(text) >> 2
     words = struct.unpack('>%dL' % (longs), text)
 
-    out = ''.join(_b85chars[(word / 52200625) % 85] +
-                  _b85chars2[(word / 7225) % 7225] +
+    out = ''.join(_b85chars[(word // 52200625) % 85] +
+                  _b85chars2[(word // 7225) % 7225] +
                   _b85chars2[word % 7225]
                   for word in words)
 
@@ -37,7 +37,7 @@
     olen = l % 4
     if olen:
         olen += 1
-    olen += l / 4 * 5
+    olen += l // 4 * 5
     return out[:olen]
 
 def b85decode(text):
--- a/mercurial/revlog.py	Sun Jul 05 10:59:54 2009 +0200
+++ b/mercurial/revlog.py	Sun Jul 05 11:00:44 2009 +0200
@@ -879,7 +879,7 @@
         if len(id) < 40:
             try:
                 # hex(node)[:...]
-                l = len(id) / 2  # grab an even number of digits
+                l = len(id) // 2  # grab an even number of digits
                 bin_id = bin(id[:l*2])
                 nl = [n for n in self.nodemap if n[:l] == bin_id]
                 nl = [n for n in nl if hex(n).startswith(id)]
@@ -1354,7 +1354,7 @@
             f.seek(0, 2)
             actual = f.tell()
             s = self._io.size
-            i = max(0, actual / s)
+            i = max(0, actual // s)
             di = actual - (i * s)
             if self._inline:
                 databytes = 0
--- a/mercurial/templatefilters.py	Sun Jul 05 10:59:54 2009 +0200
+++ b/mercurial/templatefilters.py	Sun Jul 05 11:00:44 2009 +0200
@@ -41,7 +41,7 @@
 
     delta = max(1, int(now - then))
     for t, s in agescales:
-        n = delta / s
+        n = delta // s
         if n >= 2 or s == 1:
             return fmt(t, n)
 
--- a/mercurial/util.py	Sun Jul 05 10:59:54 2009 +0200
+++ b/mercurial/util.py	Sun Jul 05 11:00:44 2009 +0200
@@ -937,8 +937,8 @@
     t, tz = date or makedate()
     if "%1" in format or "%2" in format:
         sign = (tz > 0) and "-" or "+"
-        minutes = abs(tz) / 60
-        format = format.replace("%1", "%c%02d" % (sign, minutes / 60))
+        minutes = abs(tz) // 60
+        format = format.replace("%1", "%c%02d" % (sign, minutes // 60))
         format = format.replace("%2", "%02d" % (minutes % 60))
     s = time.strftime(format, time.gmtime(float(t) - tz))
     return s