Mercurial > public > mercurial-scm > hg
comparison mercurial/debugcommands.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 | dffc35a5be9f |
children | cd3392cb5818 |
comparison
equal
deleted
inserted
replaced
35399:dffc35a5be9f | 35400:8a0cac20a1ad |
---|---|
223 files.append(fn) | 223 files.append(fn) |
224 filecontent[fn] = p2[fn].data() | 224 filecontent[fn] = p2[fn].data() |
225 | 225 |
226 def fctxfn(repo, cx, path): | 226 def fctxfn(repo, cx, path): |
227 if path in filecontent: | 227 if path in filecontent: |
228 return context.memfilectx(repo, path, filecontent[path]) | 228 return context.memfilectx(repo, cx, path, |
229 filecontent[path]) | |
229 return None | 230 return None |
230 | 231 |
231 if len(ps) == 0 or ps[0] < 0: | 232 if len(ps) == 0 or ps[0] < 0: |
232 pars = [None, None] | 233 pars = [None, None] |
233 elif len(ps) == 1: | 234 elif len(ps) == 1: |