Mercurial > hg-stable
diff contrib/synthrepo.py @ 35407: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 | 2123e7629ec0 |
children | 238646784294 |
line wrap: on
line diff
--- a/contrib/synthrepo.py Sat Dec 09 14:22:12 2017 -0800 +++ b/contrib/synthrepo.py Mon Dec 11 09:27:40 2017 -0800 @@ -376,7 +376,7 @@ dir = os.path.dirname(dir) def filectxfn(repo, memctx, path): - return context.memfilectx(repo, path, files[path]) + return context.memfilectx(repo, memctx, path, files[path]) ui.progress(_synthesizing, None) message = 'synthesized wide repo with %d files' % (len(files),) @@ -468,7 +468,7 @@ def filectxfn(repo, memctx, path): if path not in changes: return None - return context.memfilectx(repo, path, changes[path]) + return context.memfilectx(repo, memctx, path, changes[path]) if not changes: continue if revs: