summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog3
-rwxr-xr-xgit-debrebase42
-rw-r--r--git-debrebase.1.pod5
3 files changed, 49 insertions, 1 deletions
diff --git a/debian/changelog b/debian/changelog
index 96e495e..82f6acc 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,7 @@
dgit (5.9~) unstable; urgency=medium
- *
+ * git-debrebase convert-from-gbp: Look for dgit-generated tags so we can
+ usually make the new branch ff of the dgit view. Closes:#903132.
--
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';
diff --git a/git-debrebase.1.pod b/git-debrebase.1.pod
index 4d1a673..d67e557 100644
--- a/git-debrebase.1.pod
+++ b/git-debrebase.1.pod
@@ -257,6 +257,11 @@ This check exists to detect certain likely user errors,
but if this situation is true and expected,
forcing it is fine.
+git-debrebase will try to look for the dgit archive view
+of the most recent release,
+and if it finds it will make a pseduomerge so that
+your new git-debrebase view is appropriately fast forward.
+
The result is a well-formed git-debrebase interchange branch.
The result is also fast-forward from the gbp branch.