def _compose(segments, revision, absolute):
    """
    Recombines a decomposed path into a path string.

    This method expects a valid set of path segments (as exported by decompose()).

    :param segments: Path segments.
    :param revision: Revision number.
    :param absolute: True if the path is absolute, False if path is relative.
    :return: A valid path string.
    """
    new_path = '/'.join(segments)
    if absolute:
        new_path = '/' + new_path
    elif not new_path:
        new_path = '.'
    if revision:
        new_path += ':' + str(revision)
    return new_path
