summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xgit-debrebase38
-rw-r--r--git-debrebase.1.pod21
-rw-r--r--git-debrebase.5.pod1
-rwxr-xr-xtests/tests/gdr-subcommands7
4 files changed, 64 insertions, 3 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;
diff --git a/git-debrebase.1.pod b/git-debrebase.1.pod
index 9f82a7c..5da5320 100644
--- a/git-debrebase.1.pod
+++ b/git-debrebase.1.pod
@@ -188,6 +188,27 @@ that its command line syntax is optimal.
We may want to introduce an incompatible replacement syntax
under the name C<new-upstream>.
+=item git-debrebase make-patches
+
+Generate patches in debian/patches/
+representing the changes made to upstream files.
+
+It is not normally necessary to run this command explicitly.
+When uploading to Debian,
+dgit and git-debrebase
+will cooperate to regenerate patches as necessary.
+When working with pure git remotes,
+the patches are not needed.
+
+Normally git-debrebase make-patches will
+require a laundered branch.
+(A laundered branch does not contain any patches.)
+But if there are already some patches made by
+git-debrebase make-patches,
+and all that has happened is that more
+changes to upstream files have been committed,
+running it again can add the missing patches.
+
=item git-debrebase convert-from-gbp [<upstream-commit-ish>]
Cnnverts a gbp patches-unapplied branch
diff --git a/git-debrebase.5.pod b/git-debrebase.5.pod
index 6ae094f..5cfa376 100644
--- a/git-debrebase.5.pod
+++ b/git-debrebase.5.pod
@@ -501,6 +501,7 @@ The full set of annotations is:
[git-debrebase upstream-combine . PIECE[ PIECE...]: new upstream]
[git-debrebase anchor: new upstream NEW-UPSTREAM-VERSION, merge]
[git-debrebase: new upstream NEW-UPSTREAM-VERSION, changelog]
+ [git-debrebase: export and commit patches]
[git-debrebase convert-from-gbp: drop patches]
[git-debrebase anchor: declare upstream]
diff --git a/tests/tests/gdr-subcommands b/tests/tests/gdr-subcommands
index 2a90cdc..9d50b6c 100755
--- a/tests/tests/gdr-subcommands
+++ b/tests/tests/gdr-subcommands
@@ -138,7 +138,7 @@ make_check () {
git reset --hard HEAD^1
;;
P*)
- t-dgit -wgf --quilt=check quilt-fixup
+ t-dgit -wgf --quilt=nofix quilt-fixup
git diff HEAD~ debian/patches | egrep .
git diff --quiet HEAD~ -- ':.' ':!debian/patches'
git reset --hard HEAD~
@@ -160,6 +160,7 @@ make_check () {
}
Ec="F:No ongoing git-debrebase session"
+Ep="F:Patch export produced patch amendments"
# input state:
# stitched? st'd st'd unst'd unst'd
@@ -174,8 +175,8 @@ subcmd stitch Ns Nu Sltf Stf
subcmd prepush Ns Nu Sltf Stf
subcmd quick ns Sl Sltf Sl
subcmd conclude "$Ec" "$Ec" Sltf Sl
-#subcmd make-patches sPft sPft uPft uPft
-#subcmd dgit-upload-hook Psft Psft SPft SPft
+subcmd make-patches sPft "$Ep" uPft "$Ep"
+#subcmd dgit-upload-hook Psft "$Ep" SPft "$Ep"
#
# result codes, each one is a check:
# E:$pat } this is an error (must come first)