Patchwork [1,of,3] hgtagsfnodescache: handle nullid lookup

login
register
mail settings
Submitter Pierre-Yves David
Date May 2, 2019, 4:24 p.m.
Message ID <a753bc019c1ad7c5661a.1556814241@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/39921/
State Accepted
Headers show

Comments

Pierre-Yves David - May 2, 2019, 4:24 p.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 a753bc019c1ad7c5661a050adce49e4c3cd5a786
# Parent  bed4c308fc56e29181602c5c004483d5a878ed26
# EXP-Topic fnodecache
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r a753bc019c1a
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()