Mercurial > hg > mercurial-source
changeset 15791:a814f8fcc65a
Use explicit integer division
Found by running the test suite with the -3 flag to show places where
we have int / int division that can be replaced with int // int.
author | Martin Geisler <mg@aragost.com> |
---|---|
date | Sun, 08 Jan 2012 18:15:54 +0100 |
parents | 52f816b40674 |
children | 7cbba3adabc7 |
files | hgext/convert/common.py mercurial/dirstate.py mercurial/httpconnection.py mercurial/posix.py mercurial/revset.py |
diffstat | 5 files changed, 10 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/convert/common.py +++ b/hgext/convert/common.py @@ -339,7 +339,7 @@ # Since ARG_MAX is for command line _and_ environment, lower our limit # (and make happy Windows shells while doing this). - return argmax / 2 - 1 + return argmax // 2 - 1 def limit_arglist(self, arglist, cmd, closestdin, *args, **kwargs): cmdlen = len(self._cmdline(cmd, closestdin, *args, **kwargs))
--- a/mercurial/dirstate.py +++ b/mercurial/dirstate.py @@ -49,7 +49,7 @@ self._rootdir = os.path.join(root, '') self._dirty = False self._dirtypl = False - self._lastnormaltime = None + self._lastnormaltime = 0 self._ui = ui @propertycache @@ -251,7 +251,7 @@ "_ignore"): if a in self.__dict__: delattr(self, a) - self._lastnormaltime = None + self._lastnormaltime = 0 self._dirty = False def copy(self, source, dest): @@ -415,7 +415,7 @@ delattr(self, "_dirs") self._copymap = {} self._pl = [nullid, nullid] - self._lastnormaltime = None + self._lastnormaltime = 0 self._dirty = True def rebuild(self, parent, files): @@ -463,7 +463,7 @@ write(f) st.write(cs.getvalue()) st.close() - self._lastnormaltime = None + self._lastnormaltime = 0 self._dirty = self._dirtypl = False def _dirignore(self, f):
--- a/mercurial/httpconnection.py +++ b/mercurial/httpconnection.py @@ -38,7 +38,7 @@ self.write = self._data.write self.length = os.fstat(self._data.fileno()).st_size self._pos = 0 - self._total = self.length / 1024 * 2 + self._total = self.length // 1024 * 2 def read(self, *args, **kwargs): try: @@ -51,7 +51,7 @@ # requires authentication. Since we can't know until we try # once whether authentication will be required, just lie to # the user and maybe the push succeeds suddenly at 50%. - self.ui.progress(_('sending'), self._pos / 1024, + self.ui.progress(_('sending'), self._pos // 1024, unit=_('kb'), total=self._total) return ret