##// END OF EJS Templates
util: drop alias for collections.deque...
Martin von Zweigbergk -
r25113:0ca8410e default
parent child Browse files
Show More
@@ -21,6 +21,7 b' shelved change has a distinct name. For '
21 shelve".
21 shelve".
22 """
22 """
23
23
24 import collections
24 from mercurial.i18n import _
25 from mercurial.i18n import _
25 from mercurial.node import nullid, nullrev, bin, hex
26 from mercurial.node import nullid, nullrev, bin, hex
26 from mercurial import changegroup, cmdutil, scmutil, phases, commands
27 from mercurial import changegroup, cmdutil, scmutil, phases, commands
@@ -143,7 +144,7 b' def createcmd(ui, repo, pats, opts):'
143
144
144 Much faster than the revset ancestors(ctx) & draft()"""
145 Much faster than the revset ancestors(ctx) & draft()"""
145 seen = set([nullrev])
146 seen = set([nullrev])
146 visit = util.deque()
147 visit = collections.deque()
147 visit.append(ctx)
148 visit.append(ctx)
148 while visit:
149 while visit:
149 ctx = visit.popleft()
150 ctx = visit.popleft()
@@ -5,8 +5,8 b''
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 import collections
8 import heapq
9 import heapq
9 import util
10 from node import nullrev
10 from node import nullrev
11
11
12 def commonancestorsheads(pfunc, *nodes):
12 def commonancestorsheads(pfunc, *nodes):
@@ -314,7 +314,7 b' class lazyancestors(object):'
314
314
315 parentrevs = self._parentrevs
315 parentrevs = self._parentrevs
316 stoprev = self._stoprev
316 stoprev = self._stoprev
317 visit = util.deque(revs)
317 visit = collections.deque(revs)
318
318
319 while visit:
319 while visit:
320 for parent in parentrevs(visit.popleft()):
320 for parent in parentrevs(visit.popleft()):
@@ -8,6 +8,7 b''
8 # This software may be used and distributed according to the terms of the
8 # This software may be used and distributed according to the terms of the
9 # GNU General Public License version 2 or any later version.
9 # GNU General Public License version 2 or any later version.
10
10
11 import collections
11 import os
12 import os
12 import error
13 import error
13 from i18n import _
14 from i18n import _
@@ -71,7 +72,7 b' def bisect(changelog, state):'
71
72
72 # build children dict
73 # build children dict
73 children = {}
74 children = {}
74 visit = util.deque([badrev])
75 visit = collections.deque([badrev])
75 candidates = []
76 candidates = []
76 while visit:
77 while visit:
77 rev = visit.popleft()
78 rev = visit.popleft()
@@ -6,6 +6,7 b''
6 # This software may be used and distributed according to the terms of the
6 # This software may be used and distributed according to the terms of the
7 # GNU General Public License version 2 or any later version.
7 # GNU General Public License version 2 or any later version.
8
8
9 import collections
9 import cStringIO, email, os, errno, re, posixpath, copy
10 import cStringIO, email, os, errno, re, posixpath, copy
10 import tempfile, zlib, shutil
11 import tempfile, zlib, shutil
11 # On python2.4 you have to import these by name or they fail to
12 # On python2.4 you have to import these by name or they fail to
@@ -2102,7 +2103,7 b' def diff(repo, node1=None, node2=None, m'
2102
2103
2103 def lrugetfilectx():
2104 def lrugetfilectx():
2104 cache = {}
2105 cache = {}
2105 order = util.deque()
2106 order = collections.deque()
2106 def getfilectx(f, ctx):
2107 def getfilectx(f, ctx):
2107 fctx = ctx.filectx(f, filelog=cache.get(f))
2108 fctx = ctx.filectx(f, filelog=cache.get(f))
2108 if f not in cache:
2109 if f not in cache:
@@ -12,6 +12,7 b' and O(changes) merge between branches.'
12 """
12 """
13
13
14 # import stuff from node for others to import from revlog
14 # import stuff from node for others to import from revlog
15 import collections
15 from node import bin, hex, nullid, nullrev
16 from node import bin, hex, nullid, nullrev
16 from i18n import _
17 from i18n import _
17 import ancestor, mdiff, parsers, error, util, templatefilters
18 import ancestor, mdiff, parsers, error, util, templatefilters
@@ -485,7 +486,7 b' class revlog(object):'
485
486
486 # take all ancestors from heads that aren't in has
487 # take all ancestors from heads that aren't in has
487 missing = set()
488 missing = set()
488 visit = util.deque(r for r in heads if r not in has)
489 visit = collections.deque(r for r in heads if r not in has)
489 while visit:
490 while visit:
490 r = visit.popleft()
491 r = visit.popleft()
491 if r in missing:
492 if r in missing:
@@ -40,6 +40,7 b' nodes that will maximize the number of n'
40 classified with it (since all ancestors or descendants will be marked as well).
40 classified with it (since all ancestors or descendants will be marked as well).
41 """
41 """
42
42
43 import collections
43 from node import nullid, nullrev
44 from node import nullid, nullrev
44 from i18n import _
45 from i18n import _
45 import random
46 import random
@@ -65,7 +66,7 b' def _updatesample(dag, nodes, sample, qu'
65 else:
66 else:
66 heads = dag.heads()
67 heads = dag.heads()
67 dist = {}
68 dist = {}
68 visit = util.deque(heads)
69 visit = collections.deque(heads)
69 seen = set()
70 seen = set()
70 factor = 1
71 factor = 1
71 while visit:
72 while visit:
@@ -5,6 +5,7 b''
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 import collections
8 from node import nullid, short
9 from node import nullid, short
9 from i18n import _
10 from i18n import _
10 import util, error
11 import util, error
@@ -56,7 +57,7 b' def findcommonincoming(repo, remote, hea'
56 # a 'branch' here is a linear segment of history, with four parts:
57 # a 'branch' here is a linear segment of history, with four parts:
57 # head, root, first parent, second parent
58 # head, root, first parent, second parent
58 # (a branch always has two parents (or none) by definition)
59 # (a branch always has two parents (or none) by definition)
59 unknown = util.deque(remote.branches(unknown))
60 unknown = collections.deque(remote.branches(unknown))
60 while unknown:
61 while unknown:
61 r = []
62 r = []
62 while unknown:
63 while unknown:
@@ -334,8 +334,6 b' def cachefunc(func):'
334
334
335 return f
335 return f
336
336
337 deque = collections.deque
338
339 class sortdict(dict):
337 class sortdict(dict):
340 '''a simple sorted dictionary'''
338 '''a simple sorted dictionary'''
341 def __init__(self, data=None):
339 def __init__(self, data=None):
@@ -386,7 +384,7 b' class lrucachedict(object):'
386 def __init__(self, maxsize):
384 def __init__(self, maxsize):
387 self._cache = {}
385 self._cache = {}
388 self._maxsize = maxsize
386 self._maxsize = maxsize
389 self._order = deque()
387 self._order = collections.deque()
390
388
391 def __getitem__(self, key):
389 def __getitem__(self, key):
392 value = self._cache[key]
390 value = self._cache[key]
@@ -408,12 +406,12 b' class lrucachedict(object):'
408
406
409 def clear(self):
407 def clear(self):
410 self._cache.clear()
408 self._cache.clear()
411 self._order = deque()
409 self._order = collections.deque()
412
410
413 def lrucachefunc(func):
411 def lrucachefunc(func):
414 '''cache most recent results of function calls'''
412 '''cache most recent results of function calls'''
415 cache = {}
413 cache = {}
416 order = deque()
414 order = collections.deque()
417 if func.func_code.co_argcount == 1:
415 if func.func_code.co_argcount == 1:
418 def f(arg):
416 def f(arg):
419 if arg not in cache:
417 if arg not in cache:
@@ -1191,7 +1189,7 b' class chunkbuffer(object):'
1191 else:
1189 else:
1192 yield chunk
1190 yield chunk
1193 self.iter = splitbig(in_iter)
1191 self.iter = splitbig(in_iter)
1194 self._queue = deque()
1192 self._queue = collections.deque()
1195
1193
1196 def read(self, l=None):
1194 def read(self, l=None):
1197 """Read L bytes of data from the iterator of chunks of data.
1195 """Read L bytes of data from the iterator of chunks of data.
General Comments 0
You need to be logged in to leave comments. Login now