py3: use dict.update() instead of constructing lists and adding them
authorPulkit Goyal <7895pulkit@gmail.com>
Thu, 01 Jun 2017 01:14:02 +0530
changeset 32640 aeac3cbcbbc1
parent 32639 c2fe2b00db53
child 32641 49e1e5acb8ff
py3: use dict.update() instead of constructing lists and adding them dict.items() returned a list on Python 2 and whereas on Python 3 it returns a view object. So we required a work around. Using dict.update() is better then constructing lists as it should save us on gc churns.
mercurial/copies.py
--- a/mercurial/copies.py	Fri Feb 03 15:02:27 2017 +0100
+++ b/mercurial/copies.py	Thu Jun 01 01:14:02 2017 +0530
@@ -419,8 +419,10 @@
     for f in u2u:
         _checkcopies(c2, c1, f, base, tca, dirtyc2, limit, data2)
 
-    copy = dict(data1['copy'].items() + data2['copy'].items())
-    fullcopy = dict(data1['fullcopy'].items() + data2['fullcopy'].items())
+    copy = dict(data1['copy'])
+    copy.update(data2['copy'])
+    fullcopy = dict(data1['fullcopy'])
+    fullcopy.update(data2['fullcopy'])
 
     if dirtyc1:
         _combinecopies(data2['incomplete'], data1['incomplete'], copy, diverge,