summaryrefslogtreecommitdiff
path: root/git-debrebase
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2018-07-08 18:37:34 +0100
committerIan Jackson <ijackson@chiark.greenend.org.uk>2018-07-09 00:24:48 +0100
commit9cda023c0c49449a1d5862483df8d785e062765b (patch)
tree237beb8abafcaf75eecc94650e54f14813647d36 /git-debrebase
parentbcc6b2b9ee152cbb679642117ee191a383d359b0 (diff)
git-debrebase convert-from-gbp: Make it ff of dgit view, if we can.
Look for dgit-generated tags so we can usually make the new branch ff of the dgit view. Specifically, we fish the most recent released version out of debian/changelog and look for a DISTRO/VSN tag and a corresponding archive/DISTRO/VSN tag. If this all looks good, we declare ff of archive/. This should avoid the need for dgit push --overwrite in most cases. We do not check the DISTRO name. In principle dgit could find the distro name from the suite name, but that makes the software layering quite complicated. (For example, we would have to provide a way to tell gdr what program to run for dgit, for the benefit of the test suite.) I think the current approach is good enough; there are not likely to be any tag pairs that look like the right kind of thing but are in fact something else entirely, so we're not likely to accidentally trash some wanted changes. Closes:#903132. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Diffstat (limited to 'git-debrebase')
-rwxr-xr-xgit-debrebase42
1 files changed, 42 insertions, 0 deletions
diff --git a/git-debrebase b/git-debrebase
index fb6b79d..7b2e4f3 100755
--- a/git-debrebase
+++ b/git-debrebase
@@ -1623,6 +1623,41 @@ sub cmd_convert_from_gbp () {
"upstream ($upstream) contains debian/ directory";
}
+ my $previous_dgit_view = eval {
+ my @clogcmd = qw(dpkg-parsechangelog --format rfc822 -n2);
+ my ($lvsn, $suite);
+ parsechangelog_loop \@clogcmd, 'debian/changelog', sub {
+ my ($stz, $desc) = @_;
+ no warnings qw(exiting);
+ printdebug 'CHANGELOG ', Dumper($desc, $stz);
+ next unless $stz->{Date};
+ next unless $stz->{Distribution} ne 'UNRELEASED';
+ $lvsn = $stz->{Version};
+ $suite = $stz->{Distribution};
+ last;
+ };
+ die "neither of the first two changelog entries are released\n"
+ unless defined $lvsn;
+ print "last finished-looking changelog entry: ($lvsn) $suite\n";
+ my $mtag_pat = debiantag_maintview $lvsn, '*';
+ my $mtag = cmdoutput @git, qw(describe --always --abbrev=0 --match),
+ $mtag_pat;
+ die "could not find suitable maintainer view tag $mtag_pat\n"
+ unless $mtag_pat =~ m{/};
+ is_fast_fwd $mtag, 'HEAD' or
+ die "HEAD is not FF from maintainer tag $mtag!";
+ my $dtag = "archive/$mtag";
+ is_fast_fwd $mtag, $dtag or
+ die "dgit view tag $dtag is not FF from maintainer tag $mtag";
+ print "will stitch in dgit view, $dtag\n";
+ git_rev_parse $dtag;
+ };
+ if (!$previous_dgit_view) {
+ $@ =~ s/^\n+//;
+ chomp $@;
+ print STDERR "cannot stitch in dgit view: $@\n";
+ }
+
snags_maybe_bail();
my $work;
@@ -1652,6 +1687,13 @@ sub cmd_convert_from_gbp () {
runcmd @git, qw(reset --quiet --hard patch-queue/gdr-internal);
runcmd @git, qw(rebase --quiet --onto), $work, qw(gdr-internal);
$work = git_rev_parse 'HEAD';
+
+ if ($previous_dgit_view) {
+ $work = make_commit [$work, $previous_dgit_view], [
+ 'git-debrebase import: declare ff from dgit archive view',
+ '[git-debrebase pseudomerge: import-from-gbp]',
+ ];
+ }
};
update_head_checkout $old_head, $work, 'convert-from-gbp';