mercurial/util.py
changeset 27576 6cd3044985c2
parent 27391 4eeef1b2d689
child 27667 37df458d60c2
--- a/mercurial/util.py	Thu Dec 31 09:55:56 2015 +0100
+++ b/mercurial/util.py	Wed Dec 30 13:10:53 2015 -0800
@@ -622,6 +622,15 @@
 
         self._cache.clear()
 
+    def copy(self):
+        result = lrucachedict(self._capacity)
+        n = self._head.prev
+        # Iterate in oldest-to-newest order, so the copy has the right ordering
+        for i in range(len(self._cache)):
+            result[n.key] = n.value
+            n = n.prev
+        return result
+
     def _movetohead(self, node):
         """Mark a node as the newest, making it the new head.