Details
Details
- Reviewers
durin42 - Group Reviewers
hg-reviewers - Commits
- rHGd7114f883505: node: rename wdirnodes to clarify they are for manifest/filelogs
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
durin42 |
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/context.py (4 lines) | |||
M | mercurial/copies.py (2 lines) | |||
M | mercurial/node.py (2 lines) |
from .node import ( | from .node import ( | ||||
addednodeid, | addednodeid, | ||||
bin, | bin, | ||||
hex, | hex, | ||||
modifiednodeid, | modifiednodeid, | ||||
nullid, | nullid, | ||||
nullrev, | nullrev, | ||||
short, | short, | ||||
wdirfilenodeids, | |||||
wdirid, | wdirid, | ||||
wdirnodes, | |||||
wdirrev, | wdirrev, | ||||
) | ) | ||||
from . import ( | from . import ( | ||||
dagop, | dagop, | ||||
encoding, | encoding, | ||||
error, | error, | ||||
fileset, | fileset, | ||||
match as matchmod, | match as matchmod, | ||||
continue | continue | ||||
(node1, flag1), (node2, flag2) = value | (node1, flag1), (node2, flag2) = value | ||||
if node1 is None: | if node1 is None: | ||||
added.append(fn) | added.append(fn) | ||||
elif node2 is None: | elif node2 is None: | ||||
removed.append(fn) | removed.append(fn) | ||||
elif flag1 != flag2: | elif flag1 != flag2: | ||||
modified.append(fn) | modified.append(fn) | ||||
elif node2 not in wdirnodes: | elif node2 not in wdirfilenodeids: | ||||
# When comparing files between two commits, we save time by | # When comparing files between two commits, we save time by | ||||
# not comparing the file contents when the nodeids differ. | # not comparing the file contents when the nodeids differ. | ||||
# Note that this means we incorrectly report a reverted change | # Note that this means we incorrectly report a reverted change | ||||
# to a file as a modification. | # to a file as a modification. | ||||
modified.append(fn) | modified.append(fn) | ||||
elif self[fn].cmp(other[fn]): | elif self[fn].cmp(other[fn]): | ||||
modified.append(fn) | modified.append(fn) | ||||
else: | else: |
ac = getattr(ctx, '_ancestrycontext', None) | ac = getattr(ctx, '_ancestrycontext', None) | ||||
if ac is None: | if ac is None: | ||||
revs = [rev] | revs = [rev] | ||||
if rev is None: | if rev is None: | ||||
revs = [p.rev() for p in ctx.parents()] | revs = [p.rev() for p in ctx.parents()] | ||||
ac = repo.changelog.ancestors(revs, inclusive=True) | ac = repo.changelog.ancestors(revs, inclusive=True) | ||||
ctx._ancestrycontext = ac | ctx._ancestrycontext = ac | ||||
def makectx(f, n): | def makectx(f, n): | ||||
if n in node.wdirnodes: # in a working context? | if n in node.wdirfilenodeids: # in a working context? | ||||
if ctx.rev() is None: | if ctx.rev() is None: | ||||
return ctx.filectx(f) | return ctx.filectx(f) | ||||
return repo[None][f] | return repo[None][f] | ||||
fctx = repo.filectx(f, fileid=n) | fctx = repo.filectx(f, fileid=n) | ||||
# setup only needed for filectx not create from a changectx | # setup only needed for filectx not create from a changectx | ||||
fctx._ancestrycontext = ac | fctx._ancestrycontext = ac | ||||
fctx._descendantrev = rev | fctx._descendantrev = rev | ||||
return fctx | return fctx |
nullhex = hex(nullid) | nullhex = hex(nullid) | ||||
# Phony node value to stand-in for new files in some uses of | # Phony node value to stand-in for new files in some uses of | ||||
# manifests. | # manifests. | ||||
newnodeid = '!' * 20 | newnodeid = '!' * 20 | ||||
addednodeid = ('0' * 15) + 'added' | addednodeid = ('0' * 15) + 'added' | ||||
modifiednodeid = ('0' * 12) + 'modified' | modifiednodeid = ('0' * 12) + 'modified' | ||||
wdirnodes = {newnodeid, addednodeid, modifiednodeid} | wdirfilenodeids = {newnodeid, addednodeid, modifiednodeid} | ||||
# pseudo identifiers for working directory | # pseudo identifiers for working directory | ||||
# (they are experimental, so don't add too many dependencies on them) | # (they are experimental, so don't add too many dependencies on them) | ||||
wdirrev = 0x7fffffff | wdirrev = 0x7fffffff | ||||
wdirid = b"\xff" * 20 | wdirid = b"\xff" * 20 | ||||
wdirhex = hex(wdirid) | wdirhex = hex(wdirid) | ||||
def short(node): | def short(node): | ||||
return hex(node[:6]) | return hex(node[:6]) |