# HG changeset patch # User Martin von Zweigbergk # Date 1424727662 28800 # Node ID dd8c891dd09a8279fc18715c675beff1ff2c10e4 # Parent 28af978c8f13a73180eb47c3e55ae92f588579d9 manifest: make copy logic local to copy() The optional arguments to the manfifestdict constructor are only used by copy(), so assign the fields from that method instead so it's clear that the arguments are not used for anything else. diff -r 28af978c8f13 -r dd8c891dd09a mercurial/manifest.py --- a/mercurial/manifest.py Sat Feb 21 00:40:18 2015 -0500 +++ b/mercurial/manifest.py Mon Feb 23 13:41:02 2015 -0800 @@ -10,13 +10,8 @@ import array, struct class manifestdict(dict): - def __init__(self, mapping=None, flags=None): - if mapping is None: - mapping = {} - if flags is None: - flags = {} - dict.__init__(self, mapping) - self._flags = flags + def __init__(self): + self._flags = {} def __setitem__(self, k, v): assert v is not None dict.__setitem__(self, k, v) @@ -26,7 +21,10 @@ """Set the flags (symlink, executable) for path f.""" self._flags[f] = flags def copy(self): - return manifestdict(self, dict.copy(self._flags)) + copy = manifestdict() + dict.__init__(copy, self) + copy._flags = dict.copy(self._flags) + return copy def intersectfiles(self, files): '''make a new manifestdict with the intersection of self with files