manifest: rename dir to tree to avoid shadowing built-in
And update the argument name in the imanifestlog interface.
Differential Revision: https://phab.mercurial-scm.org/D4268
--- a/mercurial/manifest.py Thu Aug 09 19:27:54 2018 -0700
+++ b/mercurial/manifest.py Fri Aug 10 11:00:06 2018 -0700
@@ -1435,31 +1435,31 @@
"""
return self.get('', node)
- def get(self, dir, node, verify=True):
+ def get(self, tree, node, verify=True):
"""Retrieves the manifest instance for the given node. Throws a
LookupError if not found.
`verify` - if True an exception will be thrown if the node is not in
the revlog
"""
- if node in self._dirmancache.get(dir, ()):
- return self._dirmancache[dir][node]
+ if node in self._dirmancache.get(tree, ()):
+ return self._dirmancache[tree][node]
if not self._narrowmatch.always():
- if not self._narrowmatch.visitdir(dir[:-1] or '.'):
- return excludeddirmanifestctx(dir, node)
- if dir:
+ if not self._narrowmatch.visitdir(tree[:-1] or '.'):
+ return excludeddirmanifestctx(tree, node)
+ if tree:
if self._revlog._treeondisk:
if verify:
- dirlog = self._revlog.dirlog(dir)
+ dirlog = self._revlog.dirlog(tree)
if node not in dirlog.nodemap:
raise LookupError(node, dirlog.indexfile,
_('no node'))
- m = treemanifestctx(self, dir, node)
+ m = treemanifestctx(self, tree, node)
else:
raise error.Abort(
_("cannot ask for manifest directory '%s' in a flat "
- "manifest") % dir)
+ "manifest") % tree)
else:
if verify:
if node not in self._revlog.nodemap:
@@ -1471,10 +1471,10 @@
m = manifestctx(self, node)
if node != revlog.nullid:
- mancache = self._dirmancache.get(dir)
+ mancache = self._dirmancache.get(tree)
if not mancache:
mancache = util.lrucachedict(self._cachesize)
- self._dirmancache[dir] = mancache
+ self._dirmancache[tree] = mancache
mancache[node] = m
return m
--- a/mercurial/repository.py Thu Aug 09 19:27:54 2018 -0700
+++ b/mercurial/repository.py Fri Aug 10 11:00:06 2018 -0700
@@ -1000,15 +1000,15 @@
interface.
"""
- def get(dir, node, verify=True):
+ def get(tree, node, verify=True):
"""Retrieve the manifest instance for a given directory and binary node.
``node`` always refers to the node of the root manifest (which will be
the only manifest if flat manifests are being used).
- If ``dir`` is the empty string, the root manifest is returned. Otherwise
- the manifest for the specified directory will be returned (requires
- tree manifests).
+ If ``tree`` is the empty string, the root manifest is returned.
+ Otherwise the manifest for the specified directory will be returned
+ (requires tree manifests).
If ``verify`` is True, ``LookupError`` is raised if the node is not
known.