summaryrefslogtreecommitdiff
path: root/git-debrebase
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2018-04-23 00:32:43 +0100
committerIan Jackson <ijackson@chiark.greenend.org.uk>2018-06-16 22:40:13 +0100
commit6b3cdcf0d595efd96bc8c4220df87f7fd5aaef76 (patch)
treebd3c750df0facbea69e2e23c10f810c010fa456e /git-debrebase
parent759d9092784d1aea335bd277e930c8f50ef0a493 (diff)
git-debrebase: Implement make-patches
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Diffstat (limited to 'git-debrebase')
-rwxr-xr-xgit-debrebase38
1 files changed, 38 insertions, 0 deletions
diff --git a/git-debrebase b/git-debrebase
index 7d5d5bd..7c8d54d 100755
--- a/git-debrebase
+++ b/git-debrebase
@@ -1362,6 +1362,44 @@ sub make_patches_staged ($) {
};
}
+sub make_patches ($) {
+ my ($head) = @_;
+ keycommits $head, 0, \&snag;
+ make_patches_staged $head;
+ my $out;
+ in_workarea sub {
+ my $ptree = cmdoutput @git, qw(write-tree --prefix=debian/patches/);
+ runcmd @git, qw(read-tree), $head;
+ read_tree_subdir 'debian/patches', $ptree;
+ $out = make_commit [$head], [
+ 'Commit patch queue (exported by git-debrebase)',
+ '[git-debrebase: export and commit patches]',
+ ];
+ };
+ my $d = get_differs $head, $out;
+ if ($d == 0) {
+ return undef; # nothing to do
+ } elsif ($d == D_PAT_ADD) {
+ return $out; # OK
+ } else {
+ fail "Patch export produced patch amendments".
+ " (abandoned output commit $out).".
+ " Try laundering first.";
+ }
+}
+
+sub cmd_make_patches () {
+ badusage "no arguments allowed" if @ARGV;
+ my $old_head = get_head();
+ my $new = make_patches $old_head;
+ snags_maybe_bail();
+ if (!$new) {
+ fail "No (more) patches to export." unless $opt_noop_ok;
+ return;
+ }
+ update_head_checkout $old_head, $new, 'make-patches';
+}
+
sub cmd_convert_from_gbp () {
badusage "needs 1 optional argument, the upstream git rev"
unless @ARGV<=1;