diff mercurial/revlog.py @ 16834:cafd8a8fb713

util: subclass deque for Python 2.4 backwards compatibility It turns out that Python 2.4's deque type is lacking a remove method. We can't implement remove in terms of find, because it doesn't have find either.
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 01 Jun 2012 17:05:31 -0700
parents 107a3270a24a
children 91f3ac205816 5e3a1b96dbb0
line wrap: on
line diff
--- a/mercurial/revlog.py	Sat Jun 02 15:35:53 2012 -0500
+++ b/mercurial/revlog.py	Fri Jun 01 17:05:31 2012 -0700
@@ -15,7 +15,7 @@
 from node import bin, hex, nullid, nullrev
 from i18n import _
 import ancestor, mdiff, parsers, error, util, dagutil
-import struct, zlib, errno, collections
+import struct, zlib, errno
 
 _pack = struct.pack
 _unpack = struct.unpack
@@ -362,7 +362,7 @@
         """return the set of all nodes ancestral to a given node, including
          the node itself, stopping when stop is matched"""
         reachable = set((node,))
-        visit = collections.deque([node])
+        visit = util.deque([node])
         if stop:
             stopn = self.rev(stop)
         else:
@@ -389,7 +389,7 @@
         an ancestor of itself.  Results are in breadth-first order:
         parents of each rev in revs, then parents of those, etc.  Result
         does not include the null revision."""
-        visit = collections.deque(revs)
+        visit = util.deque(revs)
         seen = set([nullrev])
         while visit:
             for parent in self.parentrevs(visit.popleft()):
@@ -447,7 +447,7 @@
 
         # take all ancestors from heads that aren't in has
         missing = set()
-        visit = collections.deque(r for r in heads if r not in has)
+        visit = util.deque(r for r in heads if r not in has)
         while visit:
             r = visit.popleft()
             if r in missing: