chiark / gitweb /
git-debrebase: wip new-upstream, ready for testing
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 25 Jan 2018 15:58:40 +0000 (15:58 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 16 Jun 2018 11:25:49 +0000 (12:25 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
git-debrebase

index 60a27ad175ff476708464b4851e54c6bf41701b5..0a73bdc849d1637ec787199c368d8720837f4d4c 100755 (executable)
@@ -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;