Patchwork [2,of,7] scmutil: use util.queue/util.empty for py3 compat

login
register
mail settings
Submitter timeless@mozdev.org
Date April 6, 2016, 9:57 p.m.
Message ID <ffdf8b429336f3b9d1ff.1459979859@waste.org>
Download mbox | patch
Permalink /patch/14402/
State Accepted
Headers show

Comments

timeless@mozdev.org - April 6, 2016, 9:57 p.m.
# HG changeset patch
# User timeless <timeless@mozdev.org>
# Date 1459973271 0
#      Wed Apr 06 20:07:51 2016 +0000
# Node ID ffdf8b429336f3b9d1ff5f035b2271592a1b9679
# Parent  10f4f7b32691075ed2f3d9aa9301d4e54006ac55
scmutil: use util.queue/util.empty for py3 compat

Patch

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -7,7 +7,6 @@ 
 
 from __future__ import absolute_import
 
-import Queue
 import contextlib
 import errno
 import glob
@@ -1320,7 +1319,7 @@ 
         ui.debug('starting %d threads for background file closing\n' %
                  threadcount)
 
-        self._queue = Queue.Queue(maxsize=maxqueue)
+        self._queue = util.queue(maxsize=maxqueue)
         self._running = True
 
         for i in range(threadcount):
@@ -1352,7 +1351,7 @@ 
                 except Exception as e:
                     # Stash so can re-raise from main thread later.
                     self._threadexception = e
-            except Queue.Empty:
+            except util.empty:
                 if not self._running:
                     break
 
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
@@ -137,11 +137,11 @@ 
   hgext/win*text.py: error importing: <ImportError> No module named 'cStringIO' (error at parsers.py:*) (glob)
   mercurial/archival.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
   mercurial/bookmarks.py: error importing: <ImportError> No module named 'cStringIO' (error at parsers.py:*) (glob)
-  mercurial/branchmap.py: error importing: <ImportError> No module named 'Queue' (error at scmutil.py:*) (glob)
+  mercurial/branchmap.py: error importing: <ImportError> No module named 'cStringIO' (error at parsers.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/byterange.py: error importing module: <ImportError> No module named 'urllib2' (line *) (glob)
-  mercurial/changegroup.py: error importing: <ImportError> No module named 'Queue' (error at scmutil.py:*) (glob)
+  mercurial/changegroup.py: error importing: <ImportError> No module named 'cStringIO' (error at parsers.py:*) (glob)
   mercurial/changelog.py: error importing: <ImportError> No module named 'cStringIO' (error at mpatch.py:*) (glob)
   mercurial/cmdutil.py: error importing module: <ImportError> No module named 'cStringIO' (line *) (glob)
   mercurial/commands.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
@@ -199,7 +199,7 @@ 
   mercurial/repoview.py: error importing: <ImportError> No module named 'cStringIO' (error at parsers.py:*) (glob)
   mercurial/revlog.py: error importing: <ImportError> No module named 'cStringIO' (error at mpatch.py:*) (glob)
   mercurial/revset.py: error importing: <ImportError> No module named 'cStringIO' (error at parsers.py:*) (glob)
-  mercurial/scmutil.py: error importing module: <ImportError> No module named 'Queue' (line *) (glob)
+  mercurial/scmutil.py: error importing: <ImportError> No module named 'cStringIO' (error at parsers.py:*) (glob)
   mercurial/scmwindows.py: error importing module: <ImportError> No module named '_winreg' (line *) (glob)
   mercurial/similar.py: error importing: <ImportError> No module named 'cStringIO' (error at mpatch.py:*) (glob)
   mercurial/simplemerge.py: error importing: <ImportError> No module named 'cStringIO' (error at mpatch.py:*) (glob)
@@ -208,7 +208,7 @@ 
   mercurial/sslutil.py: error importing: <ImportError> No module named 'cStringIO' (error at parsers.py:*) (glob)
   mercurial/statichttprepo.py: error importing module: <ImportError> No module named 'urllib2' (line *) (glob)
   mercurial/store.py: error importing: <ImportError> No module named 'cStringIO' (error at parsers.py:*) (glob)
-  mercurial/streamclone.py: error importing: <ImportError> No module named 'Queue' (error at scmutil.py:*) (glob)
+  mercurial/streamclone.py: error importing: <ImportError> No module named 'cStringIO' (error at parsers.py:*) (glob)
   mercurial/subrepo.py: error importing: <ImportError> No module named 'cStringIO' (error at cmdutil.py:*) (glob)
   mercurial/tagmerge.py: error importing: <ImportError> No module named 'cStringIO' (error at parsers.py:*) (glob)
   mercurial/tags.py: error importing: <ImportError> No module named 'cStringIO' (error at parsers.py:*) (glob)