chiark / gitweb /
New option --dgit-view-save= for split view quilt modes.
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 30 Oct 2016 16:25:31 +0000 (16:25 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 30 Oct 2016 19:50:48 +0000 (19:50 +0000)
In particular, means that the output of a split view quilt-fixup is
left somewhere useful.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
debian/changelog
dgit
dgit.1

index 7497dce1c05d9f5997822478d40714a8b69de808..fb171751ec9ed9718b9ec218ea9aef2da54c91d3 100644 (file)
@@ -8,6 +8,9 @@ dgit (2.9~) unstable; urgency=low
   * Test suite: Explicitly configure user.name and user.email, so
     that tests work when environment doesn't have defaults.
     Closes:#842279 (I hope).
+  * New option --dgit-view-save= for split view quilt modes.
+    In particular, means that the output of a split view quilt-fixup
+    is left somewhere useful.
 
  --
 
diff --git a/dgit b/dgit
index 8e72b2aac1c93535faaaf29173e2f46e0b281c67..3e746d2cce9808bbc3ca1e74a48c4577e2ff7ee9 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -67,6 +67,7 @@ our $rmchanges;
 our $overwrite_version; # undef: not specified; '': check changelog
 our $quilt_mode;
 our $quilt_modes_re = 'linear|smash|auto|nofix|nocheck|gbp|dpm|unapplied';
+our $split_brain_save;
 our $we_are_responder;
 our $initiator_tempdir;
 our $patches_applied_dirtily = 00;
@@ -2981,6 +2982,18 @@ sub madformat_wantfixup ($) {
     return 1;
 }
 
+sub maybe_split_brain_save ($$$) {
+    my ($headref, $dgitview, $msg) = @_;
+    # => message fragment "$saved" describing disposition of $dgitview
+    return "commit id $dgitview" unless defined $split_brain_save;
+    my @cmd = (shell_cmd "cd ../../../..",
+              @git, qw(update-ref -m),
+              "dgit --dgit-view-save $msg HEAD=$headref",
+              $split_brain_save, $dgitview);
+    runcmd @cmd;
+    return "and left in $split_brain_save";
+}
+
 # An "infopair" is a tuple [ $thing, $what ]
 # (often $thing is a commit hash; $what is a description)
 
@@ -3141,6 +3154,8 @@ END_OVERWR
 Make fast forward from $i_arch_v->[0]
 END_MAKEFF
 
+    maybe_split_brain_save $maintview, $r, "pseudomerge";
+
     progress "Made pseudo-merge of $i_arch_v->[0] into dgit view.";
     return $r;
 }      
@@ -4159,9 +4174,10 @@ END
     runcmd @git, qw(update-ref -m), $cachekey, "refs/$splitbraincache",
        $dgitview;
 
-    progress "dgit view: created (commit id $dgitview)";
-
     changedir '.git/dgit/unpack/work';
+
+    my $saved = maybe_split_brain_save $headref, $dgitview, "converted";
+    progress "dgit view: created ($saved)";
 }
 
 sub quiltify ($$$$) {
@@ -4631,8 +4647,9 @@ sub quilt_check_splitbrain_cache ($$) {
            
        my $cachehit = $1;
        quilt_fixup_mkwork($headref);
+       my $saved = maybe_split_brain_save $headref, $cachehit, "cache-hit";
        if ($cachehit ne $headref) {
-           progress "dgit view: found cached (commit id $cachehit)";
+           progress "dgit view: found cached ($saved)";
            runcmd @git, qw(checkout -q -b dgit-view), $cachehit;
            $split_brain = 1;
            return ($cachehit, $splitbrain_cachekey);
@@ -5581,6 +5598,10 @@ sub parseopts () {
            } elsif (m/^--overwrite=(.+)$/s) {
                push @ropts, $_;
                $overwrite_version = $1;
+           } elsif (m/^--dgit-view-save=(.+)$/s) {
+               push @ropts, $_;
+               $split_brain_save = $1;
+               $split_brain_save =~ s#^(?!refs/)#refs/heads/#;
            } elsif (m/^--(no-)?rm-old-changes$/s) {
                push @ropts, $_;
                $rmchanges = !$1;
diff --git a/dgit.1 b/dgit.1
index 5367c36adc5f4c2ad3e4e4c1f7032f5815eefe88..93183cfcbe7b2e5c0264452a87769e73c46bf3a7 100644 (file)
--- a/dgit.1
+++ b/dgit.1
@@ -429,6 +429,27 @@ git history, so that your push is a fast forward from the archive.
 implying a split between the dgit view and the
 maintainer view, the pseudo-merge will appear only in the dgit view.)
 .TP
+.BR --dgit-view-save= \fIbranch\fR|\fIref\fR
+Specifies that when a split view quilt mode is in operation,
+and dgit calculates
+(or looks up in its cache)
+a dgit view corresponding to your HEAD,
+the dgit view will be left in
+.IR ref .
+The specified ref is unconditionally overwritten,
+so don't specify a branch you want to keep.
+
+This option is effective only with the following operations:
+quilt-fixup; push; all builds.
+And it is only effective with
+--[quilt=]gbp,
+--[quilt=]dpm,
+--quilt=unpatched.
+
+If ref does not start with refs/
+it is taken to to be a branch -
+i.e. refs/heads/ is prepended.
+.TP
 .BI --deliberately- something
 Declare that you are deliberately doing
 .IR something .