Show More
@@ -11,7 +11,7 b'' | |||
|
11 | 11 | import os, error |
|
12 | 12 | from i18n import _ |
|
13 | 13 | from node import short, hex |
|
14 | import util | |
|
14 | import collections, util | |
|
15 | 15 | |
|
16 | 16 | def bisect(changelog, state): |
|
17 | 17 | """find the next node (if any) for testing during a bisect search. |
@@ -69,10 +69,10 b' def bisect(changelog, state):' | |||
|
69 | 69 | |
|
70 | 70 | # build children dict |
|
71 | 71 | children = {} |
|
72 | visit = [badrev] | |
|
72 | visit = collections.deque([badrev]) | |
|
73 | 73 | candidates = [] |
|
74 | 74 | while visit: |
|
75 |
rev = visit.pop( |
|
|
75 | rev = visit.popleft() | |
|
76 | 76 | if ancestors[rev] == []: |
|
77 | 77 | candidates.append(rev) |
|
78 | 78 | for prev in clparents(rev): |
@@ -12,7 +12,7 b' import tempfile, zlib, shutil' | |||
|
12 | 12 | from i18n import _ |
|
13 | 13 | from node import hex, nullid, short |
|
14 | 14 | import base85, mdiff, scmutil, util, diffhelpers, copies, encoding, error |
|
15 | import context | |
|
15 | import collections, context | |
|
16 | 16 | |
|
17 | 17 | gitre = re.compile('diff --git a/(.*) b/(.*)') |
|
18 | 18 | |
@@ -1588,12 +1588,12 b' def diff(repo, node1=None, node2=None, m' | |||
|
1588 | 1588 | |
|
1589 | 1589 | def lrugetfilectx(): |
|
1590 | 1590 | cache = {} |
|
1591 |
order = |
|
|
1591 | order = collections.deque() | |
|
1592 | 1592 | def getfilectx(f, ctx): |
|
1593 | 1593 | fctx = ctx.filectx(f, filelog=cache.get(f)) |
|
1594 | 1594 | if f not in cache: |
|
1595 | 1595 | if len(cache) > 20: |
|
1596 |
del cache[order.pop( |
|
|
1596 | del cache[order.popleft()] | |
|
1597 | 1597 | cache[f] = fctx.filelog() |
|
1598 | 1598 | else: |
|
1599 | 1599 | order.remove(f) |
@@ -15,7 +15,7 b' and O(changes) merge between branches.' | |||
|
15 | 15 | from node import bin, hex, nullid, nullrev |
|
16 | 16 | from i18n import _ |
|
17 | 17 | import ancestor, mdiff, parsers, error, util, dagutil |
|
18 | import struct, zlib, errno | |
|
18 | import struct, zlib, errno, collections | |
|
19 | 19 | |
|
20 | 20 | _pack = struct.pack |
|
21 | 21 | _unpack = struct.unpack |
@@ -362,13 +362,13 b' class revlog(object):' | |||
|
362 | 362 | """return the set of all nodes ancestral to a given node, including |
|
363 | 363 | the node itself, stopping when stop is matched""" |
|
364 | 364 | reachable = set((node,)) |
|
365 | visit = [node] | |
|
365 | visit = collections.deque([node]) | |
|
366 | 366 | if stop: |
|
367 | 367 | stopn = self.rev(stop) |
|
368 | 368 | else: |
|
369 | 369 | stopn = 0 |
|
370 | 370 | while visit: |
|
371 |
n = visit.pop( |
|
|
371 | n = visit.popleft() | |
|
372 | 372 | if n == stop: |
|
373 | 373 | continue |
|
374 | 374 | if n == nullid: |
@@ -389,10 +389,10 b' class revlog(object):' | |||
|
389 | 389 | an ancestor of itself. Results are in breadth-first order: |
|
390 | 390 | parents of each rev in revs, then parents of those, etc. Result |
|
391 | 391 | does not include the null revision.""" |
|
392 |
visit = |
|
|
392 | visit = collections.deque(revs) | |
|
393 | 393 | seen = set([nullrev]) |
|
394 | 394 | while visit: |
|
395 |
for parent in self.parentrevs(visit.pop( |
|
|
395 | for parent in self.parentrevs(visit.popleft()): | |
|
396 | 396 | if parent not in seen: |
|
397 | 397 | visit.append(parent) |
|
398 | 398 | seen.add(parent) |
@@ -447,9 +447,9 b' class revlog(object):' | |||
|
447 | 447 | |
|
448 | 448 | # take all ancestors from heads that aren't in has |
|
449 | 449 | missing = set() |
|
450 |
visit = |
|
|
450 | visit = collections.deque(r for r in heads if r not in has) | |
|
451 | 451 | while visit: |
|
452 |
r = visit.pop( |
|
|
452 | r = visit.popleft() | |
|
453 | 453 | if r in missing: |
|
454 | 454 | continue |
|
455 | 455 | else: |
@@ -5,7 +5,7 b'' | |||
|
5 | 5 | # This software may be used and distributed according to the terms of the |
|
6 | 6 | # GNU General Public License version 2 or any later version. |
|
7 | 7 | |
|
8 | import re | |
|
8 | import re, collections | |
|
9 | 9 | import parser, util, error, discovery, hbisect, phases |
|
10 | 10 | import node |
|
11 | 11 | import bookmarks as bookmarksmod |
@@ -17,10 +17,10 b' def _revancestors(repo, revs, followfirs' | |||
|
17 | 17 | """Like revlog.ancestors(), but supports followfirst.""" |
|
18 | 18 | cut = followfirst and 1 or None |
|
19 | 19 | cl = repo.changelog |
|
20 |
visit = |
|
|
20 | visit = collections.deque(revs) | |
|
21 | 21 | seen = set([node.nullrev]) |
|
22 | 22 | while visit: |
|
23 |
for parent in cl.parentrevs(visit.pop( |
|
|
23 | for parent in cl.parentrevs(visit.popleft())[:cut]: | |
|
24 | 24 | if parent not in seen: |
|
25 | 25 | visit.append(parent) |
|
26 | 26 | seen.add(parent) |
@@ -7,7 +7,7 b'' | |||
|
7 | 7 | |
|
8 | 8 | from node import nullid, short |
|
9 | 9 | from i18n import _ |
|
10 | import util, error | |
|
10 | import util, error, collections | |
|
11 | 11 | |
|
12 | 12 | def findcommonincoming(repo, remote, heads=None, force=False): |
|
13 | 13 | """Return a tuple (common, fetch, heads) used to identify the common |
@@ -56,11 +56,11 b' def findcommonincoming(repo, remote, hea' | |||
|
56 | 56 | # a 'branch' here is a linear segment of history, with four parts: |
|
57 | 57 | # head, root, first parent, second parent |
|
58 | 58 | # (a branch always has two parents (or none) by definition) |
|
59 | unknown = remote.branches(unknown) | |
|
59 | unknown = collections.deque(remote.branches(unknown)) | |
|
60 | 60 | while unknown: |
|
61 | 61 | r = [] |
|
62 | 62 | while unknown: |
|
63 |
n = unknown.pop( |
|
|
63 | n = unknown.popleft() | |
|
64 | 64 | if n[0] in seen: |
|
65 | 65 | continue |
|
66 | 66 |
@@ -14,7 +14,7 b' hide platform-specific details from the ' | |||
|
14 | 14 | """ |
|
15 | 15 | |
|
16 | 16 | from i18n import _ |
|
17 | import error, osutil, encoding | |
|
17 | import error, osutil, encoding, collections | |
|
18 | 18 | import errno, re, shutil, sys, tempfile, traceback |
|
19 | 19 | import os, time, datetime, calendar, textwrap, signal |
|
20 | 20 | import imp, socket, urllib |
@@ -205,12 +205,12 b' def cachefunc(func):' | |||
|
205 | 205 | def lrucachefunc(func): |
|
206 | 206 | '''cache most recent results of function calls''' |
|
207 | 207 | cache = {} |
|
208 | order = [] | |
|
208 | order = collections.deque() | |
|
209 | 209 | if func.func_code.co_argcount == 1: |
|
210 | 210 | def f(arg): |
|
211 | 211 | if arg not in cache: |
|
212 | 212 | if len(cache) > 20: |
|
213 |
del cache[order.pop( |
|
|
213 | del cache[order.popleft()] | |
|
214 | 214 | cache[arg] = func(arg) |
|
215 | 215 | else: |
|
216 | 216 | order.remove(arg) |
@@ -220,7 +220,7 b' def lrucachefunc(func):' | |||
|
220 | 220 | def f(*args): |
|
221 | 221 | if args not in cache: |
|
222 | 222 | if len(cache) > 20: |
|
223 |
del cache[order.pop( |
|
|
223 | del cache[order.popleft()] | |
|
224 | 224 | cache[args] = func(*args) |
|
225 | 225 | else: |
|
226 | 226 | order.remove(args) |
@@ -865,7 +865,7 b' class chunkbuffer(object):' | |||
|
865 | 865 | Returns less than L bytes if the iterator runs dry.""" |
|
866 | 866 | left = l |
|
867 | 867 | buf = '' |
|
868 | queue = self._queue | |
|
868 | queue = collections.deque(self._queue) | |
|
869 | 869 | while left > 0: |
|
870 | 870 | # refill the queue |
|
871 | 871 | if not queue: |
@@ -878,13 +878,14 b' class chunkbuffer(object):' | |||
|
878 | 878 | if not queue: |
|
879 | 879 | break |
|
880 | 880 | |
|
881 |
chunk = queue.pop( |
|
|
881 | chunk = queue.popleft() | |
|
882 | 882 | left -= len(chunk) |
|
883 | 883 | if left < 0: |
|
884 |
queue. |
|
|
884 | queue.appendleft(chunk[left:]) | |
|
885 | 885 | buf += chunk[:left] |
|
886 | 886 | else: |
|
887 | 887 | buf += chunk |
|
888 | self._queue = list(queue) | |
|
888 | 889 | |
|
889 | 890 | return buf |
|
890 | 891 |
General Comments 0
You need to be logged in to leave comments.
Login now