chiark
/
gitweb
/
~ianmdlvl
/
dgit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
git-debrebase: found
[dgit.git]
/
git-debrebase
diff --git
a/git-debrebase
b/git-debrebase
index c386057270b46908b8c47441692bb0ec14fc9c12..8c1dba80b881d257ca161305aa63c33e990272da 100755
(executable)
--- a/
git-debrebase
+++ b/
git-debrebase
@@
-286,14
+286,23
@@
sub classify ($) {
return $unknown->("complex merge");
}
return $unknown->("complex merge");
}
-sub launder ($$$) {
- my ($input, $pseudos_must_overwrite_this, $wantdebonly) = @_;
+sub walk ($$$;$$$) {
+ my ($input, $pseudos_must_overwrite_this, $wantdebonly,
+ $report, $depth, $report_anomaly, $nogenerate) = @_;
# go through commits backwards
# we generate two lists of commits to apply
# go through commits backwards
# we generate two lists of commits to apply
+ # => ($tip, $breakwater_tip)
my (@deb_cl, @ups_cl, @processed);
my %found;
my @pseudomerges;
my (@deb_cl, @ups_cl, @processed);
my %found;
my @pseudomerges;
+ $report //= sub { };
+ $report_anomaly //= sub {
+ my ($cl, $msg) = @_;
+ die "commit $cl: $msg\n";
+ };
+ $depth //= 0;
+
my $cl;
my $xmsg = sub {
my ($appendinfo) = @_;
my $cl;
my $xmsg = sub {
my ($appendinfo) = @_;
@@
-312,13
+321,17
@@
sub launder ($$$) {
$cl = classify $cur;
my $ty = $cl->{Type};
my $st = $cl->{SubType};
$cl = classify $cur;
my $ty = $cl->{Type};
my $st = $cl->{SubType};
+ $report->($cl);
$found{$ty. ( defined($st) ? "-$st" : '' )}++;
my $p0 = $cl->{Parents}[0]{CommitId};
$found{$ty. ( defined($st) ? "-$st" : '' )}++;
my $p0 = $cl->{Parents}[0]{CommitId};
+ $cl->{Abbrev} = lc substr $ty,0,1;
if ($ty eq 'AddPatches') {
if ($ty eq 'AddPatches') {
+ $cl->{Abbrev} = 'P';
$cur = $p0;
$rewrite_from_here->();
next;
} elsif ($ty eq 'Packaging') {
$cur = $p0;
$rewrite_from_here->();
next;
} elsif ($ty eq 'Packaging') {
+ $cl->{Abbrev} = 'd';
push @deb_cl, $cl;
push @processed, $cl;
$cur = $p0;
push @deb_cl, $cl;
push @processed, $cl;
$cur = $p0;
@@
-339,14
+352,16
@@
sub launder ($$$) {
$rewrite_from_here->();
next;
} elsif ($ty eq 'Pseudomerge') {
$rewrite_from_here->();
next;
} elsif ($ty eq 'Pseudomerge') {
- if (defined $pseudos_must_overwrite_this) {
- grep {
+ $cl->{Abbrev} = 'M';
+ if (defined $pseudos_must_overwrite_this &&
+ !grep {
is_fast_fwd $pseudos_must_overwrite_this, $_->{CommitId}
},
is_fast_fwd $pseudos_must_overwrite_this, $_->{CommitId}
},
- @{ $cl->{Overwritten} }
- or
- die "Pseudomerge $cl->{CommitId} does not overwrite ".
- "$pseudos_must_overwrite_this as expected.";
+ @{ $cl->{Overwritten} }) {
+ $report_anomaly->($cl,
+ "Pseudomerge should overwrite".
+ " $pseudos_must_overwrite_this".
+ " but does not do so");
}
push @pseudomerges, $cl;
$rewrite_from_here->();
}
push @pseudomerges, $cl;
$rewrite_from_here->();
@@
-357,6
+372,7
@@
sub launder ($$$) {
last;
} elsif ($ty eq 'DgitImportUnpatched' &&
@pseudomerges == 1) {
last;
} elsif ($ty eq 'DgitImportUnpatched' &&
@pseudomerges == 1) {
+ $cl->{Abbrev} = 'I';
# This import has a tree which is just like a breakwater
# tree, but it has the wrong history. Its ought to have
# the previous breakwater (which dgit ought to have
# This import has a tree which is just like a breakwater
# tree, but it has the wrong history. Its ought to have
# the previous breakwater (which dgit ought to have
@@
-367,6
+383,7
@@
sub launder ($$$) {
# precisely right. Otherwise, it was a non-gitish upload
# of a new upstream version. We can tell these apart
# by looking at the tree of the supposed upstream.
# precisely right. Otherwise, it was a non-gitish upload
# of a new upstream version. We can tell these apart
# by looking at the tree of the supposed upstream.
+ my $differs = get_differs $previous_breakwater, $cl->{Tree};
if ($differs & D_UPS) {
push @deb_cl, {
%r,
if ($differs & D_UPS) {
push @deb_cl, {
%r,
@@
-379,18
+396,21
@@
sub launder ($$$) {
SpecialMethod => 'DgitImportDebianUpdate',
$xmsg->("convert dgit import: upstream changes")
};
SpecialMethod => 'DgitImportDebianUpdate',
$xmsg->("convert dgit import: upstream changes")
};
- my $differs = get_differs $previous_breakwater, $cl->{Tree};
-
$basis = launder $pseudomerges[0]{Overwritten}, undef, 1
;
+ $basis = launder $pseudomerges[0]{Overwritten}, undef, 1,
+
$report, $depth+1, $nogenerate
;
$rewrite_from_here->();
last;
} else {
$rewrite_from_here->();
last;
} else {
-
die "Reached difficult commit $cur: ".Dumper($cl
);
+
$report_anomaly->($cl, "Cannot cope with this commit"
);
}
}
# Now we build it back up again
}
}
# Now we build it back up again
+ if ($nogenerate) {
+ return (undef, $basis);
+ }
+
workarea_fresh();
workarea_fresh();
- in_workarea sub { xxx attributes xxx };
my $rewriting = 1;
my $rewriting = 1;
@@
-485,10
+505,15
@@
sub update_head ($$) {
runcmd @git, qw(update-ref -m), "git-debrebase $mrest", $new, $old;
}
runcmd @git, qw(update-ref -m), "git-debrebase $mrest", $new, $old;
}
+sub cmd_analyse () {
+
+
sub cmd_launder () {
my $old = get_head();
my ($tip,$breakwater) = launder $old, 0, undef, 0;
sub cmd_launder () {
my $old = get_head();
my ($tip,$breakwater) = launder $old, 0, undef, 0;
- update_head $old, $tip, 'launder'; # no tree changes! xxx debian/patches
+ update_head $old, $tip, 'launder';
+ # no tree changes except debian/patches
+ runcmd @git, qw(rm --quiet -rf debian/patches);
printf "# breakwater tip:\n%s\n", $breakwater;
}
printf "# breakwater tip:\n%s\n", $breakwater;
}