Commits

WAKAYAMA shirou  committed 2cc8378

add max_commits option.

  • Participants
  • Parent commits f3d7513

Comments (0)

Files changed (1)

File sphinxcontrib/hg_changelog.py

 from mercurial import ui, hg, util
 
 class HgChangeLog(Directive):
-
+    has_content = True
+    required_arguments = 0
+    optional_arguments = 1
+    final_argument_whitespace = False
+    option_spec = {
+        'max_commits': int
+    }
+    
     def run(self):
         repo = hg.repository(ui.ui(), ".") # current repository
         l = nodes.bullet_list()
         commits = range(repo.changectx("tip").rev()+1)
         commits.reverse()
 
+        max_commits = 10
+        if 'max_commits' in self.options:
+            max_commits = self.options['max_commits']
+        
         for commit in commits[:max_commits]:
             ctx = repo.changectx(commit)
             item = nodes.list_item()