# HG changeset patch # User Martin von Zweigbergk # Date 2020-03-25 06:31:36 # Node ID d06e748cfd020d42398331aea751753e1913ff8c # Parent c13cbc3872c8488695d29801d6dd2fb3c5c03436 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 diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -1267,7 +1267,7 @@ def changeview(state, delta, unit): 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))