# HG changeset patch # User Martin von Zweigbergk # Date 1485845936 28800 # Node ID 0126e422450e28efd7303767ef1363e6fbd2f210 # Parent 312b861924c89716d9bdd28dd8698665ef6d0498 util: make sortdict.keys() return a copy dict.keys() is documented to return a copy, so it's surprising that sortdict.keys() did not. I noticed this because we have an extension that calls readlocaltags(). That method tries to remove any tags that point to non-existent revisions (most likely stripped). However, since it's unintentionally working on the instance it's modifying, it sometimes fails to remove tags when there are multiple bad tags in a row. This was not caught because localrepo.tags() does an additional layer of filtering. sortdict is also used in other places, but I have not checked whether its keys() and/or __delitem__() methods are used there. diff -r 312b861924c8 -r 0126e422450e mercurial/util.py --- a/mercurial/util.py Mon Jan 30 22:50:20 2017 +0900 +++ b/mercurial/util.py Mon Jan 30 22:58:56 2017 -0800 @@ -550,7 +550,7 @@ except ValueError: pass def keys(self): - return self._list + return self._list[:] def iterkeys(self): return self._list.__iter__() def iteritems(self):