diff --git a/mercurial/httppeer.py b/mercurial/httppeer.py --- a/mercurial/httppeer.py +++ b/mercurial/httppeer.py @@ -14,6 +14,7 @@ import socket import struct +from concurrent import futures from .i18n import _ from .pycompat import getattr from . import ( @@ -538,12 +539,12 @@ raise exception -class queuedcommandfuture(pycompat.futures.Future): +class queuedcommandfuture(futures.Future): """Wraps result() on command futures to trigger submission on call.""" def result(self, timeout=None): if self.done(): - return pycompat.futures.Future.result(self, timeout) + return futures.Future.result(self, timeout) self._peerexecutor.sendcommands() diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -16,6 +16,7 @@ import time import weakref +from concurrent import futures from .i18n import _ from .node import ( bin, @@ -278,7 +279,7 @@ # method on the peer and return a resolved future. fn = getattr(self._peer, pycompat.sysstr(command)) - f = pycompat.futures.Future() + f = futures.Future() try: result = fn(**pycompat.strkwargs(args)) diff --git a/mercurial/pycompat.py b/mercurial/pycompat.py --- a/mercurial/pycompat.py +++ b/mercurial/pycompat.py @@ -35,8 +35,6 @@ import SocketServer as socketserver import xmlrpclib - from .thirdparty.concurrent import futures - def future_set_exception_info(f, exc_info): f.set_exception_info(*exc_info) @@ -45,7 +43,6 @@ else: import builtins - import concurrent.futures as futures import http.cookiejar as cookielib import http.client as httplib import pickle diff --git a/mercurial/wireprotov1peer.py b/mercurial/wireprotov1peer.py --- a/mercurial/wireprotov1peer.py +++ b/mercurial/wireprotov1peer.py @@ -10,6 +10,7 @@ import sys import weakref +from concurrent import futures from .i18n import _ from .node import bin from .pycompat import ( @@ -88,7 +89,7 @@ return b';'.join(cmds) -class unsentfuture(pycompat.futures.Future): +class unsentfuture(futures.Future): """A Future variation to represent an unsent command. Because we buffer commands and don't submit them immediately, calling @@ -99,7 +100,7 @@ def result(self, timeout=None): if self.done(): - return pycompat.futures.Future.result(self, timeout) + return futures.Future.result(self, timeout) self._peerexecutor.sendcommands() @@ -154,7 +155,7 @@ # a batchable one and refuse to service it. def addcall(): - f = pycompat.futures.Future() + f = futures.Future() self._futures.add(f) self._calls.append((command, args, fn, f)) return f @@ -194,7 +195,7 @@ # cycle between us and futures. for f in self._futures: if isinstance(f, unsentfuture): - f.__class__ = pycompat.futures.Future + f.__class__ = futures.Future f._peerexecutor = None calls = self._calls @@ -258,7 +259,7 @@ # hard and it is easy to encounter race conditions, deadlocks, etc. # concurrent.futures already solves these problems and its thread pool # executor has minimal overhead. So we use it. - self._responseexecutor = pycompat.futures.ThreadPoolExecutor(1) + self._responseexecutor = futures.ThreadPoolExecutor(1) self._responsef = self._responseexecutor.submit( self._readbatchresponse, states, wireresults )