#
# Types:
# Packaging
+# Changelog
# Upstream
# AddPatches
# Mixed
} elsif ($d & DS_DEB and !($d & ~DS_DEB)) {
my ($ty,$dummy) = git_cat_file "$ph[0]:debian";
if ($ty eq 'tree') {
- return $classify->(qw(Packaging));
+ if ($d == D_DEB_CLOG) {
+ return $classify->(qw(Changelog));
+ } else {
+ return $classify->(qw(Packaging));
+ }
} elsif ($ty eq 'missing') {
return $classify->(qw(BreakwaterStart));
} else {
$cur = $p0;
$rewrite_from_here->();
next;
- } elsif ($ty eq 'Packaging') {
+ } elsif ($ty eq 'Packaging' or $ty eq 'Changelog') {
push @brw_cl, $cl;
$cur = $p0;
next;
STDOUT->error and die $!;
}
+sub cmd_downstream_rebase_launder_v0 () {
+ badusage "needs 1 argument, the baseline" unless @ARGV=0;
+ my ($base) = @ARGV;
+ $base = git_rev_parse $base;
+ my $old_head = get_head();
+ my $current = $old_head;
+ my $topmost_keep;
+ for (;;) {
+ if ($current eq $base) {
+ $topmust_keep //= $current;
+ print "$current BASE: stopping\n";
+ last;
+ }
+ my $cl = classify $current;
+ print " $current $cl->{Type}";
+ my $keep = 0;
+ my $p0 = $cl->{Parents}[0]{CommitId};
+ if ($cl->{Type} eq 'Pseudomerge') {
+ $current = $cl->{Contributor}{CommitId};
+ print " ^".($cl->{Contributor}{Ix}+1);
+ } elsif ($cl->{Type} eq 'AddPatches' or
+ $cl->{Type} eq 'Changelog') {
+ print " strip";
+ $current = $p0;
+ } else {
+ print " keep";
+ $current = $p0;
+ $keep = 1;
+ }
+ print "\n";
+ if ($keep) {
+ $topmost_keep //= $current;
+ } else {
+ die "to-be stripped changes not on top of the branch\n"
+ if $topmost_unstripped;
+ }
+ }
+ if ($topmost_keep eq $old_head) {
+ print "unchanged\n";
+ } else {
+ print "updating to $topmost_keep\n";
+ update_head $old_head, $topmost_keep, 'downstream-rebase-launder-v0';
+ }
+}
+
GetOptions("D+" => \$debuglevel) or die badusage "bad options\n";
initdebug('git-debrebase ');
enabledebug if $debuglevel;