aboutsummaryrefslogtreecommitdiffhomepage
path: root/git-dch
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2010-07-23 11:43:49 +0200
committerGuido Günther <agx@sigxcpu.org>2010-07-23 11:45:10 +0200
commitba1d35fbe1b0e420fba65c1eb8bb929d476af2fa (patch)
tree9fc356e3bf6f4f767ad3837fdd8388135d77886b /git-dch
parent48ba671b4e8748e5e53d9d62038cd91e047fda30 (diff)
Use repo.rev_parse
Git-Dch: Ignore
Diffstat (limited to 'git-dch')
-rwxr-xr-xgit-dch14
1 files changed, 6 insertions, 8 deletions
diff --git a/git-dch b/git-dch
index 07c9179c..fad8030c 100755
--- a/git-dch
+++ b/git-dch
@@ -1,7 +1,7 @@
#!/usr/bin/python -u
# vim: set fileencoding=utf-8 :
#
-# (C) 2007, 2008, 2009 Guido Guenther <agx@sigxcpu.org>
+# (C) 2007, 2008, 2009, 2010 Guido Guenther <agx@sigxcpu.org>
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
@@ -118,11 +118,9 @@ def fixup_trailer(repo, git_author=False):
spawn_dch(msg='', author=author, email=email)
-def head_commit():
+def head_commit(repo):
"""get the full sha1 of the last commit on HEAD"""
- commit = subprocess.Popen([ 'git', 'log', 'HEAD^..' ], stdout=subprocess.PIPE).stdout
- sha = commit.readline().split()[-1]
- return sha
+ return repo.rev_parse('HEAD')
def snapshot_version(version):
@@ -187,12 +185,12 @@ def do_release(changelog, cp):
spawn_dch(release=True)
-def do_snapshot(changelog, next_snapshot):
+def do_snapshot(changelog, repo, next_snapshot):
"""
Add new snapshot banner to most recent changelog section. The next snapshot
number is calculated by eval()'ing next_snapshot
"""
- commit = head_commit()
+ commit = head_commit(repo)
cp = parse_changelog(changelog)
(release, snapshot) = snapshot_version(cp['Version'])
@@ -435,7 +433,7 @@ def main(argv):
if options.release:
do_release(changelog, cp)
elif options.snapshot:
- (snap, version) = do_snapshot(changelog, options.snapshot_number)
+ (snap, version) = do_snapshot(changelog, repo, options.snapshot_number)
print "Changelog has been prepared for snapshot #%d at %s" % (snap, version)
except (GbpError, GitRepositoryError, NoChangelogError), err: