Mercurial > hg
comparison mercurial/metadata.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 | dde86beca388 |
comparison
equal
deleted
inserted
replaced
46112:d6afa9c149c3 | 46113:59fa3890d40a |
---|---|
9 from __future__ import absolute_import, print_function | 9 from __future__ import absolute_import, print_function |
10 | 10 |
11 import multiprocessing | 11 import multiprocessing |
12 import struct | 12 import struct |
13 | 13 |
14 from .node import ( | |
15 nullid, | |
16 nullrev, | |
17 ) | |
14 from . import ( | 18 from . import ( |
15 error, | 19 error, |
16 node, | |
17 pycompat, | 20 pycompat, |
18 util, | 21 util, |
19 ) | 22 ) |
20 | 23 |
21 from .revlogutils import ( | 24 from .revlogutils import ( |
237 | 240 |
238 def compute_all_files_changes(ctx): | 241 def compute_all_files_changes(ctx): |
239 """compute the files changed by a revision""" | 242 """compute the files changed by a revision""" |
240 p1 = ctx.p1() | 243 p1 = ctx.p1() |
241 p2 = ctx.p2() | 244 p2 = ctx.p2() |
242 if p1.rev() == node.nullrev and p2.rev() == node.nullrev: | 245 if p1.rev() == nullrev and p2.rev() == nullrev: |
243 return _process_root(ctx) | 246 return _process_root(ctx) |
244 elif p1.rev() != node.nullrev and p2.rev() == node.nullrev: | 247 elif p1.rev() != nullrev and p2.rev() == nullrev: |
245 return _process_linear(p1, ctx) | 248 return _process_linear(p1, ctx) |
246 elif p1.rev() == node.nullrev and p2.rev() != node.nullrev: | 249 elif p1.rev() == nullrev and p2.rev() != nullrev: |
247 # In the wild, one can encounter changeset where p1 is null but p2 is not | 250 # In the wild, one can encounter changeset where p1 is null but p2 is not |
248 return _process_linear(p1, ctx, parent=2) | 251 return _process_linear(p1, ctx, parent=2) |
249 elif p1.rev() == p2.rev(): | 252 elif p1.rev() == p2.rev(): |
250 # In the wild, one can encounter such "non-merge" | 253 # In the wild, one can encounter such "non-merge" |
251 return _process_linear(p1, ctx) | 254 return _process_linear(p1, ctx) |
421 | 424 |
422 cahs = ctx.repo().changelog.commonancestorsheads( | 425 cahs = ctx.repo().changelog.commonancestorsheads( |
423 p1_ctx.node(), p2_ctx.node() | 426 p1_ctx.node(), p2_ctx.node() |
424 ) | 427 ) |
425 if not cahs: | 428 if not cahs: |
426 cahs = [node.nullrev] | 429 cahs = [nullrev] |
427 mas = [ctx.repo()[r].manifest() for r in cahs] | 430 mas = [ctx.repo()[r].manifest() for r in cahs] |
428 | 431 |
429 copy_candidates = [] | 432 copy_candidates = [] |
430 | 433 |
431 # Dealing with case 🄰 happens automatically. Since there are no entry in | 434 # Dealing with case 🄰 happens automatically. Since there are no entry in |
558 def mas(): | 561 def mas(): |
559 p1n = p1.node() | 562 p1n = p1.node() |
560 p2n = p2.node() | 563 p2n = p2.node() |
561 cahs = ctx.repo().changelog.commonancestorsheads(p1n, p2n) | 564 cahs = ctx.repo().changelog.commonancestorsheads(p1n, p2n) |
562 if not cahs: | 565 if not cahs: |
563 cahs = [node.nullrev] | 566 cahs = [nullrev] |
564 return [ctx.repo()[r].manifest() for r in cahs] | 567 return [ctx.repo()[r].manifest() for r in cahs] |
565 | 568 |
566 def deletionfromparent(f): | 569 def deletionfromparent(f): |
567 if f in m1: | 570 if f in m1: |
568 return f not in m2 and all( | 571 return f not in m2 and all( |
595 return merged | 598 return merged |
596 for f in ctx.files(): | 599 for f in ctx.files(): |
597 if f in ctx: | 600 if f in ctx: |
598 fctx = ctx[f] | 601 fctx = ctx[f] |
599 parents = fctx._filelog.parents(fctx._filenode) | 602 parents = fctx._filelog.parents(fctx._filenode) |
600 if parents[1] != node.nullid: | 603 if parents[1] != nullid: |
601 merged.append(f) | 604 merged.append(f) |
602 return merged | 605 return merged |
603 | 606 |
604 | 607 |
605 def computechangesetcopies(ctx): | 608 def computechangesetcopies(ctx): |