Mercurial > public > mercurial-scm > hg
comparison mercurial/cmdutil.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 | 82ee401135dd |
children | 786289423e97 |
comparison
equal
deleted
inserted
replaced
35399:dffc35a5be9f | 35400:8a0cac20a1ad |
---|---|
3193 if path in wctx.removed(): | 3193 if path in wctx.removed(): |
3194 return None | 3194 return None |
3195 | 3195 |
3196 fctx = wctx[path] | 3196 fctx = wctx[path] |
3197 flags = fctx.flags() | 3197 flags = fctx.flags() |
3198 mctx = context.memfilectx(repo, | 3198 mctx = context.memfilectx(repo, ctx_, |
3199 fctx.path(), fctx.data(), | 3199 fctx.path(), fctx.data(), |
3200 islink='l' in flags, | 3200 islink='l' in flags, |
3201 isexec='x' in flags, | 3201 isexec='x' in flags, |
3202 copied=copied.get(path)) | 3202 copied=copied.get(path)) |
3203 return mctx | 3203 return mctx |