Mercurial > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
44600:c13cbc3872c8 | 44601:d06e748cfd02 |
---|---|
1265 return | 1265 return |
1266 mode_state = state[b'modes'][mode] | 1266 mode_state = state[b'modes'][mode] |
1267 num_lines = len(mode_state[b'patchcontents']) | 1267 num_lines = len(mode_state[b'patchcontents']) |
1268 page_height = state[b'page_height'] | 1268 page_height = state[b'page_height'] |
1269 unit = page_height if unit == b'page' else 1 | 1269 unit = page_height if unit == b'page' else 1 |
1270 num_pages = 1 + (num_lines - 1) / page_height | 1270 num_pages = 1 + (num_lines - 1) // page_height |
1271 max_offset = (num_pages - 1) * page_height | 1271 max_offset = (num_pages - 1) * page_height |
1272 newline = mode_state[b'line_offset'] + delta * unit | 1272 newline = mode_state[b'line_offset'] + delta * unit |
1273 mode_state[b'line_offset'] = max(0, min(max_offset, newline)) | 1273 mode_state[b'line_offset'] = max(0, min(max_offset, newline)) |
1274 | 1274 |
1275 | 1275 |