# HG changeset patch # User Augie Fackler # Date 2014-10-08 15:52:30 # Node ID 4a13849ca35924369fd11f4c6020fc0f3480e48c # Parent 079a0ed5ee4aa3a24996d884edeeaac0167d483a manifest: simplify manifest.add() by making args required I verified that changed was never false (it was always a 2-tuple) by adding @@ -220,6 +225,8 @@ class manifest(revlog.revlog): def add(self, map, transaction, link, p1=None, p2=None, changed=None): + if not changed: + assert False, 'changed was %r' % changed # if we're using the cache, make sure it is valid and # parented by the same node we're diffing against if not (changed and p1 and (p1 in self._mancache)): and observing that the test suite still passed. Making all the arguments required should help future readers understand what's going on here. diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -1415,7 +1415,7 @@ class localrepository(object): for f in drop: del m1[f] mn = self.manifest.add(m1, trp, linkrev, p1.manifestnode(), - p2.manifestnode(), (new, drop)) + p2.manifestnode(), new, drop) files = changed + removed else: mn = p1.manifestnode() diff --git a/mercurial/manifest.py b/mercurial/manifest.py --- a/mercurial/manifest.py +++ b/mercurial/manifest.py @@ -159,11 +159,10 @@ class manifest(revlog.revlog): f, n = l.split('\0') return revlog.bin(n[:40]), n[40:-1] - def add(self, map, transaction, link, p1=None, p2=None, - changed=None): + def add(self, map, transaction, link, p1, p2, added, removed): # if we're using the cache, make sure it is valid and # parented by the same node we're diffing against - if not (changed and p1 and (p1 in self._mancache)): + if not (p1 and (p1 in self._mancache)): files = sorted(map) _checkforbidden(files) @@ -175,7 +174,6 @@ class manifest(revlog.revlog): arraytext = array.array('c', text) cachedelta = None else: - added, removed = changed addlist = self._mancache[p1][1] _checkforbidden(added)