aboutsummaryrefslogtreecommitdiffhomepage
path: root/git-dch
diff options
context:
space:
mode:
authorGuido Guenther <agx@sigxcpu.org>2007-10-07 12:51:10 +0200
committerGuido Guenther <agx@sigxcpu.org>2007-10-07 12:51:10 +0200
commit8abfcf4601c886a9c735caa618f5c581a131f561 (patch)
treeb3e4f677b901381f797c438b396506b13a4d70d0 /git-dch
parent2c86ebf57827e2e1efe08fc9a5c30b89ad943366 (diff)
Add a check for the debian branch instead of always using it as the tip
Diffstat (limited to 'git-dch')
-rwxr-xr-xgit-dch22
1 files changed, 14 insertions, 8 deletions
diff --git a/git-dch b/git-dch
index 3f34f4ce..9157b2f4 100755
--- a/git-dch
+++ b/git-dch
@@ -166,16 +166,17 @@ def shortlog_to_dch(changes):
def main(argv):
ret = 0
changelog = 'debian/changelog'
+ until = 'HEAD'
parser = GbpOptionParser(command=os.path.basename(argv[0]), prefix='')
- parser.add_config_file_option(option_name="debian-branch", dest='debian',
+ 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="debian-tag", dest="debian_tag",
help="Format string for debian tags, default is '%(debian-tag)s'")
parser.add_option("-v", "--verbose", action="store_true", dest="verbose", default=False,
help="verbose command execution")
- parser.add_option("-s", "--since", dest="from_commit", help="commit to start from")
+ parser.add_option("-s", "--since", dest="since", help="commit to start from")
parser.add_option("--release", action="store_true", dest="release", default=False,
help="mark as release")
parser.add_option("--snapshot", action="store_true", dest="snapshot", default=False,
@@ -194,17 +195,22 @@ def main(argv):
raise GbpError
try:
- GitRepository('.')
+ repo = GitRepository('.')
except GitRepositoryError:
raise GbpError, "%s is not a git repository" % (os.path.abspath('.'))
+ branch = repo.get_branch()
+ if options.debian_branch != branch:
+ print >>sys.stderr, "You are not on branch '%s' but on '%s'" % (options.debian_branch, branch)
+ raise GbpError, "Use --git-debian-branch to set the branch to pick changes from"
+
cp = parse_changelog(changelog)
- if options.from_commit:
- start = options.from_commit
+ if options.since:
+ since = options.since
else:
- start = build_tag(options.debian_tag, cp['Version'])
+ since = build_tag(options.debian_tag, cp['Version'])
- changes = get_log(start, options.debian)
+ changes = get_log(since, until)
if changes:
if cp['Distribution'] != "UNRELEASED":
add_changelog_section(distribution="UNRELEASED", msg="UNRELEASED")
@@ -213,7 +219,7 @@ def main(argv):
(snap, version) = snapshot(changelog)
print "Changelog has been prepared for snapshot #%d at %s" % (snap, version)
else:
- print "No changes detected from %s to %s." % (start, options.debian)
+ print "No changes detected from %s to %s." % (since, until)
if options.release:
release(changelog, cp)