changeset 26946:3309714ded26

merge with stable
author Matt Mackall <mpm@selenic.com>
date Thu, 12 Nov 2015 20:48:41 -0600
parents ef5bab63af85 (current diff) 8a256cee72c8 (diff)
children fdfc50d09e8d
files
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/tags.py	Tue Nov 10 15:08:56 2015 -0800
+++ b/mercurial/tags.py	Thu Nov 12 20:48:41 2015 -0600
@@ -221,9 +221,13 @@
     '''
     filetags, nodelines = _readtaghist(ui, repo, lines, fn, recode=recode,
                                        calcnodelines=calcnodelines)
+    # util.sortdict().__setitem__ is much slower at replacing then inserting
+    # new entries. The difference can matter if there are thousands of tags.
+    # Create a new sortdict to avoid the performance penalty.
+    newtags = util.sortdict()
     for tag, taghist in filetags.items():
-        filetags[tag] = (taghist[-1], taghist[:-1])
-    return filetags
+        newtags[tag] = (taghist[-1], taghist[:-1])
+    return newtags
 
 def _updatetags(filetags, tagtype, alltags, tagtypes):
     '''Incorporate the tag info read from one file into the two