Commits

WAKAYAMA shirou committed 5ae0663

add 'branch' option.

  • Participants
  • Parent commits 7d0a52c

Comments (0)

Files changed (1)

sphinxcontrib/hg_changelog.py

 class HgChangeLog(Directive):
     has_content = True
     required_arguments = 0
-    optional_arguments = 2
+    optional_arguments = 3
     final_argument_whitespace = False
     option_spec = {
         'max_commits': directives.positive_int,
-        'repo_root_path': directives.unchanged_required
+        'repo_root_path': directives.unchanged_required,
+        'branch': directives.unchanged_required
     }
     
     def run(self):
         max_commits = 10
         if 'max_commits' in self.options:
             max_commits = self.options['max_commits']
-        
+
+        branch = "default"
+        if 'branch' in self.options:
+            branch = self.options['branch']
+
         for commit in commits[:max_commits]:
             ctx = repo.changectx(commit)
+            if ctx.branch() != branch:
+                continue
             item = nodes.list_item()
             item += [ nodes.strong(text=ctx.description()),
                       nodes.inline(text=" by "),