aboutsummaryrefslogtreecommitdiffhomepage
path: root/git-dch
diff options
context:
space:
mode:
Diffstat (limited to 'git-dch')
-rwxr-xr-xgit-dch41
1 files changed, 26 insertions, 15 deletions
diff --git a/git-dch b/git-dch
index 74c41540..d0dad92b 100755
--- 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)
@@ -41,7 +41,7 @@ def system(cmd):
def escape_commit(msg):
- return msg.replace('"','\\\"').replace("$","\$")
+ return msg.replace('"','\\\"').replace("$","\$").replace("`","\`")
def add_changelog_entry(msg, author, email):
@@ -215,35 +215,46 @@ 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:])
if options.snapshot and options.release:
- parser.error("--snapshot and --release are incompatible options")
+ parser.error("'--snapshot' and '--release' are incompatible options")
+
+ if options.since and options.auto:
+ parser.error("'--since' and '--auto' are incompatible options")
try:
if options.verbose:
@@ -277,7 +288,7 @@ def main(argv):
if args:
print "Only looking for changes on '%s'" % " ".join(args)
- commits = repo.commits(since, until, " ".join(args), options.git_log)
+ commits = repo.commits(since, until, " ".join(args), options.git_log.split(" "))
if commits:
if cp['Distribution'] != "UNRELEASED" and not found_snapshot_header:
add_changelog_section(distribution="UNRELEASED", msg="UNRELEASED")