'Analyze the contents of the HG dirstate and extract filenames.
:param body: The contents of the file to analyze.
:return: A list of filenames found.'

def hg_dirstate(self, body):

    filenames = set()
    offset = 53
    while (offset < len(body)):
        (length,) = struct.unpack('>I', body[offset:(offset + 4)])
        if (length > (len(body) - offset)):
            return set()
        offset += 4
        filename = body[offset:(offset + length)]
        offset += (length + 13)
        filenames.add(filename)
    return filenames
