summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gbp-rpm.conf4
-rw-r--r--gbp/config.py5
-rwxr-xr-xgbp/scripts/pq_rpm.py22
3 files changed, 22 insertions, 9 deletions
diff --git a/gbp-rpm.conf b/gbp-rpm.conf
index 05678e2f..3609f379 100644
--- a/gbp-rpm.conf
+++ b/gbp-rpm.conf
@@ -29,7 +29,7 @@
# Compress auto-generated patches
#patch-export-compress=100k
# Squash commits until certain tree-ish into one diff
-#patch-export-squash-until = stable-updates
+#patch-export-squash-until = stable-updates:stable
# Export patches with numbering in filenames
#patch-numbers = False
@@ -112,7 +112,7 @@
###
[gbp-pq-rpm]
# Name of the patch-queue / development branch
-pq-branch = %(branch)s-devel
+#pq-branch = %(branch)s-devel
###
### Options only affecting gbp-clone
diff --git a/gbp/config.py b/gbp/config.py
index a99b3ae1..9fe9a483 100644
--- a/gbp/config.py
+++ b/gbp/config.py
@@ -515,7 +515,10 @@ class GbpOptionParserRpm(GbpOptionParser):
'patch-export-compress':
"Compress (auto-generated) patches larger than given number of bytes, 0 never compresses, default is '%(patch-export-compress)s'",
'patch-export-squash-until':
- "Squash commits (from upstream) until given tree-ish into one big diff, default is '%(patch-export-squash-until)s'",
+ ("Squash commits (from upstream) until given tree-ish "
+ "into one big diff, format is "
+ "'<commit_ish>[:<filename_base>]'. "
+ "Default is '%(patch-export-squash-until)s'"),
'pristine-tarball-name':
"Filename to record to pristine-tar, set to 'auto' to not mangle the file name, default is '%(pristine-tarball-name)s'",
'orig-prefix':
diff --git a/gbp/scripts/pq_rpm.py b/gbp/scripts/pq_rpm.py
index 9d2440c7..c5139d43 100755
--- a/gbp/scripts/pq_rpm.py
+++ b/gbp/scripts/pq_rpm.py
@@ -108,7 +108,8 @@ def write_diff_file(repo, start, end, diff_filename):
raise GbpError, "Unable to create diff file"
-def generate_git_patches(repo, start, squash_point, end, outdir):
+def generate_git_patches(repo, start, squash_point, end, squash_diff_name,
+ outdir):
"""
Generate patch files from git
"""
@@ -127,10 +128,15 @@ def generate_git_patches(repo, start, squash_point, end, outdir):
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))
- diff_filename = os.path.join(outdir, '%s-to-%s.diff' % (start_sha1, squash_sha1))
- write_diff_file(repo, start_sha1, squash_sha1, diff_filename)
- patches.append(diff_filename)
+ if squash_diff_name:
+ diff_filename = squash_diff_name + ".diff"
+ else:
+ diff_filename = '%s-to-%s.diff' % (start_sha1, squash_sha1)
+ gbp.log.info("Squashing commits %s..%s into one monolithic '%s'" %
+ (start_sha1, squash_sha1, diff_filename))
+ diff_filepath = os.path.join(outdir, diff_filename)
+ write_diff_file(repo, start_sha1, squash_sha1, diff_filepath)
+ patches.append(diff_filepath)
start = squash_sha1
@@ -171,10 +177,14 @@ def update_patch_series(repo, spec, start, end, options):
"""
tmpdir = tempfile.mkdtemp(dir=options.tmp_dir, prefix='patchexport_')
# Create "vanilla" patches
+ squash = options.patch_export_squash_until.split(':', 1)
+ squash_point = squash[0]
+ squash_name = squash[1] if len(squash) > 1 else ""
patches = generate_git_patches(repo,
start,
- options.patch_export_squash_until,
+ squash_point,
end,
+ squash_name,
tmpdir)
# Unlink old patch files and generate new patches