comparison mercurial/copies.py @ 36155:c02771617a70

py3: avoid changing dictionary during iteration dict.items() and friends are iterators/views in Python 3. You aren't allowed to mutate the underlying dictionary when iterating on these views. So iterate over a copy of things. Differential Revision: https://phab.mercurial-scm.org/D2164
author Gregory Szorc <gregory.szorc@gmail.com>
date Sun, 11 Feb 2018 16:56:29 -0800
parents e54f02ec6a05
children f62369667a7c
comparison
equal deleted inserted replaced
36154:b587a889b97e 36155:c02771617a70
121 if v in src: 121 if v in src:
122 # file is a copy of an existing file 122 # file is a copy of an existing file
123 t[k] = v 123 t[k] = v
124 124
125 # remove criss-crossed copies 125 # remove criss-crossed copies
126 for k, v in t.items(): 126 for k, v in list(t.items()):
127 if k in src and v in dst: 127 if k in src and v in dst:
128 del t[k] 128 del t[k]
129 129
130 return t 130 return t
131 131