comparison hgext/histedit.py @ 35400:8a0cac20a1ad

memfilectx: make changectx argument mandatory in constructor (API) committablefilectx has three subclasses: workingfilectx, memfilectx, and overlayfilectx. committablefilectx takes an optional (change) ctx instance to its constructor. If it's provided, it's set on the instance as self._changectx. If not, that property is supposed to be defined by the class. However, only workingfilectx does that. The other two will have the property undefined if it's not passed in the constructor. That seems bad to me. This patch makes the changectx argument to the memfilectx constructor mandatory because that fixes the failure I ran into. It seems like we should also fix the overlayfilectx case. Differential Revision: https://phab.mercurial-scm.org/D1658
author Martin von Zweigbergk <martinvonz@google.com>
date Mon, 11 Dec 2017 09:27:40 -0800
parents a9cc233de513
children a51541681b8d
comparison
equal deleted inserted replaced
35399:dffc35a5be9f 35400:8a0cac20a1ad
600 headmf = last.manifest() 600 headmf = last.manifest()
601 def filectxfn(repo, ctx, path): 601 def filectxfn(repo, ctx, path):
602 if path in headmf: 602 if path in headmf:
603 fctx = last[path] 603 fctx = last[path]
604 flags = fctx.flags() 604 flags = fctx.flags()
605 mctx = context.memfilectx(repo, 605 mctx = context.memfilectx(repo, ctx,
606 fctx.path(), fctx.data(), 606 fctx.path(), fctx.data(),
607 islink='l' in flags, 607 islink='l' in flags,
608 isexec='x' in flags, 608 isexec='x' in flags,
609 copied=copied.get(path)) 609 copied=copied.get(path))
610 return mctx 610 return mctx