- filectx_tip = self._find_filectx(title)
- if filectx_tip is None:
- raise DocumentNotFound()
- #return -1, None, u'', u''
- rev = filectx_tip.filerev()
- filectx = filectx_tip.filectx(rev)
- date = datetime.datetime.fromtimestamp(filectx.date()[0])
- author = unicode(filectx.user(), "utf-8",
- 'replace').split('<')[0].strip()
- comment = unicode(filectx.description(), "utf-8", 'replace')
- return rev, date, author, comment
+ if fctx is None:
+ raise DocumentNotFound(title)
+
+ return {
+ "revision": fctx.filerev(),
+ "date": datetime.datetime.fromtimestamp(fctx.date()[0]),
+ "author": fctx.user().decode("utf-8", 'replace'),
+ "comment": fctx.description().decode("utf-8", 'replace'),
+ }