Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/patch.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 | 8abee656e14c |
children | e51d4aedace9 |
comparison
equal
deleted
inserted
replaced
16833:7b460b49bf7b | 16834:cafd8a8fb713 |
---|---|
10 import tempfile, zlib, shutil | 10 import tempfile, zlib, shutil |
11 | 11 |
12 from i18n import _ | 12 from i18n import _ |
13 from node import hex, nullid, short | 13 from node import hex, nullid, short |
14 import base85, mdiff, scmutil, util, diffhelpers, copies, encoding, error | 14 import base85, mdiff, scmutil, util, diffhelpers, copies, encoding, error |
15 import collections, context | 15 import context |
16 | 16 |
17 gitre = re.compile('diff --git a/(.*) b/(.*)') | 17 gitre = re.compile('diff --git a/(.*) b/(.*)') |
18 | 18 |
19 class PatchError(Exception): | 19 class PatchError(Exception): |
20 pass | 20 pass |
1595 if not node1 and not node2: | 1595 if not node1 and not node2: |
1596 node1 = repo.dirstate.p1() | 1596 node1 = repo.dirstate.p1() |
1597 | 1597 |
1598 def lrugetfilectx(): | 1598 def lrugetfilectx(): |
1599 cache = {} | 1599 cache = {} |
1600 order = collections.deque() | 1600 order = util.deque() |
1601 def getfilectx(f, ctx): | 1601 def getfilectx(f, ctx): |
1602 fctx = ctx.filectx(f, filelog=cache.get(f)) | 1602 fctx = ctx.filectx(f, filelog=cache.get(f)) |
1603 if f not in cache: | 1603 if f not in cache: |
1604 if len(cache) > 20: | 1604 if len(cache) > 20: |
1605 del cache[order.popleft()] | 1605 del cache[order.popleft()] |