comparison hgext/absorb.py @ 41778:8843bc1fc14d

absorb: migrate to new method for getting copy info Differential Revision: https://phab.mercurial-scm.org/D6018
author Martin von Zweigbergk <martinvonz@google.com>
date Sat, 23 Feb 2019 09:15:36 -0800
parents 876494fd967d
children a008e0af892e
comparison
equal deleted inserted replaced
41777:c3a249c2b6b3 41778:8843bc1fc14d
189 fctxs.append(fctx) 189 fctxs.append(fctx)
190 if fctx in seenfctxs: # treat fctx as the immutable one 190 if fctx in seenfctxs: # treat fctx as the immutable one
191 pctx = None # do not add another immutable fctx 191 pctx = None # do not add another immutable fctx
192 break 192 break
193 fctxmap[ctx] = fctx # only for mutable fctxs 193 fctxmap[ctx] = fctx # only for mutable fctxs
194 renamed = fctx.renamed() 194 copy = fctx.copysource()
195 if renamed: 195 if copy:
196 path = renamed[0] # follow rename 196 path = copy # follow rename
197 if path in ctx: # but do not follow copy 197 if path in ctx: # but do not follow copy
198 pctx = ctx.p1() 198 pctx = ctx.p1()
199 break 199 break
200 200
201 if pctx is not None: # need an extra immutable fctx 201 if pctx is not None: # need an extra immutable fctx
230 if path in self.memworkingcopy: 230 if path in self.memworkingcopy:
231 content = self.memworkingcopy[path] 231 content = self.memworkingcopy[path]
232 else: 232 else:
233 content = fctx.data() 233 content = fctx.data()
234 mode = (fctx.islink(), fctx.isexec()) 234 mode = (fctx.islink(), fctx.isexec())
235 renamed = fctx.renamed() # False or (path, node) 235 copy = fctx.copysource()
236 return content, mode, (renamed and renamed[0]) 236 return content, mode, copy
237 237
238 def overlaycontext(memworkingcopy, ctx, parents=None, extra=None): 238 def overlaycontext(memworkingcopy, ctx, parents=None, extra=None):
239 """({path: content}, ctx, (p1node, p2node)?, {}?) -> memctx 239 """({path: content}, ctx, (p1node, p2node)?, {}?) -> memctx
240 memworkingcopy overrides file contents. 240 memworkingcopy overrides file contents.
241 """ 241 """