use option groups
authorGuido Guenther <agx@sigxcpu.org>
Thu, 17 Jul 2008 16:12:33 +0000 (13:42 -0230)
committerGuido Guenther <agx@sigxcpu.org>
Fri, 18 Jul 2008 12:48:47 +0000 (10:18 -0230)
git-dch

diff --git a/git-dch b/git-dch
index 74c415401608f3d928aadaf59fd1fbe036fcfa17..b07d689e07ed4ca658c59e165904ce8d82f2e6a4 100755 (executable)
--- a/git-dch
+++ b/git-dch
@@ -25,7 +25,7 @@ import shutil
 import subprocess
 import gbp.command_wrappers as gbpc
 from gbp.git_utils import (GitRepositoryError, GitRepository, build_tag)
-from gbp.config import GbpOptionParser
+from gbp.config import GbpOptionParser, GbpOptionGroup
 from gbp.errors import GbpError
 from gbp.deb_utils import parse_changelog
 from gbp.command_wrappers import (Command, CommandExecFailed)
@@ -215,29 +215,37 @@ def main(argv):
 
     parser = GbpOptionParser(command=os.path.basename(argv[0]), prefix='',
                              usage='%prog [options] paths')
+    range_group = GbpOptionGroup(parser, "commit range options", "which commits to add to the changelog")
+    version_group = GbpOptionGroup(parser, "release & version number options", "what version number and release to use")
+    commit_group = GbpOptionGroup(parser, "commit message formatting", "howto format the changelog entries")
+    parser.add_option_group(range_group)
+    parser.add_option_group(version_group)
+    parser.add_option_group(commit_group)
 
     parser.add_config_file_option(option_name="debian-branch", dest='debian_branch',
                       help="branch the debian patch is being developed on, default is '%(debian-branch)s'")
+    parser.add_config_file_option(option_name="upstream-tag", dest="upstream_tag",
+                      help="format string for upstream tags, default is '%(upstream-tag)s'")
     parser.add_config_file_option(option_name="debian-tag", dest="debian_tag",
-                      help="Format string for debian tags, default is '%(debian-tag)s'")
+                      help="format string for debian tags, default is '%(debian-tag)s'")
     parser.add_config_file_option(option_name="snapshot-number", dest="snapshot_number",
-                      help="Expression to determine the next snapshot number, default is '%(snapshot-number)s'")
+                      help="expression to determine the next snapshot number, default is '%(snapshot-number)s'")
     parser.add_config_file_option(option_name="git-log", dest="git_log",
                       help="options to pass to git-log, default is '%(git-log)s'")
     parser.add_option("-v", "--verbose", action="store_true", dest="verbose", default=False,
                       help="verbose command execution")
-    parser.add_option("-s", "--since", dest="since", help="commit to start from")
-    parser.add_option("-R", "--release", action="store_true", dest="release", default=False,
+    range_group.add_option("-s", "--since", dest="since", help="commit to start from (e.g. HEAD^^^, debian/0.4.3)")
+    range_group.add_option("-a", "--auto", action="store_true", dest="auto", default=False,
+                      help="autocomplete changelog from last snapshot or tag")
+    version_group.add_option("-R", "--release", action="store_true", dest="release", default=False,
                       help="mark as release")
-    parser.add_option("-S", "--snapshot", action="store_true", dest="snapshot", default=False,
+    version_group.add_option("-S", "--snapshot", action="store_true", dest="snapshot", default=False,
                       help="mark as snapshot build")
-    parser.add_option("-a", "--auto", action="store_true", dest="auto", default=False,
-                      help="autocomplete changelog from last snapshot or tag")
-    parser.add_config_file_option(option_name="meta", dest="meta",
+    commit_group.add_config_file_option(option_name="meta", dest="meta",
                       help="parse meta tags in commit messages, default is '%(meta)s'", action="store_true")
-    parser.add_option("--full", action="store_false", dest="short", default=True,
-                      help="include the full commit message")
-    parser.add_config_file_option(option_name="id-length", dest="idlen",
+    commit_group.add_option("--full", action="store_false", dest="short", default=True,
+                      help="include the full commit message instead of only the first line")
+    commit_group.add_config_file_option(option_name="id-length", dest="idlen",
                       help="include N digits of the commit id in the changelog entry, default is '%(id-length)s'",
                       type="int", metavar="N")
     (options, args) = parser.parse_args(argv[1:])