Mercurial > hg-stable
changeset 44608:d06e748cfd02
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
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Tue, 24 Mar 2020 23:31:36 -0700 |
parents | c13cbc3872c8 |
children | a89aa2d7b34d |
files | hgext/histedit.py |
diffstat | 1 files changed, 1 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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))