Permalink
Browse files

Sections now provide content history

  • Loading branch information...
1 parent babc787 commit eba427c3b40824e8ace17290fddd6441088b61ea @obmarg committed May 29, 2012
Showing with 17 additions and 0 deletions.
  1. +17 −0 doc.py
View
17 doc.py
@@ -33,6 +33,23 @@ def CurrentContent( self ):
blob = self.repo[ oid ]
return blob.data
+ def ContentHistory( self ):
+ '''
+ Generator function that returns the history of this section
+
+ This niavely assumes there's only one parent commit
+ on each commit, which will do for now.
+ '''
+ current = self.headCommit
+ while True:
+ oid = current.tree[ 0 ].oid
+ yield self.repo[ oid ].data
+ if current.parents:
+ # current has at least one parent
+ current = current.parents[ 0 ]
+ else:
+ break
+
def SetContent( self, newContent ):
'''
Adds a new version of the section

0 comments on commit eba427c

Please sign in to comment.