tags: support reading tags cache without populating
An upcoming patch will teach the bundle2 protocol to transfer .hgtags
fnodes to the client. We don't want this to incur any extra work
at serve time. Create an optional cache query mode that doesn't
populate the cache as a side-effect.
--- a/mercurial/tags.py Sun May 31 17:41:35 2015 -0700
+++ b/mercurial/tags.py Mon May 25 16:24:23 2015 -0700
@@ -442,11 +442,13 @@
self._raw.pop()
self._dirtyoffset = len(self._raw)
- def getfnode(self, node):
+ def getfnode(self, node, computemissing=True):
"""Obtain the filenode of the .hgtags file at a specified revision.
If the value is in the cache, the entry will be validated and returned.
- Otherwise, the filenode will be computed and returned.
+ Otherwise, the filenode will be computed and returned unless
+ "computemissing" is False, in which case None will be returned without
+ any potentially expensive computation being performed.
If an .hgtags does not exist at the specified revision, nullid is
returned.
@@ -470,7 +472,12 @@
# Fall through.
- # If we get here, the entry is either missing or invalid. Populate it.
+ # If we get here, the entry is either missing or invalid.
+
+ if not computemissing:
+ return None
+
+ # Populate missing entry.
try:
fnode = ctx.filenode('.hgtags')
except error.LookupError: