Add more functionality to the API.
    
        | author | Steve Losh <steve@stevelosh.com> | 
    
        | date | Sun, 04 Oct 2009 17:52:11 -0400 | 
    
    
        | parents | 9639f74d4c7f | 
    
        | children | ac3c440a29a4 | 
    
        | branches/tags | (none) | 
    
        | files | review/api.py | 
Changes
    
--- 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