From: Markus Lehtonen Date: Wed, 8 May 2013 17:42:45 +0000 (+0300) Subject: pq-rpm: support patch-export up to an arbitrary tree-ish X-Git-Tag: debian/0.6.26~38 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2d024bc03f8b8ab31bc477093e417d3d7a63e208;p=tools%2Fgit-buildpackage.git pq-rpm: support patch-export up to an arbitrary tree-ish If the end of the export range is not a commit "normal" patches are generated up to HEAD and finally a raw diff between HEAD and the end-tree-is generated. Signed-off-by: Markus Lehtonen Conflicts: gbp/scripts/pq_rpm.py --- diff --git a/gbp/scripts/pq_rpm.py b/gbp/scripts/pq_rpm.py index f0e75749..09ee9bc0 100755 --- a/gbp/scripts/pq_rpm.py +++ b/gbp/scripts/pq_rpm.py @@ -149,6 +149,19 @@ def generate_patches(repo, start, squash, end, outdir, options): start = merge_sha1 print start + try: + end_commit = end + end_commit_sha1 = repo.rev_parse("%s^0" % end_commit) + except GitRepositoryError: + # In case of plain tree-ish objects, assume current branch head is the + # last commit + end_commit = "HEAD" + end_commit_sha1 = repo.rev_parse("%s^0" % end_commit) + + start_sha1 = repo.rev_parse("%s^0" % start) + if repo.get_merge_base(start_sha1, end_commit_sha1) != start_sha1: + raise GbpError("Start commit '%s' not an ancestor of end commit " + "'%s'" % (start, end_commit)) # Generate patches for commit in reversed(repo.get_commits(start, end_commit)): info = repo.get_commit_info(commit)