Mercurial > public > mercurial-scm > hg-stable
diff mercurial/metadata.py @ 46114:59fa3890d40a
node: import symbols explicitly
There is no point in lazy importing mercurial.node, it is used all over
the place anyway. So consistently import the used symbols directly.
Fix one file using symbols indirectly via mercurial.revlog.
Differential Revision: https://phab.mercurial-scm.org/D9480
author | Joerg Sonnenberger <joerg@bec.de> |
---|---|
date | Tue, 01 Dec 2020 21:54:46 +0100 |
parents | 89a2afe31e82 |
children | dde86beca388 |
line wrap: on
line diff
--- a/mercurial/metadata.py Sun Dec 13 18:29:22 2020 -0800 +++ b/mercurial/metadata.py Tue Dec 01 21:54:46 2020 +0100 @@ -11,9 +11,12 @@ import multiprocessing import struct +from .node import ( + nullid, + nullrev, +) from . import ( error, - node, pycompat, util, ) @@ -239,11 +242,11 @@ """compute the files changed by a revision""" p1 = ctx.p1() p2 = ctx.p2() - if p1.rev() == node.nullrev and p2.rev() == node.nullrev: + if p1.rev() == nullrev and p2.rev() == nullrev: return _process_root(ctx) - elif p1.rev() != node.nullrev and p2.rev() == node.nullrev: + elif p1.rev() != nullrev and p2.rev() == nullrev: return _process_linear(p1, ctx) - elif p1.rev() == node.nullrev and p2.rev() != node.nullrev: + elif p1.rev() == nullrev and p2.rev() != nullrev: # In the wild, one can encounter changeset where p1 is null but p2 is not return _process_linear(p1, ctx, parent=2) elif p1.rev() == p2.rev(): @@ -423,7 +426,7 @@ p1_ctx.node(), p2_ctx.node() ) if not cahs: - cahs = [node.nullrev] + cahs = [nullrev] mas = [ctx.repo()[r].manifest() for r in cahs] copy_candidates = [] @@ -560,7 +563,7 @@ p2n = p2.node() cahs = ctx.repo().changelog.commonancestorsheads(p1n, p2n) if not cahs: - cahs = [node.nullrev] + cahs = [nullrev] return [ctx.repo()[r].manifest() for r in cahs] def deletionfromparent(f): @@ -597,7 +600,7 @@ if f in ctx: fctx = ctx[f] parents = fctx._filelog.parents(fctx._filenode) - if parents[1] != node.nullid: + if parents[1] != nullid: merged.append(f) return merged