Beispiel #1
0
def getfilectx(repo, memctx, f):
    fctx = memctx.parents()[0][f]
    data, flags = fctx.data(), fctx.flags()
    if f == "foo":
        data += "bar\n"
    return context.memfilectx(repo, memctx, f, data, "l" in flags, "x"
                              in flags)
Beispiel #2
0
 def filectxfn(repo, ctx, path):
     if path in headmf:
         fctx = head[path]
         flags = fctx.flags()
         mctx = context.memfilectx(
             repo,
             ctx,
             fctx.path(),
             fctx.data(),
             islink="l" in flags,
             isexec="x" in flags,
             copied=copied.get(path),
         )
         return mctx
     return None
Beispiel #3
0
 def getfilectx(repo, memctx, f):
     if p2ctx and f in p2files and f not in copies:
         self.ui.debug("reusing %s from p2\n" % f)
         try:
             return p2ctx[f]
         except error.ManifestLookupError:
             # If the file doesn't exist in p2, then we're syncing a
             # delete, so just return None.
             return None
     try:
         v = files[f]
     except KeyError:
         return None
     data, mode = source.getfile(f, v)
     if data is None:
         return None
     return context.memfilectx(self.repo, memctx, f, data, "l" in mode,
                               "x" in mode, copies.get(f))
Beispiel #4
0
 def getfilectx(repo, memctx, path):
     assert path in commit.filechanges
     entry = commit.filechanges[path]
     if entry is None:
         # deleted
         return None
     else:
         # changed or created
         mode, content, copysource = entry
         return context.memfilectx(
             repo,
             memctx,
             path,
             content,
             islink=("l" in mode),
             isexec=("x" in mode),
             copied=copysource,
         )
Beispiel #5
0
 def getfile(repo, memctx, path):
     change = path2filechange.get(path)
     if change is None:
         return repo[parent][path]
     if change == "Deletion" or change == "UntrackedDeletion":
         return None
     elif "Change" in change or "UntrackedChange" in change:
         change = change.get("Change") or change["UntrackedChange"]
         token = change["upload_token"]
         key = token2cacheable(token)
         if key not in cache:
             # Possible future optimisation: Download files in parallel
             cache[key] = repo.edenapi.downloadfiletomemory(token)
         islink = change["file_type"] == "Symlink"
         isexec = change["file_type"] == "Executable"
         return memfilectx(repo,
                           None,
                           path,
                           data=cache[key],
                           islink=islink,
                           isexec=isexec)
     else:
         raise error.Abort(_("Unknown file change {}").format(change))
Beispiel #6
0
 def filectxfn(repo, memctx, path):
     if path not in changes:
         return None
     return context.memfilectx(repo, memctx, path, changes[path])
Beispiel #7
0
 def filectxfn(repo, memctx, path):
     return context.memfilectx(repo, memctx, path, files[path])
Beispiel #8
0
def filectxfn(repo, memctx, path):
    return context.memfilectx(repo, memctx, "foo", b"")