py3: use integer division in histedit
authorMartin von Zweigbergk <martinvonz@google.com>
Tue, 24 Mar 2020 23:31:36 -0700
changeset 44601 d06e748cfd02
parent 44600 c13cbc3872c8
child 44602 a89aa2d7b34d
py3: use integer division in histedit Histedit uses the `/` operator, which does type conversion to float in Python 3 instead of integer division likeon Python 2. Let's preserve the Python 2 behavior by importing and using the `//` operator. Differential Revision: https://phab.mercurial-scm.org/D8324
hgext/histedit.py
--- a/hgext/histedit.py	Wed Mar 25 10:06:32 2020 +0100
+++ b/hgext/histedit.py	Tue Mar 24 23:31:36 2020 -0700
@@ -1267,7 +1267,7 @@
     num_lines = len(mode_state[b'patchcontents'])
     page_height = state[b'page_height']
     unit = page_height if unit == b'page' else 1
-    num_pages = 1 + (num_lines - 1) / page_height
+    num_pages = 1 + (num_lines - 1) // page_height
     max_offset = (num_pages - 1) * page_height
     newline = mode_state[b'line_offset'] + delta * unit
     mode_state[b'line_offset'] = max(0, min(max_offset, newline))