2058 islink=fctx.islink(), isexec=fctx.isexec(), |
2058 islink=fctx.islink(), isexec=fctx.isexec(), |
2059 copied=copied, memctx=memctx) |
2059 copied=copied, memctx=memctx) |
2060 |
2060 |
2061 return getfilectx |
2061 return getfilectx |
2062 |
2062 |
|
2063 def memfilefrompatch(patchstore): |
|
2064 """Given a patch (e.g. patchstore object) return a memfilectx |
|
2065 |
|
2066 This is a convenience method for building a memctx based on a patchstore. |
|
2067 """ |
|
2068 def getfilectx(repo, memctx, path): |
|
2069 data, mode, copied = patchstore.getfile(path) |
|
2070 if data is None: |
|
2071 return None |
|
2072 islink, isexec = mode |
|
2073 return memfilectx(repo, path, data, islink=islink, |
|
2074 isexec=isexec, copied=copied, |
|
2075 memctx=memctx) |
|
2076 |
|
2077 return getfilectx |
|
2078 |
2063 class memctx(committablectx): |
2079 class memctx(committablectx): |
2064 """Use memctx to perform in-memory commits via localrepo.commitctx(). |
2080 """Use memctx to perform in-memory commits via localrepo.commitctx(). |
2065 |
2081 |
2066 Revision information is supplied at initialization time while |
2082 Revision information is supplied at initialization time while |
2067 related files data and is made available through a callback |
2083 related files data and is made available through a callback |