comparison tests/drawdag.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 dda2341d6664
children d55b71393907
comparison
equal deleted inserted replaced
46112:d6afa9c149c3 46113:59fa3890d40a
84 84
85 import collections 85 import collections
86 import itertools 86 import itertools
87 import re 87 import re
88 88
89 from mercurial.node import nullid
89 from mercurial.i18n import _ 90 from mercurial.i18n import _
90 from mercurial import ( 91 from mercurial import (
91 context, 92 context,
92 error, 93 error,
93 node,
94 obsolete, 94 obsolete,
95 pycompat, 95 pycompat,
96 registrar, 96 registrar,
97 scmutil, 97 scmutil,
98 tags as tagsmod, 98 tags as tagsmod,
297 } 297 }
298 super(simplecommitctx, self).__init__(repo, name, **opts) 298 super(simplecommitctx, self).__init__(repo, name, **opts)
299 self._added = added 299 self._added = added
300 self._parents = parentctxs 300 self._parents = parentctxs
301 while len(self._parents) < 2: 301 while len(self._parents) < 2:
302 self._parents.append(repo[node.nullid]) 302 self._parents.append(repo[nullid])
303 303
304 def filectx(self, key): 304 def filectx(self, key):
305 return simplefilectx(key, self._added[key]) 305 return simplefilectx(key, self._added[key])
306 306
307 def commit(self): 307 def commit(self):
386 filere = re.compile(br'^(\w+)/([\w/]+)\s*=\s*(.*)$', re.M) 386 filere = re.compile(br'^(\w+)/([\w/]+)\s*=\s*(.*)$', re.M)
387 for name, path, content in filere.findall(b'\n'.join(comments)): 387 for name, path, content in filere.findall(b'\n'.join(comments)):
388 content = content.replace(br'\n', b'\n').replace(br'\1', b'\1') 388 content = content.replace(br'\n', b'\n').replace(br'\1', b'\1')
389 files[name][path] = content 389 files[name][path] = content
390 390
391 committed = {None: node.nullid} # {name: node} 391 committed = {None: nullid} # {name: node}
392 392
393 # for leaf nodes, try to find existing nodes in repo 393 # for leaf nodes, try to find existing nodes in repo
394 for name, parents in edges.items(): 394 for name, parents in edges.items():
395 if len(parents) == 0: 395 if len(parents) == 0:
396 try: 396 try: