chiark / gitweb /
git-debrebase: convert-to-gbp: implementation seems to work
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 17 Feb 2018 12:21:09 +0000 (12:21 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 16 Jun 2018 15:03:12 +0000 (16:03 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
git-debrebase

index 1a62852e19ac765a0ed1e2175d37104e59f048ac..c497631c874b8c44391539c618eba04256c32e1d 100755 (executable)
@@ -1277,6 +1277,37 @@ sub cmd_convert_from_gbp () {
     update_head_checkout $old_head, $work, 'convert-from-gbp';
 }
 
+sub cmd_convert_to_gbp_v0 () {
+    # v0 because very raw; does not make pseudomerges or anything
+    badusage "no arguments allowed" if @ARGV;
+    my $head = get_head();
+    my $ffq = (ffq_prev_branchinfo())[3];
+    my $bw = breakwater_of $head;
+    fresh_workarea();
+    my $out;
+    in_workarea sub {
+       runcmd @git, qw(checkout -q -b bw), $bw;
+       runcmd @git, qw(checkout -q -b patch-queue/bw), $head;
+       runcmd qw(gbp pq export);
+       runcmd @git, qw(add debian/patches);
+       $out = make_commit ['HEAD'], [
+            'Commit patch queue (converted from git-debrebase format)',
+            '[git-debrebase convert-to-gbp: commit patches]',
+        ];
+    };
+    if (defined $ffq) {
+       runcmd @git, qw(update-ref -m),
+           "debrebase: converting corresponding main branch to gbp format",
+           $ffq, $git_null_obj;
+    }
+    update_head_checkout $head, $out, "convert to gbp (v0)";
+    print <<END or die $!;
+git-debrebase: converted to git-buildpackage branch format
+git-debrebase: WARNING: do not now run "git-debrebase" any more
+git-debrebase: WARNING: doing so would drop all upstream patches!
+END
+}
+
 sub cmd_downstream_rebase_launder_v0 () {
     badusage "needs 1 argument, the baseline" unless @ARGV==1;
     my ($base) = @ARGV;