Mercurial > hg
diff mercurial/context.py @ 20035:cd79d9ab5e42
makememctx: move from patch to context to break import cycle
author | Augie Fackler <raf@durin42.com> |
---|---|
date | Wed, 06 Nov 2013 22:09:15 -0500 |
parents | d51c4d85ec23 |
children | d0097d5818f9 |
line wrap: on
line diff
--- a/mercurial/context.py Wed Nov 06 16:48:06 2013 -0500 +++ b/mercurial/context.py Wed Nov 06 22:09:15 2013 -0500 @@ -195,6 +195,21 @@ def dirty(self): return False +def makememctx(repo, parents, text, user, date, branch, files, store, + editor=None): + def getfilectx(repo, memctx, path): + data, (islink, isexec), copied = store.getfile(path) + return memfilectx(path, data, islink=islink, isexec=isexec, + copied=copied) + extra = {} + if branch: + extra['branch'] = encoding.fromlocal(branch) + ctx = memctx(repo, parents, text, files, getfilectx, user, + date, extra) + if editor: + ctx._text = editor(repo, ctx, []) + return ctx + class changectx(basectx): """A changecontext object makes access to data related to a particular changeset convenient. It represents a read-only context already present in