comparison hgext/lfs/__init__.py @ 46113: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 5ced12cfa41b
comparison
equal deleted inserted replaced
46112:d6afa9c149c3 46113:59fa3890d40a
123 from __future__ import absolute_import 123 from __future__ import absolute_import
124 124
125 import sys 125 import sys
126 126
127 from mercurial.i18n import _ 127 from mercurial.i18n import _
128 from mercurial.node import bin
128 129
129 from mercurial import ( 130 from mercurial import (
130 bundlecaches, 131 bundlecaches,
131 config, 132 config,
132 context, 133 context,
135 exthelper, 136 exthelper,
136 filelog, 137 filelog,
137 filesetlang, 138 filesetlang,
138 localrepo, 139 localrepo,
139 minifileset, 140 minifileset,
140 node,
141 pycompat, 141 pycompat,
142 revlog, 142 revlog,
143 scmutil, 143 scmutil,
144 templateutil, 144 templateutil,
145 util, 145 util,
258 def checkrequireslfs(ui, repo, **kwargs): 258 def checkrequireslfs(ui, repo, **kwargs):
259 if b'lfs' in repo.requirements: 259 if b'lfs' in repo.requirements:
260 return 0 260 return 0
261 261
262 last = kwargs.get('node_last') 262 last = kwargs.get('node_last')
263 _bin = node.bin
264 if last: 263 if last:
265 s = repo.set(b'%n:%n', _bin(kwargs['node']), _bin(last)) 264 s = repo.set(b'%n:%n', bin(kwargs['node']), bin(last))
266 else: 265 else:
267 s = repo.set(b'%n', _bin(kwargs['node'])) 266 s = repo.set(b'%n', bin(kwargs['node']))
268 match = repo._storenarrowmatch 267 match = repo._storenarrowmatch
269 for ctx in s: 268 for ctx in s:
270 # TODO: is there a way to just walk the files in the commit? 269 # TODO: is there a way to just walk the files in the commit?
271 if any( 270 if any(
272 ctx[f].islfs() for f in ctx.files() if f in ctx and match(f) 271 ctx[f].islfs() for f in ctx.files() if f in ctx and match(f)