};
}
+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;
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
[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]
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~
}
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
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)