Mercurial > hg
diff hgext/histedit.py @ 44601: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 | ad5a10f49dfa |
children | e147748f750b |
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))