[PATCH 4 of 5 manifest-cleanup] manifest: simplify manifest.add() by making args required
Augie Fackler
raf at durin42.com
Wed Oct 8 17:06:52 UTC 2014
# HG changeset patch
# User Augie Fackler <raf at durin42.com>
# Date 1412783550 14400
# Wed Oct 08 11:52:30 2014 -0400
# Node ID 75b7741a8978d751cf8984540b1383e866bcf6fa
# Parent 10a4ddd5c5df656da859aceb84d7c424cc2b5c40
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 @@
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 @@
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 @@
arraytext = array.array('c', text)
cachedelta = None
else:
- added, removed = changed
addlist = self._mancache[p1][1]
_checkforbidden(added)
More information about the Mercurial-devel
mailing list