[PATCH 1 of 6 V2] py3: use dict.update() instead of constructing lists and adding them
Pulkit Goyal
7895pulkit at gmail.com
Fri Jun 2 08:46:06 UTC 2017
# HG changeset patch
# User Pulkit Goyal <7895pulkit at gmail.com>
# Date 1496259842 -19800
# Thu Jun 01 01:14:02 2017 +0530
# Node ID 754e0b7e0ef3c73971b44e9c3fb76ab27206893a
# Parent 5492f3cf2e0c0606a83ca239f1ec3fc4d8b4e3f0
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.
diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -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,
More information about the Mercurial-devel
mailing list