From: Ian Jackson Date: Wed, 29 Oct 2014 17:53:13 +0000 (+0000) Subject: quilt patchification: Break out quiltify() (nfc) X-Git-Tag: debian/0.30~290 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=commitdiff_plain;h=3b8d3ae177321d340de16b1dced5c9d262e56f72;hp=1b2c10f57b0257aac61a696378e9c8c05df8bf4f quilt patchification: Break out quiltify() (nfc) --- diff --git a/dgit b/dgit index 6d346207..87a03800 100755 --- a/dgit +++ b/dgit @@ -2031,6 +2031,38 @@ our $dscfn; our $fakeeditorenv = 'DGIT_FAKE_EDITOR_QUILT'; +sub quiltify ($$) { + my ($clogp,$headref) = @_; + + my $author = getfield $clogp, 'Maintainer'; + my $time = time; + my $ncommits = 3; + my $patchname = "auto-$version-$headref-$time"; + my $msg = cmdoutput @git, qw(log), "-n$ncommits"; + mkpath '.git/dgit'; + my $descfn = ".git/dgit/quilt-description.tmp"; + open O, '>', $descfn or die "$descfn: $!"; + $msg =~ s/\n/\n /g; + $msg =~ s/^\s+$/ ./mg; + print O <{Version}) + Last (up to) $ncommits git changes, FYI: + . + $msg +Author: $author + +--- + +END + close O or die $!; + { + local $ENV{'EDITOR'} = cmdoutput qw(realpath --), $0; + local $ENV{'VISUAL'} = $ENV{'EDITOR'}; + local $ENV{$fakeeditorenv} = cmdoutput qw(realpath --), $descfn; + runcmd_ordryrun_local @dpkgsource, qw(--commit .), $patchname; + } +} + sub build_maybe_quilt_fixup () { my $format=get_source_format; return unless madformat $format; @@ -2149,33 +2181,7 @@ END rename '../fake/.pc','.pc' or die $!; } - my $author = getfield $clogp, 'Maintainer'; - my $time = time; - my $ncommits = 3; - my $patchname = "auto-$version-$headref-$time"; - my $msg = cmdoutput @git, qw(log), "-n$ncommits"; - mkpath '.git/dgit'; - my $descfn = ".git/dgit/quilt-description.tmp"; - open O, '>', $descfn or die "$descfn: $!"; - $msg =~ s/\n/\n /g; - $msg =~ s/^\s+$/ ./mg; - print O <{Version}) - Last (up to) $ncommits git changes, FYI: - . - $msg -Author: $author - ---- - -END - close O or die $!; - { - local $ENV{'EDITOR'} = cmdoutput qw(realpath --), $0; - local $ENV{'VISUAL'} = $ENV{'EDITOR'}; - local $ENV{$fakeeditorenv} = cmdoutput qw(realpath --), $descfn; - runcmd_ordryrun_local @dpkgsource, qw(--commit .), $patchname; - } + quiltify($clogp,$headref); if (!open P, '>>', ".pc/applied-patches") { $!==&ENOENT or die $!;