my ($anchor, $breakwater);
my $clogonly;
my $cl;
+ my $found_pm;
$fatal //= sub { fail $_[1]; };
my $x = sub {
my ($cb, $tagsfx, $mainwhy, $xwhy) = @_;
$breakwater = undef;
} elsif ($ty eq 'Pseudomerge' or
$ty eq 'AddPatches') {
+ my $found_pm = 1;
$x->($furniture, (lc $ty),
"found interchange bureaucracy commit ($ty)"," ($head)");
} elsif ($ty eq 'DgitImportUnpatched') {
- $x->($trouble, 'dgitimport',
- "found dgit dsc import ($head)");
- return (undef,undef);
+ if ($found_pm) {
+ $x->($trouble, 'dgitimport',
+ "found dgit dsc import"," ($head)");
+ return (undef,undef);
+ } else {
+ $x->($fatal, 'unprocessable',
+ "found bare dgit dsc import with no prior history",
+ " ($head)");
+ return (undef,undef);
+ }
} else {
$x->($fatal, 'unprocessable',
"found unprocessable commit, cannot cope: $cl->{Why}",
next;
} else {
# Everything is from this import. This kind of import
- # is already in valid breakwater format, with the
- # patches as commits.
- printf $report " NoPM" if $report;
- # last thing we processed will have been the first patch,
- # if there is one; which is fine, so no need to rewrite
- # on account of this import
- $build_start->("ImportOrigin", $cur);
+ # is already nearly in valid breakwater format, with the
+ # patches as commits. Unfortunately it contains
+ # debian/patches/.
+ printdebug "*** WALK BOMB bare dgit import\n";
+ $cl->{Why} = "bare dgit dsc import";
+ return $bomb->();
}
die "$ty ?";
} else {
stitch($dangling_head, $ffq_prev, $gdrlast, $ffq_prev_commitish, $prose);
}
-sub resolve_upstream_version ($$) {
- my ($new_upstream, $version) = @_;
+sub upstream_commitish_search ($$) {
+ my ($upstream_version, $tried) = @_;
+ # todo: at some point maybe use git-deborig to do this
+ foreach my $tagpfx ('', 'v', 'upstream/') {
+ my $tag = $tagpfx.(dep14_version_mangle $upstream_version);
+ my $new_upstream = git_get_ref "refs/tags/$tag";
+ push @$tried, $tag;
+ return $new_upstream if length $new_upstream;
+ }
+}
- my $new_upstream_version = "$version";
- $new_upstream_version =~ s/-.*?$//;;
+sub resolve_upstream_version ($$) {
+ my ($new_upstream, $upstream_version) = @_;
if (!defined $new_upstream) {
my @tried;
- # todo: at some point maybe use git-deborig to do this
- foreach my $tagpfx ('', 'v', 'upstream/') {
- my $tag = $tagpfx.(dep14_version_mangle $new_upstream_version);
- $new_upstream = git_get_ref "refs/tags/$tag";
- last if length $new_upstream;
- push @tried, $tag;
- }
+ $new_upstream = upstream_commitish_search $upstream_version, \@tried;
if (!length $new_upstream) {
fail "Could not determine appropriate upstream commitish.\n".
" (Tried these tags: @tried)\n".
}
$new_upstream = git_rev_parse $new_upstream;
- return ($new_upstream, $new_upstream_version);
+ return $new_upstream;
}
sub cmd_new_upstream () {
}
my $new_upstream = shift @ARGV;
- my $new_upstream_version;
- ($new_upstream, $new_upstream_version) =
- resolve_upstream_version $new_upstream, $new_version;
+ my $new_upstream_version = upstreamversion $new_version;
+ $new_upstream =
+ resolve_upstream_version $new_upstream, $new_upstream_version;
record_ffq_auto();
my ($upstream_spec) = @ARGV;
- my ($upstream, $upstream_version) =
- resolve_upstream_version($upstream_spec, $version);
+ my $upstream_version = upstreamversion $version;
+ my $upstream =
+ resolve_upstream_version($upstream_spec, $upstream_version);
my $old_head = get_head();