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

login
register
mail settings
Submitter Pierre-Yves David
Date June 10, 2017, 1:32 a.m.
Message ID <a0df0fa8e5b7bccd329d.1497058339@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/21309/
State Accepted
Headers show

Comments

Pierre-Yves David - June 10, 2017, 1:32 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@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.

Patch

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)