From 8ac8810ed80449a437ee8bba3b9fc5457824c371 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Thu, 25 Jan 2018 15:58:40 +0000 Subject: [PATCH] git-debrebase: wip new-upstream, ready for testing Signed-off-by: Ian Jackson --- git-debrebase | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/git-debrebase b/git-debrebase index 60a27ad1..0a73bdc8 100755 --- a/git-debrebase +++ b/git-debrebase @@ -776,6 +776,7 @@ sub cmd_analyse () { } sub cmd_new_upstream_v0 () { + # xxx would like to support more git-rebase options badusage "need NEW-VERSION UPS-COMMITISH [EXTRA-UPS-NAME EXTRA-UPS-COMMITISH...]" unless @ARGV % 2 == 0 and @ARGV >= 2; @@ -820,11 +821,11 @@ sub cmd_new_upstream_v0 () { # now we need to investigate the branch this generates the # laundered version but we don't switch to it yet - my $old = get_head(); - my ($laundered_tip,$breakwater) = walk $old; + my $old_head = get_head(); + my ($old_laundered_tip,$old_bw) = walk $old_head; - my $breakwater_cl = classify $breakwater; - my $old_orig = parsecommit $breakwater_cl->{OrigParents}[0]{CommitId}; + my $old_bw_cl = classify $old_bw; + my $old_ups = parsecommit $old_bw_cl->{OrigParents}[0]{CommitId}; my $problems = 0; my $problem = sub { @@ -909,13 +910,13 @@ sub cmd_new_upstream_v0 () { # combined commit we just made. Either way it will be the # "upstream" parent of the breakwater special merge. - read_tree_subdir 'debian', "$breakwater:debian"; + read_tree_subdir 'debian', "$old_bw:debian"; # index now contains the breakwater merge contents my $bw_tree = cmdoutput @git, qw(write_tree); my @cmd = (@git, qw(commit-tree), $bw_tree); - push @cmd, qw(-p), $breakwater, qw(-p), $new_upstream; + push @cmd, qw(-p), $old_bw, qw(-p), $new_upstream; push @cmd, qw(-m), "Update to upstream $new_upstream_version"; push @cmd, qw(-m), "[git-debrebase new-upstream breakwater $new_upstream_version]"; @@ -953,12 +954,18 @@ END push @cmd, qw(-m), "[git-debrebase new-upstream changelog $new_upstream_version]"; $new_bw = cmdoutput @git; - + }; - update_head - xxx check new orig version is reasonable; - xxx decorate new orig version to get new debian version; - + # we have constructed the new breakwater. we now need to commit to + # the laundering output, because git-rebase can't easily be made + # to make a replay list which is based on some other branch + + update_head $old_head, $old_laundered; + + my @cmd = (@git, qw(rebase --onto), $new_bw, $old_bw); + runcmd @cmd; + # now it's for the user to sort out +} sub cmd_downstream_rebase_launder_v0 () { badusage "needs 1 argument, the baseline" unless @ARGV==1; -- 2.30.2