[PATCH 2 of 4] checkheads: use 'nodemap.get' to convert nodes to revs

Pierre-Yves David pierre-yves.david at ens-lyon.org
Fri Jun 9 21:32:19 EDT 2017


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at octobus.net>
# Date 1496672420 -3600
#      Mon Jun 05 15:20:20 2017 +0100
# Node ID a0df0fa8e5b7bccd329d3546e54ba488ca89e035
# Parent  a3ee0f19258d0c7565cfb436112e74740dab1d80
# EXP-Topic skipctx
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r a0df0fa8e5b7
checkheads: use 'nodemap.get' to convert nodes to revs

We are about to call 'torev' on node that might be locally missing. In this
case, 'nodemap.revs' will return None (something valid in our usecase) while
'changelog.rev' would raise an exception.

We make this change in a distinct changeset to show it does not impact the
tests.

diff --git a/mercurial/discovery.py b/mercurial/discovery.py
--- a/mercurial/discovery.py
+++ b/mercurial/discovery.py
@@ -439,7 +439,7 @@ def _postprocessobsolete(pushop, futurec
     repo = pushop.repo
     unfi = repo.unfiltered()
     tonode = unfi.changelog.node
-    torev = unfi.changelog.rev
+    torev = unfi.changelog.nodemap.get
     public = phases.public
     getphase = unfi._phasecache.phase
     ispublic = (lambda r: getphase(unfi, r) == public)


More information about the Mercurial-devel mailing list