Mercurial > hg
comparison hgext/uncommit.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 | 98f97eb20597 |
children | f01101100043 |
comparison
equal
deleted
inserted
replaced
35399:dffc35a5be9f | 35400:8a0cac20a1ad |
---|---|
75 if dst in files) | 75 if dst in files) |
76 def filectxfn(repo, memctx, path, contentctx=ctx, redirect=()): | 76 def filectxfn(repo, memctx, path, contentctx=ctx, redirect=()): |
77 if path not in contentctx: | 77 if path not in contentctx: |
78 return None | 78 return None |
79 fctx = contentctx[path] | 79 fctx = contentctx[path] |
80 mctx = context.memfilectx(repo, fctx.path(), fctx.data(), | 80 mctx = context.memfilectx(repo, memctx, fctx.path(), fctx.data(), |
81 fctx.islink(), | 81 fctx.islink(), |
82 fctx.isexec(), | 82 fctx.isexec(), |
83 copied=copied.get(path)) | 83 copied=copied.get(path)) |
84 return mctx | 84 return mctx |
85 | 85 |