Patchwork [6,of,8,v2] i18n: python3 handle ugettext + unicode

login
register
mail settings
Submitter timeless@mozdev.org
Date March 30, 2016, 4:33 a.m.
Message ID <d90f8d4c6cbaa4046a2b.1459312401@waste.org>
Download mbox | patch
Permalink /patch/14166/
State Accepted
Headers show

Comments

timeless@mozdev.org - March 30, 2016, 4:33 a.m.
# HG changeset patch
# User timeless <timeless@mozdev.org>
# Date 1459272128 0
#      Tue Mar 29 17:22:08 2016 +0000
# Node ID d90f8d4c6cbaa4046a2b3a242010defefd24dc25
# Parent  1f99c982266f5a3f2d78734ccab2c7ac993a3e6d
i18n: python3 handle ugettext + unicode
Gregory Szorc - March 30, 2016, 6:37 a.m.
On Tue, Mar 29, 2016 at 9:33 PM, timeless <timeless@mozdev.org> wrote:

> # HG changeset patch
> # User timeless <timeless@mozdev.org>
> # Date 1459272128 0
> #      Tue Mar 29 17:22:08 2016 +0000
> # Node ID d90f8d4c6cbaa4046a2b3a242010defefd24dc25
> # Parent  1f99c982266f5a3f2d78734ccab2c7ac993a3e6d
> i18n: python3 handle ugettext + unicode
>
> diff --git a/mercurial/i18n.py b/mercurial/i18n.py
> --- a/mercurial/i18n.py
> +++ b/mercurial/i18n.py
> @@ -20,6 +20,10 @@
>  else:
>      module = __file__
>
> +try:
> +    unicode
> +except NameError:
> +    unicode = str
>

The common convention is to assign vars like "str_type" or "bytes_type" to
denote between these, as "str" and "unicode" are special/reserved types. I
could see this causing confusion down the road. But it's probably OK for
now.


>
>  _languages = None
>  if (os.name == 'nt'
> @@ -45,7 +49,10 @@
>      localedir = os.path.join(datapath, 'locale')
>      t = gettextmod.translation('hg', localedir, _languages, fallback=True)
>      global _ugettext
> -    _ugettext = t.ugettext
> +    try:
> +        _ugettext = t.ugettext
> +    except AttributeError:
> +        _ugettext = t.gettext
>
>  _msgcache = {}
>
> diff --git a/tests/test-check-py3-compat.t b/tests/test-check-py3-compat.t
> --- a/tests/test-check-py3-compat.t
> +++ b/tests/test-check-py3-compat.t
> @@ -123,94 +123,88 @@
>    contrib/check-code.py: invalid syntax: (unicode error) 'unicodeescape'
> codec can't decode bytes in position *-*: malformed \N character escape
> (<unknown>, line *) (glob)
>    contrib/import-checker.py: invalid syntax: Missing parentheses in call
> to 'print' (<unknown>, line *) (glob)
>    doc/hgmanpage.py: invalid syntax: invalid syntax (<unknown>, line *)
> (glob)
> -  hgext/acl.py: error importing: <AttributeError> 'NullTranslations'
> object has no attribute 'ugettext' (error at i18n.py:*) (glob)
>    hgext/automv.py: error importing module: <SyntaxError> invalid syntax
> (commands.py, line *) (line *) (glob)
> -  hgext/blackbox.py: error importing: <AttributeError> 'NullTranslations'
> object has no attribute 'ugettext' (error at i18n.py:*) (glob)
> +  hgext/blackbox.py: error importing: <NameError> name 'xrange' is not
> defined (error at revset.py:*) (glob)
>    hgext/bugzilla.py: error importing module: <ImportError> No module
> named 'urlparse' (line *) (glob)
> -  hgext/censor.py: error importing: <AttributeError> 'NullTranslations'
> object has no attribute 'ugettext' (error at i18n.py:*) (glob)
> +  hgext/censor.py: error importing: <NameError> name 'xrange' is not
> defined (error at revset.py:*) (glob)
>    hgext/chgserver.py: error importing module: <ImportError> No module
> named 'SocketServer' (line *) (glob)
> -  hgext/children.py: error importing: <AttributeError> 'NullTranslations'
> object has no attribute 'ugettext' (error at i18n.py:*) (glob)
> -  hgext/churn.py: error importing: <AttributeError> 'NullTranslations'
> object has no attribute 'ugettext' (error at i18n.py:*) (glob)
> -  hgext/clonebundles.py: error importing: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*)
> (glob)
> +  hgext/children.py: error importing: <NameError> name 'xrange' is not
> defined (error at revset.py:*) (glob)
> +  hgext/churn.py: error importing: <NameError> name 'xrange' is not
> defined (error at revset.py:*) (glob)
> +  hgext/clonebundles.py: error importing: <NameError> name 'xrange' is
> not defined (error at revset.py:*) (glob)
>    hgext/color.py: invalid syntax: invalid syntax (<unknown>, line *)
> (glob)
>    hgext/convert/bzr.py: error importing module: <SystemError> Parent
> module 'hgext.convert' not loaded, cannot perform relative import (line *)
> (glob)
>    hgext/convert/common.py: error importing module: <ImportError> No
> module named 'cPickle' (line *) (glob)
> -  hgext/convert/convcmd.py: error importing: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*)
> (glob)
> -  hgext/convert/cvs.py: error importing: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*)
> (glob)
> +  hgext/convert/convcmd.py: error importing: <SyntaxError> invalid syntax
> (bundle*.py, line *) (error at bundlerepo.py:*) (glob)
> +  hgext/convert/cvs.py: error importing module: <SystemError> Parent
> module 'hgext.convert' not loaded, cannot perform relative import (line *)
> (glob)
>    hgext/convert/cvsps.py: error importing module: <ImportError> No module
> named 'cPickle' (line *) (glob)
> -  hgext/convert/darcs.py: error importing: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*)
> (glob)
> +  hgext/convert/darcs.py: error importing module: <SystemError> Parent
> module 'hgext.convert' not loaded, cannot perform relative import (line *)
> (glob)
>    hgext/convert/filemap.py: error importing module: <SystemError> Parent
> module 'hgext.convert' not loaded, cannot perform relative import (line *)
> (glob)
> -  hgext/convert/git.py: error importing: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*)
> (glob)
> -  hgext/convert/gnuarch.py: error importing: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*)
> (glob)
> -  hgext/convert/hg.py: error importing: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*)
> (glob)
> -  hgext/convert/monotone.py: error importing: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*)
> (glob)
> -  hgext/convert/p*.py: error importing: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*)
> (glob)
> +  hgext/convert/git.py: error importing module: <SystemError> Parent
> module 'hgext.convert' not loaded, cannot perform relative import (line *)
> (glob)
> +  hgext/convert/gnuarch.py: error importing module: <SystemError> Parent
> module 'hgext.convert' not loaded, cannot perform relative import (line *)
> (glob)
> +  hgext/convert/hg.py: error importing: <NameError> name 'xrange' is not
> defined (error at revset.py:*) (glob)
> +  hgext/convert/monotone.py: error importing module: <SystemError> Parent
> module 'hgext.convert' not loaded, cannot perform relative import (line *)
> (glob)
> +  hgext/convert/p*.py: error importing module: <SystemError> Parent
> module 'hgext.convert' not loaded, cannot perform relative import (line *)
> (glob)
>    hgext/convert/subversion.py: error importing module: <ImportError> No
> module named 'cPickle' (line *) (glob)
>    hgext/convert/transport.py: error importing module: <ImportError> No
> module named 'svn.client' (line *) (glob)
> -  hgext/eol.py: error importing: <AttributeError> 'NullTranslations'
> object has no attribute 'ugettext' (error at i18n.py:*) (glob)
> -  hgext/extdiff.py: error importing: <AttributeError> 'NullTranslations'
> object has no attribute 'ugettext' (error at i18n.py:*) (glob)
> +  hgext/eol.py: error importing: <NameError> name 'xrange' is not defined
> (error at revset.py:*) (glob)
> +  hgext/extdiff.py: error importing: <NameError> name 'xrange' is not
> defined (error at revset.py:*) (glob)
>    hgext/factotum.py: error importing: <ImportError> No module named
> 'httplib' (error at url.py:*) (glob)
>    hgext/fetch.py: error importing module: <SyntaxError> invalid syntax
> (commands.py, line *) (line *) (glob)
> -  hgext/fsmonitor/state.py: error importing: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*)
> (glob)
> -  hgext/fsmonitor/watchmanclient.py: error importing: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*)
> (glob)
> -  hgext/gpg.py: error importing: <AttributeError> 'NullTranslations'
> object has no attribute 'ugettext' (error at i18n.py:*) (glob)
> -  hgext/graphlog.py: error importing: <AttributeError> 'NullTranslations'
> object has no attribute 'ugettext' (error at i18n.py:*) (glob)
> -  hgext/hgcia.py: error importing: <AttributeError> 'NullTranslations'
> object has no attribute 'ugettext' (error at i18n.py:*) (glob)
> -  hgext/hgk.py: error importing: <AttributeError> 'NullTranslations'
> object has no attribute 'ugettext' (error at i18n.py:*) (glob)
> -  hgext/highlight/highlight.py: error importing: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*)
> (glob)
> +  hgext/fsmonitor/watchmanclient.py: error importing module:
> <SystemError> Parent module 'hgext.fsmonitor' not loaded, cannot perform
> relative import (line *) (glob)
> +  hgext/gpg.py: error importing module: <SyntaxError> invalid syntax
> (commands.py, line *) (line *) (glob)
> +  hgext/graphlog.py: error importing: <NameError> name 'xrange' is not
> defined (error at revset.py:*) (glob)
> +  hgext/hgcia.py: error importing: <NameError> name 'xrange' is not
> defined (error at revset.py:*) (glob)
> +  hgext/hgk.py: error importing: <NameError> name 'xrange' is not defined
> (error at revset.py:*) (glob)
> +  hgext/highlight/highlight.py: error importing module: <ImportError> No
> module named 'pygments' (line *) (glob)
>    hgext/histedit.py: error importing module: <SyntaxError> invalid syntax
> (bundle*.py, line *) (line *) (glob)
> -  hgext/keyword.py: error importing: <AttributeError> 'NullTranslations'
> object has no attribute 'ugettext' (error at i18n.py:*) (glob)
> -  hgext/largefiles/basestore.py: error importing: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*)
> (glob)
> -  hgext/largefiles/lfcommands.py: error importing: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*)
> (glob)
> -  hgext/largefiles/lfutil.py: error importing: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*)
> (glob)
> +  hgext/keyword.py: error importing: <ImportError> No module named
> 'BaseHTTPServer' (error at common.py:*) (glob)
> +  hgext/largefiles/basestore.py: error importing: <SyntaxError> invalid
> syntax (bundle*.py, line *) (error at bundlerepo.py:*) (glob)
> +  hgext/largefiles/lfcommands.py: error importing: <SyntaxError> invalid
> syntax (bundle*.py, line *) (error at bundlerepo.py:*) (glob)
> +  hgext/largefiles/lfutil.py: error importing: <NameError> name 'xrange'
> is not defined (error at revset.py:*) (glob)
>    hgext/largefiles/localstore.py: error importing module: <ImportError>
> No module named 'lfutil' (line *) (glob)
> -  hgext/largefiles/overrides.py: error importing: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*)
> (glob)
> +  hgext/largefiles/overrides.py: error importing: <SyntaxError> invalid
> syntax (bundle*.py, line *) (error at bundlerepo.py:*) (glob)
>    hgext/largefiles/proto.py: error importing: <ImportError> No module
> named 'httplib' (error at httppeer.py:*) (glob)
> -  hgext/largefiles/remotestore.py: error importing: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*)
> (glob)
> -  hgext/largefiles/reposetup.py: error importing: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*)
> (glob)
> +  hgext/largefiles/remotestore.py: error importing: <SyntaxError> invalid
> syntax (bundle*.py, line *) (error at wireproto.py:*) (glob)
> +  hgext/largefiles/reposetup.py: error importing: <NameError> name
> 'xrange' is not defined (error at revset.py:*) (glob)
>    hgext/largefiles/uisetup.py: error importing module: <SyntaxError>
> invalid syntax (archival.py, line *) (line *) (glob)
>    hgext/largefiles/wirestore.py: error importing module: <ImportError> No
> module named 'lfutil' (line *) (glob)
> -  hgext/mq.py: error importing: <AttributeError> 'NullTranslations'
> object has no attribute 'ugettext' (error at i18n.py:*) (glob)
> -  hgext/notify.py: error importing: <AttributeError> 'NullTranslations'
> object has no attribute 'ugettext' (error at i18n.py:*) (glob)
> -  hgext/pager.py: error importing: <AttributeError> 'NullTranslations'
> object has no attribute 'ugettext' (error at i18n.py:*) (glob)
> -  hgext/patchbomb.py: error importing: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*)
> (glob)
> -  hgext/purge.py: error importing: <AttributeError> 'NullTranslations'
> object has no attribute 'ugettext' (error at i18n.py:*) (glob)
> -  hgext/rebase.py: error importing: <AttributeError> 'NullTranslations'
> object has no attribute 'ugettext' (error at i18n.py:*) (glob)
> -  hgext/record.py: error importing: <AttributeError> 'NullTranslations'
> object has no attribute 'ugettext' (error at i18n.py:*) (glob)
> -  hgext/relink.py: error importing: <AttributeError> 'NullTranslations'
> object has no attribute 'ugettext' (error at i18n.py:*) (glob)
> -  hgext/schemes.py: error importing: <AttributeError> 'NullTranslations'
> object has no attribute 'ugettext' (error at i18n.py:*) (glob)
> -  hgext/share.py: error importing: <AttributeError> 'NullTranslations'
> object has no attribute 'ugettext' (error at i18n.py:*) (glob)
> +  hgext/mq.py: error importing module: <SyntaxError> invalid syntax
> (commands.py, line *) (line *) (glob)
> +  hgext/notify.py: error importing: <NameError> name 'xrange' is not
> defined (error at revset.py:*) (glob)
> +  hgext/pager.py: error importing: <NameError> name 'xrange' is not
> defined (error at revset.py:*) (glob)
> +  hgext/patchbomb.py: error importing: <NameError> name 'xrange' is not
> defined (error at revset.py:*) (glob)
> +  hgext/purge.py: error importing: <NameError> name 'xrange' is not
> defined (error at revset.py:*) (glob)
> +  hgext/rebase.py: error importing: <SyntaxError> invalid syntax
> (bundle*.py, line *) (error at bundlerepo.py:*) (glob)
> +  hgext/record.py: error importing: <NameError> name 'xrange' is not
> defined (error at revset.py:*) (glob)
> +  hgext/relink.py: error importing: <NameError> name 'xrange' is not
> defined (error at revset.py:*) (glob)
> +  hgext/schemes.py: error importing: <NameError> name 'xrange' is not
> defined (error at revset.py:*) (glob)
> +  hgext/share.py: error importing: <NameError> name 'xrange' is not
> defined (error at revset.py:*) (glob)
>    hgext/shelve.py: error importing module: <SyntaxError> invalid syntax
> (bundle*.py, line *) (line *) (glob)
> -  hgext/strip.py: error importing: <AttributeError> 'NullTranslations'
> object has no attribute 'ugettext' (error at i18n.py:*) (glob)
> +  hgext/strip.py: error importing: <NameError> name 'xrange' is not
> defined (error at revset.py:*) (glob)
>    hgext/transplant.py: error importing: <SyntaxError> invalid syntax
> (bundle*.py, line *) (error at bundlerepo.py:*) (glob)
> -  hgext/win*text.py: error importing: <AttributeError> 'NullTranslations'
> object has no attribute 'ugettext' (error at i18n.py:*) (glob)
>    mercurial/archival.py: invalid syntax: invalid syntax (<unknown>, line
> *) (glob)
> -  mercurial/bookmarks.py: error importing: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*)
> (glob)
> -  mercurial/branchmap.py: error importing: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*)
> (glob)
> +  mercurial/branchmap.py: error importing: <NameError> name 'xrange' is
> not defined (error at revset.py:*) (glob)
>    mercurial/bundle*.py: invalid syntax: invalid syntax (<unknown>, line
> *) (glob)
>    mercurial/bundlerepo.py: error importing module: <SyntaxError> invalid
> syntax (bundle*.py, line *) (line *) (glob)
> -  mercurial/changegroup.py: error importing: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*)
> (glob)
> -  mercurial/changelog.py: error importing: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*)
> (glob)
> -  mercurial/cmdutil.py: error importing: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*)
> (glob)
> +  mercurial/changegroup.py: error importing: <NameError> name 'xrange' is
> not defined (error at revset.py:*) (glob)
> +  mercurial/changelog.py: error importing: <NameError> name 'xrange' is
> not defined (error at revset.py:*) (glob)
> +  mercurial/cmdutil.py: error importing: <NameError> name 'xrange' is not
> defined (error at revset.py:*) (glob)
>    mercurial/commands.py: invalid syntax: invalid syntax (<unknown>, line
> *) (glob)
>    mercurial/commandserver.py: error importing module: <ImportError> No
> module named 'SocketServer' (line *) (glob)
> -  mercurial/config.py: error importing: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*)
> (glob)
> -  mercurial/context.py: error importing: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*)
> (glob)
> -  mercurial/copies.py: error importing: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*)
> (glob)
> -  mercurial/crecord.py: error importing: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*)
> (glob)
> -  mercurial/destutil.py: error importing: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*)
> (glob)
> -  mercurial/dirstate.py: error importing: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*)
> (glob)
> -  mercurial/discovery.py: error importing: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*)
> (glob)
> -  mercurial/dispatch.py: error importing: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*)
> (glob)
> -  mercurial/exchange.py: error importing: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*)
> (glob)
> -  mercurial/extensions.py: error importing: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*)
> (glob)
> -  mercurial/filelog.py: error importing: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*)
> (glob)
> -  mercurial/filemerge.py: error importing: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*)
> (glob)
> -  mercurial/fileset.py: error importing: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*)
> (glob)
> +  mercurial/context.py: error importing: <NameError> name 'xrange' is not
> defined (error at revset.py:*) (glob)
> +  mercurial/copies.py: error importing: <NameError> name 'xrange' is not
> defined (error at revset.py:*) (glob)
> +  mercurial/crecord.py: error importing: <NameError> name 'xrange' is not
> defined (error at revset.py:*) (glob)
> +  mercurial/dirstate.py: error importing: <NameError> name 'xrange' is
> not defined (error at revset.py:*) (glob)
> +  mercurial/discovery.py: error importing: <NameError> name 'xrange' is
> not defined (error at revset.py:*) (glob)
> +  mercurial/dispatch.py: error importing: <NameError> name 'xrange' is
> not defined (error at revset.py:*) (glob)
> +  mercurial/exchange.py: error importing module: <SyntaxError> invalid
> syntax (bundle*.py, line *) (line *) (glob)
> +  mercurial/extensions.py: error importing: <NameError> name 'xrange' is
> not defined (error at revset.py:*) (glob)
> +  mercurial/filelog.py: error importing: <NameError> name 'xrange' is not
> defined (error at revset.py:*) (glob)
> +  mercurial/filemerge.py: error importing: <NameError> name 'xrange' is
> not defined (error at revset.py:*) (glob)
> +  mercurial/fileset.py: error importing: <NameError> name 'xrange' is not
> defined (error at revset.py:*) (glob)
>    mercurial/formatter.py: error importing module: <ImportError> No module
> named 'cPickle' (line *) (glob)
> -  mercurial/graphmod.py: error importing: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*)
> (glob)
> -  mercurial/help.py: error importing: <AttributeError> 'NullTranslations'
> object has no attribute 'ugettext' (error at i18n.py:*) (glob)
> -  mercurial/hg.py: error importing: <AttributeError> 'NullTranslations'
> object has no attribute 'ugettext' (error at i18n.py:*) (glob)
> +  mercurial/graphmod.py: error importing: <NameError> name 'xrange' is
> not defined (error at revset.py:*) (glob)
> +  mercurial/help.py: error importing: <NameError> name 'xrange' is not
> defined (error at revset.py:*) (glob)
> +  mercurial/hg.py: error importing: <SyntaxError> invalid syntax
> (bundle*.py, line *) (error at bundlerepo.py:*) (glob)
>    mercurial/hgweb/common.py: error importing module: <ImportError> No
> module named 'BaseHTTPServer' (line *) (glob)
>    mercurial/hgweb/hgweb_mod.py: error importing module: <SystemError>
> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import
> (line *) (glob)
>    mercurial/hgweb/hgwebdir_mod.py: error importing module: <SystemError>
> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import
> (line *) (glob)
> @@ -220,54 +214,38 @@
>    mercurial/hgweb/webcommands.py: error importing module: <SystemError>
> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import
> (line *) (glob)
>    mercurial/hgweb/webutil.py: error importing module: <SystemError>
> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import
> (line *) (glob)
>    mercurial/hgweb/wsgicgi.py: error importing module: <SystemError>
> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import
> (line *) (glob)
> -  mercurial/hook.py: error importing: <AttributeError> 'NullTranslations'
> object has no attribute 'ugettext' (error at i18n.py:*) (glob)
> +  mercurial/hook.py: error importing: <NameError> name 'xrange' is not
> defined (error at revset.py:*) (glob)
>    mercurial/httpclient/_readers.py: error importing module: <ImportError>
> No module named 'httplib' (line *) (glob)
>    mercurial/httpconnection.py: error importing: <ImportError> No module
> named 'httplib' (error at __init__.py:*) (glob)
>    mercurial/httppeer.py: error importing module: <ImportError> No module
> named 'httplib' (line *) (glob)
>    mercurial/keepalive.py: error importing module: <ImportError> No module
> named 'httplib' (line *) (glob)
> -  mercurial/localrepo.py: error importing module: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
> -  mercurial/lock.py: error importing module: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
> -  mercurial/mail.py: error importing module: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
> -  mercurial/manifest.py: error importing module: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
> -  mercurial/match.py: error importing module: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
> -  mercurial/mdiff.py: error importing module: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
> -  mercurial/merge.py: error importing module: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
> -  mercurial/minirst.py: error importing module: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
> -  mercurial/namespaces.py: error importing module: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
> -  mercurial/obsolete.py: error importing module: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
> -  mercurial/patch.py: error importing module: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
> -  mercurial/pathutil.py: error importing module: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
> -  mercurial/peer.py: error importing module: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
> +  mercurial/localrepo.py: error importing: <NameError> name 'xrange' is
> not defined (error at revset.py:*) (glob)
> +  mercurial/mail.py: error importing module: <AttributeError> module
> 'email' has no attribute 'Header' (line *) (glob)
> +  mercurial/manifest.py: error importing: <NameError> name 'xrange' is
> not defined (error at revset.py:*) (glob)
> +  mercurial/merge.py: error importing: <NameError> name 'xrange' is not
> defined (error at revset.py:*) (glob)
> +  mercurial/namespaces.py: error importing: <NameError> name 'xrange' is
> not defined (error at revset.py:*) (glob)
> +  mercurial/patch.py: error importing: <NameError> name 'xrange' is not
> defined (error at revset.py:*) (glob)
>    mercurial/pure/parsers.py: error importing module: <ImportError> No
> module named 'mercurial.pure.node' (line *) (glob)
> -  mercurial/pushkey.py: error importing module: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
> -  mercurial/pvec.py: error importing module: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
> -  mercurial/registrar.py: error importing module: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
> +  mercurial/pvec.py: error importing module: <NameError> name 'xrange' is
> not defined (line *) (glob)
>    mercurial/repair.py: error importing module: <SyntaxError> invalid
> syntax (bundle*.py, line *) (line *) (glob)
> -  mercurial/repoview.py: error importing module: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
> -  mercurial/revlog.py: error importing module: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
> -  mercurial/revset.py: error importing module: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
> -  mercurial/scmutil.py: error importing module: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
> +  mercurial/revlog.py: error importing: <NameError> name 'xrange' is not
> defined (error at revset.py:*) (glob)
> +  mercurial/revset.py: error importing module: <NameError> name 'xrange'
> is not defined (line *) (glob)
> +  mercurial/scmutil.py: error importing: <NameError> name 'xrange' is not
> defined (error at revset.py:*) (glob)
>    mercurial/scmwindows.py: error importing module: <ImportError> No
> module named '_winreg' (line *) (glob)
> -  mercurial/similar.py: error importing module: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
> -  mercurial/simplemerge.py: error importing module: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
> -  mercurial/sshpeer.py: error importing module: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
> -  mercurial/sshserver.py: error importing module: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
> -  mercurial/sslutil.py: error importing module: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
> -  mercurial/statichttprepo.py: error importing module: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
> -  mercurial/store.py: error importing module: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
> -  mercurial/streamclone.py: error importing module: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
> -  mercurial/subrepo.py: error importing module: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
> -  mercurial/tagmerge.py: error importing module: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
> -  mercurial/tags.py: error importing module: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
> -  mercurial/templatefilters.py: error importing module: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
> -  mercurial/templatekw.py: error importing module: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
> -  mercurial/templater.py: error importing module: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
> -  mercurial/transaction.py: error importing module: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
> -  mercurial/ui.py: error importing module: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
> -  mercurial/unionrepo.py: error importing module: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
> +  mercurial/simplemerge.py: error importing: <NameError> name 'xrange' is
> not defined (error at revset.py:*) (glob)
> +  mercurial/sshpeer.py: error importing: <SyntaxError> invalid syntax
> (bundle*.py, line *) (error at wireproto.py:*) (glob)
> +  mercurial/sshserver.py: error importing: <NameError> name 'xrange' is
> not defined (error at revset.py:*) (glob)
> +  mercurial/statichttprepo.py: error importing: <NameError> name 'xrange'
> is not defined (error at revset.py:*) (glob)
> +  mercurial/store.py: error importing: <NameError> name 'xrange' is not
> defined (error at revset.py:*) (glob)
> +  mercurial/streamclone.py: error importing: <NameError> name 'xrange' is
> not defined (error at revset.py:*) (glob)
> +  mercurial/subrepo.py: error importing: <NameError> name 'xrange' is not
> defined (error at revset.py:*) (glob)
> +  mercurial/templatefilters.py: error importing: <NameError> name
> 'xrange' is not defined (error at revset.py:*) (glob)
> +  mercurial/templatekw.py: error importing: <NameError> name 'xrange' is
> not defined (error at revset.py:*) (glob)
> +  mercurial/templater.py: error importing: <NameError> name 'xrange' is
> not defined (error at revset.py:*) (glob)
> +  mercurial/ui.py: error importing: <ImportError> No module named
> 'cPickle' (error at formatter.py:*) (glob)
> +  mercurial/unionrepo.py: error importing: <NameError> name 'xrange' is
> not defined (error at revset.py:*) (glob)
>    mercurial/url.py: error importing module: <ImportError> No module named
> 'httplib' (line *) (glob)
> -  mercurial/util.py: error importing module: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
> -  mercurial/verify.py: error importing module: <AttributeError>
> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
> +  mercurial/verify.py: error importing: <NameError> name 'xrange' is not
> defined (error at revset.py:*) (glob)
>    mercurial/win*.py: error importing module: <ImportError> No module
> named 'msvcrt' (line *) (glob)
>    mercurial/windows.py: error importing module: <ImportError> No module
> named '_winreg' (line *) (glob)
>    mercurial/wireproto.py: error importing module: <SyntaxError> invalid
> syntax (bundle*.py, line *) (line *) (glob)
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>

Patch

diff --git a/mercurial/i18n.py b/mercurial/i18n.py
--- a/mercurial/i18n.py
+++ b/mercurial/i18n.py
@@ -20,6 +20,10 @@ 
 else:
     module = __file__
 
+try:
+    unicode
+except NameError:
+    unicode = str
 
 _languages = None
 if (os.name == 'nt'
@@ -45,7 +49,10 @@ 
     localedir = os.path.join(datapath, 'locale')
     t = gettextmod.translation('hg', localedir, _languages, fallback=True)
     global _ugettext
-    _ugettext = t.ugettext
+    try:
+        _ugettext = t.ugettext
+    except AttributeError:
+        _ugettext = t.gettext
 
 _msgcache = {}
 
diff --git a/tests/test-check-py3-compat.t b/tests/test-check-py3-compat.t
--- a/tests/test-check-py3-compat.t
+++ b/tests/test-check-py3-compat.t
@@ -123,94 +123,88 @@ 
   contrib/check-code.py: invalid syntax: (unicode error) 'unicodeescape' codec can't decode bytes in position *-*: malformed \N character escape (<unknown>, line *) (glob)
   contrib/import-checker.py: invalid syntax: Missing parentheses in call to 'print' (<unknown>, line *) (glob)
   doc/hgmanpage.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
-  hgext/acl.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
   hgext/automv.py: error importing module: <SyntaxError> invalid syntax (commands.py, line *) (line *) (glob)
-  hgext/blackbox.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
+  hgext/blackbox.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
   hgext/bugzilla.py: error importing module: <ImportError> No module named 'urlparse' (line *) (glob)
-  hgext/censor.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
+  hgext/censor.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
   hgext/chgserver.py: error importing module: <ImportError> No module named 'SocketServer' (line *) (glob)
-  hgext/children.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
-  hgext/churn.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
-  hgext/clonebundles.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
+  hgext/children.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
+  hgext/churn.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
+  hgext/clonebundles.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
   hgext/color.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
   hgext/convert/bzr.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob)
   hgext/convert/common.py: error importing module: <ImportError> No module named 'cPickle' (line *) (glob)
-  hgext/convert/convcmd.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
-  hgext/convert/cvs.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
+  hgext/convert/convcmd.py: error importing: <SyntaxError> invalid syntax (bundle*.py, line *) (error at bundlerepo.py:*) (glob)
+  hgext/convert/cvs.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob)
   hgext/convert/cvsps.py: error importing module: <ImportError> No module named 'cPickle' (line *) (glob)
-  hgext/convert/darcs.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
+  hgext/convert/darcs.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob)
   hgext/convert/filemap.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob)
-  hgext/convert/git.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
-  hgext/convert/gnuarch.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
-  hgext/convert/hg.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
-  hgext/convert/monotone.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
-  hgext/convert/p*.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
+  hgext/convert/git.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob)
+  hgext/convert/gnuarch.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob)
+  hgext/convert/hg.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
+  hgext/convert/monotone.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob)
+  hgext/convert/p*.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob)
   hgext/convert/subversion.py: error importing module: <ImportError> No module named 'cPickle' (line *) (glob)
   hgext/convert/transport.py: error importing module: <ImportError> No module named 'svn.client' (line *) (glob)
-  hgext/eol.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
-  hgext/extdiff.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
+  hgext/eol.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
+  hgext/extdiff.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
   hgext/factotum.py: error importing: <ImportError> No module named 'httplib' (error at url.py:*) (glob)
   hgext/fetch.py: error importing module: <SyntaxError> invalid syntax (commands.py, line *) (line *) (glob)
-  hgext/fsmonitor/state.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
-  hgext/fsmonitor/watchmanclient.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
-  hgext/gpg.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
-  hgext/graphlog.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
-  hgext/hgcia.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
-  hgext/hgk.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
-  hgext/highlight/highlight.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
+  hgext/fsmonitor/watchmanclient.py: error importing module: <SystemError> Parent module 'hgext.fsmonitor' not loaded, cannot perform relative import (line *) (glob)
+  hgext/gpg.py: error importing module: <SyntaxError> invalid syntax (commands.py, line *) (line *) (glob)
+  hgext/graphlog.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
+  hgext/hgcia.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
+  hgext/hgk.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
+  hgext/highlight/highlight.py: error importing module: <ImportError> No module named 'pygments' (line *) (glob)
   hgext/histedit.py: error importing module: <SyntaxError> invalid syntax (bundle*.py, line *) (line *) (glob)
-  hgext/keyword.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
-  hgext/largefiles/basestore.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
-  hgext/largefiles/lfcommands.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
-  hgext/largefiles/lfutil.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
+  hgext/keyword.py: error importing: <ImportError> No module named 'BaseHTTPServer' (error at common.py:*) (glob)
+  hgext/largefiles/basestore.py: error importing: <SyntaxError> invalid syntax (bundle*.py, line *) (error at bundlerepo.py:*) (glob)
+  hgext/largefiles/lfcommands.py: error importing: <SyntaxError> invalid syntax (bundle*.py, line *) (error at bundlerepo.py:*) (glob)
+  hgext/largefiles/lfutil.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
   hgext/largefiles/localstore.py: error importing module: <ImportError> No module named 'lfutil' (line *) (glob)
-  hgext/largefiles/overrides.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
+  hgext/largefiles/overrides.py: error importing: <SyntaxError> invalid syntax (bundle*.py, line *) (error at bundlerepo.py:*) (glob)
   hgext/largefiles/proto.py: error importing: <ImportError> No module named 'httplib' (error at httppeer.py:*) (glob)
-  hgext/largefiles/remotestore.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
-  hgext/largefiles/reposetup.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
+  hgext/largefiles/remotestore.py: error importing: <SyntaxError> invalid syntax (bundle*.py, line *) (error at wireproto.py:*) (glob)
+  hgext/largefiles/reposetup.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
   hgext/largefiles/uisetup.py: error importing module: <SyntaxError> invalid syntax (archival.py, line *) (line *) (glob)
   hgext/largefiles/wirestore.py: error importing module: <ImportError> No module named 'lfutil' (line *) (glob)
-  hgext/mq.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
-  hgext/notify.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
-  hgext/pager.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
-  hgext/patchbomb.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
-  hgext/purge.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
-  hgext/rebase.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
-  hgext/record.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
-  hgext/relink.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
-  hgext/schemes.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
-  hgext/share.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
+  hgext/mq.py: error importing module: <SyntaxError> invalid syntax (commands.py, line *) (line *) (glob)
+  hgext/notify.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
+  hgext/pager.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
+  hgext/patchbomb.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
+  hgext/purge.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
+  hgext/rebase.py: error importing: <SyntaxError> invalid syntax (bundle*.py, line *) (error at bundlerepo.py:*) (glob)
+  hgext/record.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
+  hgext/relink.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
+  hgext/schemes.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
+  hgext/share.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
   hgext/shelve.py: error importing module: <SyntaxError> invalid syntax (bundle*.py, line *) (line *) (glob)
-  hgext/strip.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
+  hgext/strip.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
   hgext/transplant.py: error importing: <SyntaxError> invalid syntax (bundle*.py, line *) (error at bundlerepo.py:*) (glob)
-  hgext/win*text.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
   mercurial/archival.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
-  mercurial/bookmarks.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
-  mercurial/branchmap.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
+  mercurial/branchmap.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
   mercurial/bundle*.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
   mercurial/bundlerepo.py: error importing module: <SyntaxError> invalid syntax (bundle*.py, line *) (line *) (glob)
-  mercurial/changegroup.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
-  mercurial/changelog.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
-  mercurial/cmdutil.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
+  mercurial/changegroup.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
+  mercurial/changelog.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
+  mercurial/cmdutil.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
   mercurial/commands.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
   mercurial/commandserver.py: error importing module: <ImportError> No module named 'SocketServer' (line *) (glob)
-  mercurial/config.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
-  mercurial/context.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
-  mercurial/copies.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
-  mercurial/crecord.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
-  mercurial/destutil.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
-  mercurial/dirstate.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
-  mercurial/discovery.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
-  mercurial/dispatch.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
-  mercurial/exchange.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
-  mercurial/extensions.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
-  mercurial/filelog.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
-  mercurial/filemerge.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
-  mercurial/fileset.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
+  mercurial/context.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
+  mercurial/copies.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
+  mercurial/crecord.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
+  mercurial/dirstate.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
+  mercurial/discovery.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
+  mercurial/dispatch.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
+  mercurial/exchange.py: error importing module: <SyntaxError> invalid syntax (bundle*.py, line *) (line *) (glob)
+  mercurial/extensions.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
+  mercurial/filelog.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
+  mercurial/filemerge.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
+  mercurial/fileset.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
   mercurial/formatter.py: error importing module: <ImportError> No module named 'cPickle' (line *) (glob)
-  mercurial/graphmod.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
-  mercurial/help.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
-  mercurial/hg.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
+  mercurial/graphmod.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
+  mercurial/help.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
+  mercurial/hg.py: error importing: <SyntaxError> invalid syntax (bundle*.py, line *) (error at bundlerepo.py:*) (glob)
   mercurial/hgweb/common.py: error importing module: <ImportError> No module named 'BaseHTTPServer' (line *) (glob)
   mercurial/hgweb/hgweb_mod.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob)
   mercurial/hgweb/hgwebdir_mod.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob)
@@ -220,54 +214,38 @@ 
   mercurial/hgweb/webcommands.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob)
   mercurial/hgweb/webutil.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob)
   mercurial/hgweb/wsgicgi.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob)
-  mercurial/hook.py: error importing: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (error at i18n.py:*) (glob)
+  mercurial/hook.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
   mercurial/httpclient/_readers.py: error importing module: <ImportError> No module named 'httplib' (line *) (glob)
   mercurial/httpconnection.py: error importing: <ImportError> No module named 'httplib' (error at __init__.py:*) (glob)
   mercurial/httppeer.py: error importing module: <ImportError> No module named 'httplib' (line *) (glob)
   mercurial/keepalive.py: error importing module: <ImportError> No module named 'httplib' (line *) (glob)
-  mercurial/localrepo.py: error importing module: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
-  mercurial/lock.py: error importing module: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
-  mercurial/mail.py: error importing module: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
-  mercurial/manifest.py: error importing module: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
-  mercurial/match.py: error importing module: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
-  mercurial/mdiff.py: error importing module: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
-  mercurial/merge.py: error importing module: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
-  mercurial/minirst.py: error importing module: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
-  mercurial/namespaces.py: error importing module: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
-  mercurial/obsolete.py: error importing module: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
-  mercurial/patch.py: error importing module: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
-  mercurial/pathutil.py: error importing module: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
-  mercurial/peer.py: error importing module: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
+  mercurial/localrepo.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
+  mercurial/mail.py: error importing module: <AttributeError> module 'email' has no attribute 'Header' (line *) (glob)
+  mercurial/manifest.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
+  mercurial/merge.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
+  mercurial/namespaces.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
+  mercurial/patch.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
   mercurial/pure/parsers.py: error importing module: <ImportError> No module named 'mercurial.pure.node' (line *) (glob)
-  mercurial/pushkey.py: error importing module: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
-  mercurial/pvec.py: error importing module: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
-  mercurial/registrar.py: error importing module: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
+  mercurial/pvec.py: error importing module: <NameError> name 'xrange' is not defined (line *) (glob)
   mercurial/repair.py: error importing module: <SyntaxError> invalid syntax (bundle*.py, line *) (line *) (glob)
-  mercurial/repoview.py: error importing module: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
-  mercurial/revlog.py: error importing module: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
-  mercurial/revset.py: error importing module: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
-  mercurial/scmutil.py: error importing module: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
+  mercurial/revlog.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
+  mercurial/revset.py: error importing module: <NameError> name 'xrange' is not defined (line *) (glob)
+  mercurial/scmutil.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
   mercurial/scmwindows.py: error importing module: <ImportError> No module named '_winreg' (line *) (glob)
-  mercurial/similar.py: error importing module: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
-  mercurial/simplemerge.py: error importing module: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
-  mercurial/sshpeer.py: error importing module: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
-  mercurial/sshserver.py: error importing module: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
-  mercurial/sslutil.py: error importing module: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
-  mercurial/statichttprepo.py: error importing module: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
-  mercurial/store.py: error importing module: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
-  mercurial/streamclone.py: error importing module: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
-  mercurial/subrepo.py: error importing module: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
-  mercurial/tagmerge.py: error importing module: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
-  mercurial/tags.py: error importing module: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
-  mercurial/templatefilters.py: error importing module: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
-  mercurial/templatekw.py: error importing module: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
-  mercurial/templater.py: error importing module: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
-  mercurial/transaction.py: error importing module: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
-  mercurial/ui.py: error importing module: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
-  mercurial/unionrepo.py: error importing module: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
+  mercurial/simplemerge.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
+  mercurial/sshpeer.py: error importing: <SyntaxError> invalid syntax (bundle*.py, line *) (error at wireproto.py:*) (glob)
+  mercurial/sshserver.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
+  mercurial/statichttprepo.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
+  mercurial/store.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
+  mercurial/streamclone.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
+  mercurial/subrepo.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
+  mercurial/templatefilters.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
+  mercurial/templatekw.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
+  mercurial/templater.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
+  mercurial/ui.py: error importing: <ImportError> No module named 'cPickle' (error at formatter.py:*) (glob)
+  mercurial/unionrepo.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
   mercurial/url.py: error importing module: <ImportError> No module named 'httplib' (line *) (glob)
-  mercurial/util.py: error importing module: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
-  mercurial/verify.py: error importing module: <AttributeError> 'NullTranslations' object has no attribute 'ugettext' (line *) (glob)
+  mercurial/verify.py: error importing: <NameError> name 'xrange' is not defined (error at revset.py:*) (glob)
   mercurial/win*.py: error importing module: <ImportError> No module named 'msvcrt' (line *) (glob)
   mercurial/windows.py: error importing module: <ImportError> No module named '_winreg' (line *) (glob)
   mercurial/wireproto.py: error importing module: <SyntaxError> invalid syntax (bundle*.py, line *) (line *) (glob)