merge with stable
authorMatt Mackall <mpm@selenic.com>
Thu, 12 Nov 2015 20:48:41 -0600
changeset 26946 3309714ded26
parent 26944 ef5bab63af85 (current diff)
parent 26945 8a256cee72c8 (diff)
child 26947 fdfc50d09e8d
merge with stable
--- 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