Mercurial > piecrust2
diff foodtruck/scm/base.py @ 659:a77b4656c602
internal: Move some basic FoodTruck SCM code to the base.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sat, 27 Feb 2016 22:00:35 -0800 |
parents | 3cec8634209a |
children |
line wrap: on
line diff
--- a/foodtruck/scm/base.py Thu Feb 25 23:26:36 2016 -0800 +++ b/foodtruck/scm/base.py Sat Feb 27 22:00:35 2016 -0800 @@ -15,9 +15,19 @@ 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') +