From: Ian Jackson Date: Sun, 30 Oct 2016 16:25:31 +0000 (+0000) Subject: New option --dgit-view-save= for split view quilt modes. X-Git-Tag: archive/debian/2.9~33 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=commitdiff_plain;h=6359817c2baf67249782dc428c34c97e6a633b3b 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. Signed-off-by: Ian Jackson --- diff --git a/debian/changelog b/debian/changelog index 7497dce1..fb171751 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 8e72b2aa..3e746d2c 100755 --- 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 5367c36a..93183cfc 100644 --- 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 .