# HG changeset patch # User Steve Losh # Date 1254693131 14400 # Node ID f090d7d568a4ff155ffdcfa22eb2b00d28641120 # Parent 9639f74d4c7f525119ee63125f5c1eabbed656e6 Add more functionality to the API. diff -r 9639f74d4c7f -r f090d7d568a4 review/api.py --- a/review/api.py Sun Oct 04 17:33:58 2009 -0400 +++ b/review/api.py Sun Oct 04 17:52:11 2009 -0400 @@ -34,6 +34,15 @@ def _commitfunc(ui, repo, message, match, opts): return repo.commit(message, opts.get('user'), opts.get('date'), match) +def _match(start): + return lambda fn: fn.startswith(start) + +def _parse_comment_data(data): + return None + +def _parse_signoffdata(data): + return None + class ReviewDatastore(object): '''The data store for all the reviews so far.''' @@ -86,13 +95,22 @@ self.ui = ui self.node = node - if '%s/.exists' % node in self.repo['tip']: - pass + if '%s/.exists' % self.node in self.repo['tip']: + relevant = filter(_match(node), self.repo['tip']) + commentfns = filter(_match('%s/comments' % node), relevant) + signofffns = filter(_match('%s/signoffs' % node), relevant) + + self.comments = [ _parse_comment_data(self.repo['tip'][fn].data()) + for fn in commentfns ] + self.signoffs = [ _parse_signoff_data(self.repo['tip'][fn].data()) + for fn in signofffns ] + + print self.comments, self.signoffs else: self.comments = [] self.signoffs = [] - path = os.path.join(self.repo.root, node) + path = os.path.join(self.repo.root, self.node) os.mkdir(path) with open(os.path.join(path, '.exists'), 'w') as e: pass