comparison piecrust/admin/scm/base.py @ 778:5e91bc0e3b4d

internal: Move admin panel code into the piecrust package.
author Ludovic Chabant <ludovic@chabant.com>
date Sat, 16 Jul 2016 15:02:24 +0200
parents foodtruck/scm/base.py@a77b4656c602
children
comparison
equal deleted inserted replaced
777:8d633ca59bc5 778:5e91bc0e3b4d
1
2
3 class RepoStatus(object):
4 def __init__(self):
5 self.new_files = []
6 self.edited_files = []
7
8
9 class SourceControl(object):
10 def __init__(self, root_dir, cfg):
11 self.root_dir = root_dir
12 self.config = cfg
13
14 def getStatus(self):
15 raise NotImplementedError()
16
17 def commit(self, paths, message, *, author=None):
18 if not message:
19 raise ValueError("No message specified for committing changes.")
20 author = author or self.config.get('author')
21 self._doCommit(paths, message, author)
22
23 def _doCommit(self, paths, message, author):
24 raise NotImplementedError()
25
26
27 def _s(strs):
28 """ Convert a byte array to string using UTF8 encoding. """
29 if strs is None:
30 return None
31 assert isinstance(strs, bytes)
32 return strs.decode('utf8')
33