Exemplo n.º 1
0
    def nodechunk(self, flog, node, _prevnode, linknode):
        prefix = b""

        def getmeta():
            try:
                fileslog = flog.repo.fileslog
                meta = fileslog.contentstore.metadata(flog.filename, node)
                return meta
            except KeyError:
                pass
            return None

        meta = getmeta()
        if meta is not None:
            delta = self.pointer(meta, flog, node)
            flags = revlog.REVIDX_EXTSTORED
        else:
            delta = flog.revision(node, raw=True)
            flags = flog.flags(node)

        prefix = mdiff.trivialdiffheader(len(delta))

        p1, p2 = flog.parents(node)
        # We always send the full content, no deltas are used.
        meta = self.builddeltaheader(node, p1, p2, nullid, linknode, flags)
        meta += prefix
        l = len(meta) + len(delta)
        yield changegroup.chunkheader(l)
        yield meta
        yield delta
Exemplo n.º 2
0
 def nodechunk(self, revlog, node, prevnode, linknode):
     prefix = b""
     if prevnode is not nullid and not revlog.candelta(prevnode, node):
         basenode = nullid
     else:
         basenode = prevnode
     if basenode == nullid:
         delta = revlog.revision(node, raw=True)
         prefix = mdiff.trivialdiffheader(len(delta))
     else:
         # Actually uses remotefilelog.revdiff which works on nodes, not revs
         delta = revlog.revdiff(basenode, node)
     p1, p2 = revlog.parents(node)
     flags = revlog.flags(node)
     meta = self.builddeltaheader(node, p1, p2, basenode, linknode, flags)
     meta += prefix
     l = len(meta) + len(delta)
     yield changegroup.chunkheader(l)
     yield meta
     yield delta