Details
Details
- Reviewers
- None
- Group Reviewers
hg-reviewers - Commits
- rHG8843bc1fc14d: absorb: migrate to new method for getting copy info
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | hgext/absorb.py (10 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
Martin von Zweigbergk | Feb 23 2019, 12:15 PM |
pctx = ctx | pctx = ctx | ||||
break | break | ||||
fctx = ctx[path] | fctx = ctx[path] | ||||
fctxs.append(fctx) | fctxs.append(fctx) | ||||
if fctx in seenfctxs: # treat fctx as the immutable one | if fctx in seenfctxs: # treat fctx as the immutable one | ||||
pctx = None # do not add another immutable fctx | pctx = None # do not add another immutable fctx | ||||
break | break | ||||
fctxmap[ctx] = fctx # only for mutable fctxs | fctxmap[ctx] = fctx # only for mutable fctxs | ||||
renamed = fctx.renamed() | copy = fctx.copysource() | ||||
if renamed: | if copy: | ||||
path = renamed[0] # follow rename | path = copy # follow rename | ||||
if path in ctx: # but do not follow copy | if path in ctx: # but do not follow copy | ||||
pctx = ctx.p1() | pctx = ctx.p1() | ||||
break | break | ||||
if pctx is not None: # need an extra immutable fctx | if pctx is not None: # need an extra immutable fctx | ||||
if path in pctx: | if path in pctx: | ||||
fctxs.append(pctx[path]) | fctxs.append(pctx[path]) | ||||
else: | else: | ||||
if path not in self.basectx: | if path not in self.basectx: | ||||
return None, None, None | return None, None, None | ||||
fctx = self.basectx[path] | fctx = self.basectx[path] | ||||
if path in self.memworkingcopy: | if path in self.memworkingcopy: | ||||
content = self.memworkingcopy[path] | content = self.memworkingcopy[path] | ||||
else: | else: | ||||
content = fctx.data() | content = fctx.data() | ||||
mode = (fctx.islink(), fctx.isexec()) | mode = (fctx.islink(), fctx.isexec()) | ||||
renamed = fctx.renamed() # False or (path, node) | copy = fctx.copysource() | ||||
return content, mode, (renamed and renamed[0]) | return content, mode, copy | ||||
def overlaycontext(memworkingcopy, ctx, parents=None, extra=None): | def overlaycontext(memworkingcopy, ctx, parents=None, extra=None): | ||||
"""({path: content}, ctx, (p1node, p2node)?, {}?) -> memctx | """({path: content}, ctx, (p1node, p2node)?, {}?) -> memctx | ||||
memworkingcopy overrides file contents. | memworkingcopy overrides file contents. | ||||
""" | """ | ||||
# parents must contain 2 items: (node1, node2) | # parents must contain 2 items: (node1, node2) | ||||
if parents is None: | if parents is None: | ||||
parents = ctx.repo().changelog.parents(ctx.node()) | parents = ctx.repo().changelog.parents(ctx.node()) |