# HG changeset patch # User timeless@mozdev.org # Date 2015-09-04 09:57:58 # Node ID 5411059d93f8858ad965337cfa735da574246f71 # Parent 1a781a986611a110219cbcadc8eafbb57a6d0c25 manifest: switch add() to heapq.merge (available in Py2.6+) diff --git a/mercurial/manifest.py b/mercurial/manifest.py --- a/mercurial/manifest.py +++ b/mercurial/manifest.py @@ -9,6 +9,7 @@ from i18n import _ import mdiff, parsers, error, revlog, util import array, struct import os +import heapq propertycache = util.propertycache @@ -970,12 +971,9 @@ class manifest(revlog.revlog): # revlog layer. _checkforbidden(added) - # combine the changed lists into one list for sorting - work = [(x, False) for x in added] - work.extend((x, True) for x in removed) - # this could use heapq.merge() (from Python 2.6+) or equivalent - # since the lists are already sorted - work.sort() + # combine the changed lists into one sorted iterator + work = heapq.merge([(x, False) for x in added], + [(x, True) for x in removed]) arraytext, deltatext = m.fastdelta(self._mancache[p1][1], work) cachedelta = self.rev(p1), deltatext