Patchwork [3,of,5,"] hgtagsfnodescache: handle nullid lookup

login
register
mail settings
Submitter Pierre-Yves David
Date March 11, 2019, 9:24 a.m.
Message ID <85680409790f231f5865.1552296242@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/39207/
State Accepted
Headers show

Comments

Pierre-Yves David - March 11, 2019, 9:24 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@octobus.net>
# Date 1552262978 -3600
#      Mon Mar 11 01:09:38 2019 +0100
# Node ID 85680409790f231f5865d76dab00efc0ccd42901
# Parent  d3b70c96c0fec26e452925592a5e916e943a7abd
# EXP-Topic fnodecache
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 85680409790f
hgtagsfnodescache: handle nullid lookup

The null revision is empty, so it `.hgtags` content is `nullid` in regards with
the `hgtagsfnodescache`. Dealing with `nullid` will help with the next
changeset. Before this change, feeding `nullid` to `hgtagsfnodescache.getfnode` would
return a wrong result (fnode for tip).

Patch

diff --git a/mercurial/tags.py b/mercurial/tags.py
--- a/mercurial/tags.py
+++ b/mercurial/tags.py
@@ -691,6 +691,9 @@  class hgtagsfnodescache(object):
         If an .hgtags does not exist at the specified revision, nullid is
         returned.
         """
+        if node == nullid:
+            return nullid
+
         ctx = self._repo[node]
         rev = ctx.rev()