[PATCH 17 of 21 WIP-PY3K] obsolete: use xrange from py3kcompat

Matt Mackall mpm at selenic.com
Mon Oct 12 17:10:30 CDT 2015


On Mon, 2015-10-12 at 16:25 -0500, Matthew Turk wrote:
> # HG changeset patch
> # User Matthew Turk <matthewturk at gmail.com>
> # Date 1444684321 18000
> #      Mon Oct 12 16:12:01 2015 -0500
> # Node ID 97c6284c8ba29a8c595e3bdcbb858e91e34332d1
> # Parent  1842237016d2b252a9060941a850f54b90451b9e
> obsolete: use xrange from py3kcompat
> 
> diff -r 1842237016d2 -r 97c6284c8ba2 mercurial/obsolete.py
> --- a/mercurial/obsolete.py	Mon Oct 12 16:11:19 2015 -0500
> +++ b/mercurial/obsolete.py	Mon Oct 12 16:12:01 2015 -0500
> @@ -78,6 +78,7 @@
>      phases
>  )
>  from .i18n import _
> +from .py3kcompat import xrange

A few comments on this series.

First, please don't send 21 patches. It's bad for overall list flow
control. Aim for something more like 5.

Second, this individually importing of symbols is going quickly get to
be a headache. We should just have:

 from .compat import *  # things get ugly when you break the whole world

..and put anything we need for cross-version compatibility there. We've
already got some of this in util.py.

Third, please don't do 50 trivial conversions like xrange or cStringIO
one file per changeset. Just do them all in one go: "global: replace all
cStringIO users". 

Patch 16 has two unrelated changes. Don't do this, it's not a shortcut.
Here the second change is highly questionable, so it'd be likely to sink
the first.. if it wasn't already policy to reject such changes.

Lastly, the conversion to absolute imports should go in its own series
so it's not blocked on other concerns.

-- 
Mathematics is the supreme nostalgia of our time.



More information about the Mercurial-devel mailing list