view piecrust/admin/scm/base.py @ 853:f070a4fc033c

core: Continue PieCrust3 refactor, simplify pages. The asset pipeline is still the only function pipeline at this point. * No more `QualifiedPage`, and several other pieces of code deleted. * Data providers are simpler and more focused. For instance, the page iterator doesn't try to support other types of items. * Route parameters are proper known source metadata to remove the confusion between the two. * Make the baker and pipeline more correctly manage records and record histories. * Add support for record collapsing and deleting stale outputs in the asset pipeline.
author Ludovic Chabant <ludovic@chabant.com>
date Sun, 21 May 2017 00:06:59 -0700
parents 5e91bc0e3b4d
children
line wrap: on
line source



class RepoStatus(object):
    def __init__(self):
        self.new_files = []
        self.edited_files = []


class SourceControl(object):
    def __init__(self, root_dir, cfg):
        self.root_dir = root_dir
        self.config = cfg

    def getStatus(self):
        raise NotImplementedError()

    def commit(self, paths, message, *, author=None):
        if not message:
            raise ValueError("No message specified for committing changes.")
        author = author or self.config.get('author')
        self._doCommit(paths, message, author)

    def _doCommit(self, paths, message, author):
        raise NotImplementedError()


def _s(strs):
    """ Convert a byte array to string using UTF8 encoding. """
    if strs is None:
        return None
    assert isinstance(strs, bytes)
    return strs.decode('utf8')