fix errors in pq_rpm.py
authorJun Wang <junbill.wang@samsung.com>
Mon, 1 Feb 2016 13:43:27 +0000 (21:43 +0800)
committerJun Wang <junbill.wang@samsung.com>
Mon, 1 Feb 2016 13:43:27 +0000 (21:43 +0800)
Change-Id: Ie8acc86904b75387bf3fbe203ba3b62eeec74c5b

gbp/scripts/pq_rpm.py

index a329edd..e19218a 100755 (executable)
@@ -30,7 +30,7 @@ import subprocess
 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
@@ -148,40 +148,6 @@ def generate_patches(repo, start, squash, end, outdir, options):
             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)