( )⚙ D8324 py3: use integer division in histedit

This is an archive of the discontinued Mercurial Phabricator instance.

py3: use integer division in histedit
ClosedPublic

Authored by martinvonz on Mar 25 2020, 2:42 AM.

Details

Summary

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.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

martinvonz created this revision.Mar 25 2020, 2:42 AM
marmoute requested changes to this revision.Mar 25 2020, 5:59 AM
marmoute added a subscriber: marmoute.
marmoute added inline comments.
hgext/histedit.py
193

That import is not needed unless there are other location where you intend / to return float. If this is the case, this is unrelated to the /// change and should go in an independant changesets.

This revision now requires changes to proceed.Mar 25 2020, 5:59 AM
martinvonz added inline comments.Mar 25 2020, 11:30 AM
hgext/histedit.py
193

Oops, I didn't even realize that the // operator existed in py2. I only noticed that / behaves differently on py2 and py3, so I blindly assumed that the import statement imported the // operator from the future. I've drop this line now.

This revision was not accepted when it landed; it landed in state Needs Review.
This revision was automatically updated to reflect the committed changes.