chiark / gitweb /
git-debrebase: merge: New record-resolved-merge subcommand, WIP
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 11 Aug 2018 19:26:41 +0000 (20:26 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 12 Aug 2018 00:26:19 +0000 (01:26 +0100)
Right now this seems to be able to generate some commit, but
it doesn't know how to record it.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
git-debrebase
tests/tests/gdr-merge-conflicts

index 0dea5d5..a9abfa0 100755 (executable)
@@ -2611,6 +2611,45 @@ END
        'convert-from-dgit-view';
 }
 
+sub cmd_record_resolved_merge () {
+    badusage "record-resolved-merge takes no further arguments" if @ARGV;
+    my $new = get_head();
+    my $method;
+
+    print "Checking how you have resolved the merge problem\n";
+    my $nope = sub { print "Not $method: @_"; 0; };
+
+    my $maybe = sub { print "Seems to be $method.\n"; };
+    my $yes = sub {
+       my ($key, $ref) = @_;
+       print "OK.  You can switch branches and try git-debrebase again.\n";
+       confess "todo $ref"; # xxx
+       1;
+    };
+
+    fresh_workarea 'merge';
+    sub {
+       $method = 'vanilla-merge patchqueue';
+       my $vanilla = git_get_ref "$wrecknoteprefix/vanilla-merge";
+       $vanilla or return $nope->("wreckage was not of vanilla-merge");
+       foreach my $lr (qw(left right)) {
+           my $n = "$wrecknoteprefix/$lr-patchqueue";
+           my $lrpq = git_get_ref $n;
+           $lrpq or return $nope->("wreckage did not contain patchqueues");
+           is_fast_fwd $lrpq, $new or return $nope->("HEAD not ff of $n");
+       }
+       $maybe->();
+       my $newbase = git_get_ref "$wrecknoteprefix/new-base"
+           or die "wreckage element $wrecknoteprefix/new-base missing";
+       my $result = merge_series_patchqueue_convert
+           {}, $newbase, $new;
+       $yes->("vanilla-merge $vanilla", $result);
+       1;
+    }->() or sub {
+       fail "No resolved merge method seems applicable.\n";
+    }->();
+}
+
 sub cmd_downstream_rebase_launder_v0 () {
     badusage "needs 1 argument, the baseline" unless @ARGV==1;
     my ($base) = @ARGV;
index ab57a1e..420495a 100755 (executable)
@@ -95,4 +95,23 @@ t-git-debrebase
 
 wreckage-after
 
+: ----- resolve the conflict -----
+
+# omg
+git checkout debrebase-wreckage/merged-patchqueue
+QUILT_PATCHES=debian/patches quilt push -a
+QUILT_PATCHES=debian/patches quilt refresh
+git add debian/patches
+git commit -m FIX
+git reset --hard
+git clean -xdff
+
+t-expect-fail F:todo \
+t-git-debrebase record-resolved-merge
+
+git checkout master
+
+#t-git-debrebase
+#t-gdr-good laundered
+
 t-ok