import gbp.tmpfile as tempfile
from gbp.config import GbpOptionParserRpm
from gbp.rpm.git import GitRepositoryError, RpmGitRepository
-from gbp.git.modifier import GitModifier
+from gbp.git.modifier import GitModifier, GitTz
from gbp.command_wrappers import GitCommand, CommandExecFailed
from gbp.errors import GbpError
import gbp.log
start = merge_sha1
print start
- start_sha1 = repo.rev_parse("%s^0" % 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))
- # Squash commits, if requested
- if squash[0]:
- if squash[0] == 'HEAD':
- squash[0] = end_commit
- squash_sha1 = repo.rev_parse("%s^0" % squash[0])
- if start_sha1 != squash_sha1:
- if not squash_sha1 in repo.get_commits(start, end_commit):
- raise GbpError("Given squash point '%s' not in the history "
- "of end commit '%s'" % (squash[0], end_commit))
- # Shorten SHA1s
- squash_sha1 = repo.rev_parse(squash_sha1, short=7)
- start_sha1 = repo.rev_parse(start_sha1, short=7)
- gbp.log.info("Squashing commits %s..%s into one monolithic diff" %
- (start_sha1, squash_sha1))
- patch_fn = format_diff(outdir, squash[1], repo,
- start_sha1, squash_sha1)
- if patch_fn:
- patches.append(patch_fn)
- start = squash_sha1
-
# Generate patches
for commit in reversed(repo.get_commits(start, end_commit)):
info = repo.get_commit_info(commit)