comparison mercurial/metadata.py @ 45592:3d5b2b8e93fd

changing-files: move default constructor value to None According to Augie Fackler, using tuple as default value confuse PyType when actual values are passed at init time. Differential Revision: https://phab.mercurial-scm.org/D9086
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 24 Sep 2020 09:32:07 +0200
parents 7543b5072e84
children e5578dbe36cb
comparison
equal deleted inserted replaced
45591:c35db907363d 45592:3d5b2b8e93fd
38 38
39 See their inline help for details. 39 See their inline help for details.
40 """ 40 """
41 41
42 def __init__( 42 def __init__(
43 self, touched=(), added=(), removed=(), p1_copies=(), p2_copies=(), 43 self,
44 touched=None,
45 added=None,
46 removed=None,
47 p1_copies=None,
48 p2_copies=None,
44 ): 49 ):
45 self._added = set(added) 50 self._added = set(() if added is None else added)
46 self._removed = set(removed) 51 self._removed = set(() if removed is None else removed)
47 self._touched = set(touched) 52 self._touched = set(() if touched is None else touched)
48 self._touched.update(self._added) 53 self._touched.update(self._added)
49 self._touched.update(self._removed) 54 self._touched.update(self._removed)
50 self._p1_copies = dict(p1_copies) 55 self._p1_copies = dict(() if p1_copies is None else p1_copies)
51 self._p2_copies = dict(p2_copies) 56 self._p2_copies = dict(() if p2_copies is None else p2_copies)
52 57
53 def __eq__(self, other): 58 def __eq__(self, other):
54 return ( 59 return (
55 self.added == other.added 60 self.added == other.added
56 and self.removed == other.removed 61 and self.removed == other.removed