From aef653db307bc8e38f248e8dbec43ae3d2430413 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 29 Jul 2018 13:03:21 +0100 Subject: changelog: start 6.3~ Signed-off-by: Ian Jackson --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index 3e219b0..6124ea7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +dgit (6.3~) unstable; urgency=medium + + * + + -- + dgit (6.2) unstable; urgency=medium * dgit(1): Improve and correct --build-products-dir description. -- cgit v1.2.3 From 4f753d1e7e9916352bf2f8670f56c1fa20791915 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 31 Jul 2018 07:55:47 +0100 Subject: git-debrebase: walk: unprocessable: use fail, not die, and clean up Make this message like the one printed by $x->($fatal, ...) in keycommits. That is more consistent and also nicer. There is no need for the line number etc. either. This is mentioned in #905003. Signed-off-by: Ian Jackson --- git-debrebase | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/git-debrebase b/git-debrebase index 07e5f47..0c351a4 100755 --- a/git-debrebase +++ b/git-debrebase @@ -679,10 +679,11 @@ sub walk ($;$$) { if ($nogenerate) { return (undef,undef); } - die "commit $cur: Cannot cope with this commit (d.". + fail "found unprocessable commit, cannot cope:". + (defined $cl->{Why} ? "; $cl->{Why}": ''). + " (commit $cur) (d.". (join ' ', map { sprintf "%#x", $_->{Differs} } @{ $cl->{Parents} }). - (defined $cl->{Why} ? "; $cl->{Why}": ''). ")"; }; -- cgit v1.2.3 From a2adcd961613b1570dea721391e9f5c9665ba642 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 31 Jul 2018 07:58:15 +0100 Subject: git-debrebase: keycommits: Pass correct argument to fail We got the array index wrong and would print HASH(0x55be4dba1f88) or whatever. Closes:#905003. Signed-off-by: Ian Jackson --- debian/changelog | 3 ++- git-debrebase | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 6124ea7..9d22bed 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,7 @@ dgit (6.3~) unstable; urgency=medium - * + * git-debrebase: breakwater: Fix error message for unprocessable + commits. Closes:#905003. -- diff --git a/git-debrebase b/git-debrebase index 0c351a4..8385ae4 100755 --- a/git-debrebase +++ b/git-debrebase @@ -573,7 +573,7 @@ sub keycommits ($;$$$$) { my ($anchor, $breakwater); my $clogonly; my $cl; - $fatal //= sub { fail $_[2]; }; + $fatal //= sub { fail $_[1]; }; my $x = sub { my ($cb, $tagsfx, $mainwhy, $xwhy) = @_; my $why = $mainwhy.$xwhy; -- cgit v1.2.3 From 0d90164505d26f733fde2482616ddbf18f782145 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 31 Jul 2018 09:09:35 +0100 Subject: git-debrebase: new-upstream: Fix error message for new version with bad syntax Calling new Dpkg::Version , check => 1 does not die or anything if it's wrong; it just returns undef. The result is an error message about calling is_valid on an undefined value. Signed-off-by: Ian Jackson --- debian/changelog | 2 ++ git-debrebase | 1 + 2 files changed, 3 insertions(+) diff --git a/debian/changelog b/debian/changelog index 9d22bed..be2d349 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,8 @@ dgit (6.3~) unstable; urgency=medium * git-debrebase: breakwater: Fix error message for unprocessable commits. Closes:#905003. + * git-debrebase: new-upstream: Fix error message for new version + with bad syntax. -- diff --git a/git-debrebase b/git-debrebase index 8385ae4..3449ec3 100755 --- a/git-debrebase +++ b/git-debrebase @@ -1173,6 +1173,7 @@ sub cmd_new_upstream () { # parse args - low commitment my $spec_version = shift @ARGV; my $new_version = (new Dpkg::Version $spec_version, check => 1); + fail "bad version number \`$spec_version'" unless defined $new_version; if ($new_version->is_native()) { $new_version = (new Dpkg::Version "$spec_version-1", check => 1); } -- cgit v1.2.3 From 76a26a1e620f173b11a16e54ad424ed20f9bc116 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 31 Jul 2018 09:12:52 +0100 Subject: test suite: gdr-convert-gbp: Provide some unprocessable branches We'll add a test which uses these, in a moment. Signed-off-by: Ian Jackson --- tests/setup/gdr-convert-gbp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/setup/gdr-convert-gbp b/tests/setup/gdr-convert-gbp index 6ec374d..b7e0b7d 100755 --- a/tests/setup/gdr-convert-gbp +++ b/tests/setup/gdr-convert-gbp @@ -11,6 +11,7 @@ t-dependencies GDR t-tstunt-parsechangelog not-gdr-processable () { + git branch gdr-unprocessable/$1 t-git-debrebase analyse | grep 'Unknown Unprocessable' } @@ -37,7 +38,7 @@ gbp pq export git add debian/patches git commit -m "patch queue update ($0)" -not-gdr-processable +not-gdr-processable origin : 'fake up an upstream 2.0' git branch make-upstream upstream @@ -61,7 +62,7 @@ done git checkout master gbp import-orig --upstream-version=2.0 ../$ust -not-gdr-processable +not-gdr-processable merge t-dch-commit -v 2.0-1 -m 'new upstream (did gbp import-orig)' t-dch-commit-r -- cgit v1.2.3 From fd60a31ac3b7308570eee56f1e3c8e5ef0ffafe1 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 31 Jul 2018 09:13:55 +0100 Subject: test suite: gdr-unprocessable: new test Test git-debrebase messages about unprocessable commits. Signed-off-by: Ian Jackson --- debian/changelog | 1 + debian/tests/control | 2 +- tests/tests/gdr-unprocessable | 60 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 62 insertions(+), 1 deletion(-) create mode 100755 tests/tests/gdr-unprocessable diff --git a/debian/changelog b/debian/changelog index be2d349..41026cc 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,7 @@ dgit (6.3~) unstable; urgency=medium commits. Closes:#905003. * git-debrebase: new-upstream: Fix error message for new version with bad syntax. + * git-debrebase test suite: Test messages about unprocessable commits. -- diff --git a/debian/tests/control b/debian/tests/control index 8480655..8f7fd7d 100644 --- a/debian/tests/control +++ b/debian/tests/control @@ -16,7 +16,7 @@ Tests-Directory: tests/tests Depends: dgit, dgit-infrastructure, devscripts, debhelper (>=8), fakeroot, build-essential, chiark-utils-bin, bc Restrictions: x-dgit-intree-only x-dgit-git-only -Tests: gdr-diverge-nmu gdr-diverge-nmu-dgit gdr-edits gdr-import-dgit gdr-makepatches7 gdr-subcommands +Tests: gdr-diverge-nmu gdr-diverge-nmu-dgit gdr-edits gdr-import-dgit gdr-makepatches7 gdr-subcommands gdr-unprocessable Tests-Directory: tests/tests Depends: dgit, dgit-infrastructure, devscripts, debhelper (>=8), fakeroot, build-essential, chiark-utils-bin, bc, git-debrebase, git-buildpackage, faketime diff --git a/tests/tests/gdr-unprocessable b/tests/tests/gdr-unprocessable new file mode 100755 index 0000000..caa5321 --- /dev/null +++ b/tests/tests/gdr-unprocessable @@ -0,0 +1,60 @@ +#!/bin/bash +set -e +. tests/lib + +t-dependencies GDR + +t-setup-import gdr-convert-gbp + +cd $p + +t-dgit setup-mergechangelogs + +subcmd () { + cmd=("$@") + + branch merge 'complex merge' + branch origin 'origin commit' +} + +branch () { + branch=$1 + git checkout gdr-unprocessable/$branch + msgcore=$2 + expected-$expected +} + +cmd () { + t-git-debrebase "${cmd[@]}" +} + +expected- () { + t-expect-fail E:"$(printf "$mfmt" "$msgcore")" \ + cmd +} + +expected-ok () { + f=../out.$branch."${cmd/[^-a-zA-Z//_}" + cmd | tee $f + for mfmt in "${mfmts[@]}"; do + grep "$(printf "$mfmt" "$msgcore")" $f + done +} + +mfmt='found unprocessable commit.*%s' +subcmd +subcmd quick +subcmd new-upstream 2.0 upstream/2.0 +subcmd make-patches +subcmd breakwater +subcmd anchor + +expected=ok +mfmts=(' Unprocessable (%s)') +subcmd analyse + +mfmts=('branch not in git-debrebase form' + 'found unprocessable commit, cannot cope: %s') +subcmd status + +t-ok -- cgit v1.2.3 From ec2180ffff14c6e14703a70b4e68861312607f10 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 31 Jul 2018 10:21:57 +0100 Subject: git-debrebase: new-upstream: Fix handling of epochs. Dpkg::Version->version() is only the middle part. ->epoch() doesn't have the colon. This is inconvenient enough that we convert it to a string and use a regexp :-/. Signed-off-by: Ian Jackson --- debian/changelog | 1 + git-debrebase | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 41026cc..ef70f6e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,6 +5,7 @@ dgit (6.3~) unstable; urgency=medium * git-debrebase: new-upstream: Fix error message for new version with bad syntax. * git-debrebase test suite: Test messages about unprocessable commits. + * git-debrebase: new-upstream: Fix handling of epochs. -- diff --git a/git-debrebase b/git-debrebase index 3449ec3..4944529 100755 --- a/git-debrebase +++ b/git-debrebase @@ -1177,7 +1177,8 @@ sub cmd_new_upstream () { if ($new_version->is_native()) { $new_version = (new Dpkg::Version "$spec_version-1", check => 1); } - my $new_upstream_version = $new_version->version(); + my $new_upstream_version = "$new_version"; + $new_upstream_version =~ s/-.*?$//;; my $new_upstream = shift @ARGV; if (!defined $new_upstream) { -- cgit v1.2.3 From 8b650aeb481a3a4cb71325b6b7255194589c7612 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 31 Jul 2018 09:21:47 +0100 Subject: git-debrebase: Break out resolve_upstream_version (nfc) Signed-off-by: Ian Jackson --- git-debrebase | 43 +++++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/git-debrebase b/git-debrebase index 4944529..5d3c742 100755 --- a/git-debrebase +++ b/git-debrebase @@ -1162,25 +1162,12 @@ sub do_stitch ($;$) { stitch($dangling_head, $ffq_prev, $gdrlast, $ffq_prev_commitish, $prose); } -sub cmd_new_upstream () { - # automatically and unconditionally launders before rebasing - # if rebase --abort is used, laundering has still been done - - my %pieces; +sub resolve_upstream_version ($$) { + my ($new_upstream, $version) = @_; - badusage "need NEW-VERSION [UPS-COMMITTISH]" unless @ARGV >= 1; - - # parse args - low commitment - my $spec_version = shift @ARGV; - my $new_version = (new Dpkg::Version $spec_version, check => 1); - fail "bad version number \`$spec_version'" unless defined $new_version; - if ($new_version->is_native()) { - $new_version = (new Dpkg::Version "$spec_version-1", check => 1); - } - my $new_upstream_version = "$new_version"; + my $new_upstream_version = "$version"; $new_upstream_version =~ s/-.*?$//;; - my $new_upstream = shift @ARGV; if (!defined $new_upstream) { my @tried; # todo: at some point maybe use git-deborig to do this @@ -1198,6 +1185,30 @@ sub cmd_new_upstream () { } $new_upstream = git_rev_parse $new_upstream; + return ($new_upstream, $new_upstream_version); +} + +sub cmd_new_upstream () { + # automatically and unconditionally launders before rebasing + # if rebase --abort is used, laundering has still been done + + my %pieces; + + badusage "need NEW-VERSION [UPS-COMMITTISH]" unless @ARGV >= 1; + + # parse args - low commitment + my $spec_version = shift @ARGV; + my $new_version = (new Dpkg::Version $spec_version, check => 1); + fail "bad version number \`$spec_version'" unless defined $new_version; + if ($new_version->is_native()) { + $new_version = (new Dpkg::Version "$spec_version-1", check => 1); + } + + my $new_upstream = shift @ARGV; + my $new_upstream_version; + ($new_upstream, $new_upstream_version) = + resolve_upstream_version $new_upstream, $new_version; + record_ffq_auto(); my $piece = sub { -- cgit v1.2.3 From c83cc428208bee99de3b75158b9779449403ee1b Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 31 Jul 2018 13:16:53 +0100 Subject: git-debrebase: convert-from-gbp: Use same algorithm for finding upstream The version is in the changelog, and thus upstream commitish can then be found from as new-upstream. This also means we now give the same error message, which is much better than the one we had before. Closes:#905062. Signed-off-by: Ian Jackson --- debian/changelog | 2 ++ git-debrebase | 13 ++++++++++--- git-debrebase.1.pod | 2 ++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index ef70f6e..4d6e50a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,6 +6,8 @@ dgit (6.3~) unstable; urgency=medium with bad syntax. * git-debrebase test suite: Test messages about unprocessable commits. * git-debrebase: new-upstream: Fix handling of epochs. + * git-debrebase: convert-from-gbp: Use same algorithm for finding + upstream commitish as new-upstream. Closes:#905062. -- diff --git a/git-debrebase b/git-debrebase index 5d3c742..2687ef1 100755 --- a/git-debrebase +++ b/git-debrebase @@ -1604,11 +1604,18 @@ sub cmd_make_patches () { } sub cmd_convert_from_gbp () { - badusage "needs 1 optional argument, the upstream git rev" + badusage "want only 1 optional argument, the upstream git commitish" unless @ARGV<=1; + + my $clogp = parsechangelog(); + my $version = $clogp->{'Version'} + // die "missing Version from changelog"; + my ($upstream_spec) = @ARGV; - $upstream_spec //= 'refs/heads/upstream'; - my $upstream = git_rev_parse $upstream_spec; + + my ($upstream, $upstream_version) = + resolve_upstream_version($upstream_spec, $version); + my $old_head = get_head(); my $upsdiff = get_differs $upstream, $old_head; diff --git a/git-debrebase.1.pod b/git-debrebase.1.pod index 273ef47..b15bf00 100644 --- a/git-debrebase.1.pod +++ b/git-debrebase.1.pod @@ -250,6 +250,8 @@ the gbp upstream branch, if there is one. It is a snag if it is not an ancestor of HEAD, or if the history between the upstream and HEAD contains commits which make changes to upstream files. +If it is not specified, +the same algorithm is used as for git-debrebase new-upstream. It is also a snag if the specified upstream has a debian/ subdirectory. -- cgit v1.2.3 From e5d430e4208757b874443779b75ca884a143aa6a Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 31 Jul 2018 13:28:41 +0100 Subject: git-debrebase: Improve error messages for bad options. * GetOptions calls warn(). So we need a wrapper which disables or $SIG{__WARN__} (which prints a stack trace). * Put the call to badusage in the wrapper. * Change the messages to be clearer about what is meant. * Add the program name to the badusage message. Signed-off-by: Ian Jackson --- debian/changelog | 1 + git-debrebase | 21 +++++++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/debian/changelog b/debian/changelog index 4d6e50a..dc87466 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,6 +8,7 @@ dgit (6.3~) unstable; urgency=medium * git-debrebase: new-upstream: Fix handling of epochs. * git-debrebase: convert-from-gbp: Use same algorithm for finding upstream commitish as new-upstream. Closes:#905062. + * git-debrebase: Improve error messages for bad options. -- diff --git a/git-debrebase b/git-debrebase index 2687ef1..439a10a 100755 --- a/git-debrebase +++ b/git-debrebase @@ -45,10 +45,16 @@ $|=1; sub badusage ($) { my ($m) = @_; - print STDERR "bad usage: $m\n"; + print STDERR "$us: bad usage: $m\n"; finish 8; } +sub getoptions { + my $m = shift; + local $SIG{__WARN__}; # GetOptions calls `warn' to print messages + GetOptions @_ or badusage $m; +} + sub cfg ($;$) { my ($k, $optional) = @_; local $/ = "\0"; @@ -1518,7 +1524,8 @@ sub cmd_status () { sub cmd_stitch () { my $prose = 'stitch'; - GetOptions('prose=s', \$prose) or badusage("bad options to stitch"); + getoptions("bad options follow \`git-debrebase stitch'", + 'prose=s', \$prose); badusage "no arguments allowed" if @ARGV; do_stitch $prose, 0; } @@ -1581,8 +1588,8 @@ sub make_patches ($) { sub cmd_make_patches () { my $opt_quiet_would_amend; - GetOptions('quiet-would-amend!', \$opt_quiet_would_amend) - or badusage("bad options to make-patches"); + getoptions("bad options follow \`git-debrebase make-patches'", + 'quiet-would-amend!', \$opt_quiet_would_amend); badusage "no arguments allowed" if @ARGV; my $old_head = get_head(); my $new = make_patches $old_head; @@ -1798,7 +1805,8 @@ sub cmd_downstream_rebase_launder_v0 () { } } -GetOptions("D+" => \$debuglevel, +getoptions("bad options\n", + "D+" => \$debuglevel, 'noop-ok', => \$opt_noop_ok, 'f=s' => \@snag_force_opts, 'anchor=s' => \@opt_anchors, @@ -1814,7 +1822,8 @@ GetOptions("D+" => \$debuglevel, # approach. '-i=s{0,}' does not work with bundling. push @$opt_defaultcmd_interactive, @ARGV; @ARGV=(); - }) or badusage "bad options\n"; + }); + initdebug('git-debrebase '); enabledebug if $debuglevel; -- cgit v1.2.3 From cd06cd0cf3b1190fde3862684a18a1d7d56a834e Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 31 Jul 2018 13:37:39 +0100 Subject: git-debrebase: Improve error message for convert-from-gbp upstream discrepancy Closes:#905078. I don't intend to print `small' diffs because I think that kind of dwim is probably more annoying than helpful. I don't intend to factor this kind of pattern out throughout because: The messages for these commands are generally not the actual diff rune dgit or gdr ran, for various reasons (notably that dgit/gdr often use object hashes). The result is that there is little duplication. So I think the situation now is OK. Signed-off-by: Ian Jackson --- debian/changelog | 2 ++ git-debrebase | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index dc87466..3948db7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -9,6 +9,8 @@ dgit (6.3~) unstable; urgency=medium * git-debrebase: convert-from-gbp: Use same algorithm for finding upstream commitish as new-upstream. Closes:#905062. * git-debrebase: Improve error messages for bad options. + * git-debrebase: Improve error message for convert-from-gbp + upstream discrepancy. Closes:#905078. -- diff --git a/git-debrebase b/git-debrebase index 439a10a..13ca472 100755 --- a/git-debrebase +++ b/git-debrebase @@ -1627,10 +1627,14 @@ sub cmd_convert_from_gbp () { my $upsdiff = get_differs $upstream, $old_head; if ($upsdiff & D_UPS) { - runcmd @git, qw(--no-pager diff), + runcmd @git, qw(--no-pager diff --stat), $upstream, $old_head, qw( -- :!/debian :/); - fail "upstream ($upstream_spec) and HEAD are not identical in upstream files"; + fail < Date: Tue, 31 Jul 2018 13:40:47 +0100 Subject: test suite; convert-from-gbp: test not identical in upstream files Signed-off-by: Ian Jackson --- tests/setup/gdr-convert-gbp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/setup/gdr-convert-gbp b/tests/setup/gdr-convert-gbp index b7e0b7d..a3baf2d 100755 --- a/tests/setup/gdr-convert-gbp +++ b/tests/setup/gdr-convert-gbp @@ -81,6 +81,9 @@ git push --set-upstream origin master # debian/2.0-1 archive/debian/2.0-1 # remotes/origin/master remotes/dgit/dgit/sid +t-expect-fail E:'identical in upstream files' \ +t-git-debrebase -fupstream-has-debian convert-from-gbp upstream/2.0~ + t-git-debrebase -fupstream-has-debian convert-from-gbp v=2.0-2 -- cgit v1.2.3 From 0057ec1d2d864bbd40a5fcc32a5edeeb2bc90b4e Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 31 Jul 2018 13:52:03 +0100 Subject: git-debrebase(5): Add ILLEGAL OPERATIONS section. Re #905004. Signed-off-by: Ian Jackson --- debian/changelog | 1 + git-debrebase.5.pod | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/debian/changelog b/debian/changelog index 3948db7..6f5e155 100644 --- a/debian/changelog +++ b/debian/changelog @@ -11,6 +11,7 @@ dgit (6.3~) unstable; urgency=medium * git-debrebase: Improve error messages for bad options. * git-debrebase: Improve error message for convert-from-gbp upstream discrepancy. Closes:#905078. + * git-debrebase(5): Add ILLEGAL OPERATIONS section. (Re#905004.) -- diff --git a/git-debrebase.5.pod b/git-debrebase.5.pod index 52fb60b..d39ad94 100644 --- a/git-debrebase.5.pod +++ b/git-debrebase.5.pod @@ -487,6 +487,48 @@ These patch files can be stripped out and/or regenerated as needed. =back +=head1 ILLEGAL OPERATIONS + +Some git operations are not permitted in this data model. +Performing them will break git-debrebase. + +=over + +=item General merges + +See L, above. + +=item git-rebase starting too soon, or without base argument + +git-rebase must not be invoked in such a way that +the chosen base is before the anchor, +or before the last pseudomerge. +This is because git-rebase mangles merges. +git rebase --preserve-merges is also dangerous. + +git-rebase without a base argument will often start too early. + +For these reasons, +it is better to use git-debrebase and +let it choose the base +for your rebase. +If you do realise you have make this mistake, +it is best to use the reflog to recover to a suitable +good previous state. + +=item Editing debian/patches + +debian/patches is an output from git-debrebase, +not an input. +If you edit patches git-debrebase will complain +and refuse to work. +If you add patches your work is likely to be discarded. + +Instead of editing patches, +use git-debrebase to edit the corresponding commits. + +=back + =head1 COMMIT MESSAGE ANNOTATIONS git-debrebase makes annotations -- cgit v1.2.3 From fcff4f4b403b6dd53d6bc6b10d56baccd83dd144 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 31 Jul 2018 13:55:28 +0100 Subject: git-debrebase(1): Warn against plain git rebase. Re #905004. Signed-off-by: Ian Jackson --- debian/changelog | 1 + git-debrebase.1.pod | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/debian/changelog b/debian/changelog index 6f5e155..2e1497d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -12,6 +12,7 @@ dgit (6.3~) unstable; urgency=medium * git-debrebase: Improve error message for convert-from-gbp upstream discrepancy. Closes:#905078. * git-debrebase(5): Add ILLEGAL OPERATIONS section. (Re#905004.) + * git-debrebase(1): Warn against plain git rebase. (Re#905004.) -- diff --git a/git-debrebase.1.pod b/git-debrebase.1.pod index b15bf00..286d671 100644 --- a/git-debrebase.1.pod +++ b/git-debrebase.1.pod @@ -55,6 +55,12 @@ The options for git-rebase must either start with C<-i>, or be prececded by C<-->, to distinguish them from options for git-debrebase. +It is hazardous to use plain git-rebase on a git-debrebase branch, +because git-rebase has a tendency to start the rebase +too far back in history, +and then drop important commits. +Soo L + =item git-debrebase status Analyses the current branch, -- cgit v1.2.3 From 99bfdd1686cd2870fce5a4d08d63b479fe4ef41f Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 31 Jul 2018 13:56:46 +0100 Subject: dgit-maint-debrebase(7): Warn more against plain git rebase. Specifically, - warn that pseudomerges must not be rebased over - warn and that git-rebase without a base should not be used - say to run gdr instead Closes:#905004. Signed-off-by: Ian Jackson --- debian/changelog | 2 ++ dgit-maint-debrebase.7.pod | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 2e1497d..4cc32d2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -13,6 +13,8 @@ dgit (6.3~) unstable; urgency=medium upstream discrepancy. Closes:#905078. * git-debrebase(5): Add ILLEGAL OPERATIONS section. (Re#905004.) * git-debrebase(1): Warn against plain git rebase. (Re#905004.) + * dgit-maint-debrebase(7): Warn more against plain git rebase. + Closes:#905004. -- diff --git a/dgit-maint-debrebase.7.pod b/dgit-maint-debrebase.7.pod index 685a6b2..0f2f892 100644 --- a/dgit-maint-debrebase.7.pod +++ b/dgit-maint-debrebase.7.pod @@ -625,7 +625,12 @@ using git-rebase(1) directly. For example, =back If you take this approach, you should be very careful not to start the -rebase too early. +rebase too early, +including before the most recent pseudomerge. +git-rebase without a base argument will often +start the rebase too early, +and should be avoided. +Run git-debrebase instead. =head1 SEE ALSO -- cgit v1.2.3 From df9078a9e956ea6be6af328fcdbd2e22331077c1 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 31 Jul 2018 14:05:20 +0100 Subject: git-debrebase: Implement --help, providing a summary. Provide a usage message. I'm not convinced an option summary here is a good idea, mainly there aren't any really important options. (-f will be advertised when it is relevant.) So I have just summarised the most important operations. Closes:#904990. Signed-off-by: Ian Jackson --- debian/changelog | 2 ++ git-debrebase | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 4cc32d2..dd97216 100644 --- a/debian/changelog +++ b/debian/changelog @@ -15,6 +15,8 @@ dgit (6.3~) unstable; urgency=medium * git-debrebase(1): Warn against plain git rebase. (Re#905004.) * dgit-maint-debrebase(7): Warn more against plain git rebase. Closes:#905004. + * git-debrebase: Implement --help, providing a summary. + Closes:#904990. -- diff --git a/git-debrebase b/git-debrebase index 13ca472..b61970c 100755 --- a/git-debrebase +++ b/git-debrebase @@ -36,6 +36,18 @@ use Dpkg::Version; use File::FnMatch qw(:fnmatch); use File::Copy; +our ($usage_message) = <<'END'; +usages: + git-debrebase [] [--|-i ] + git-debrebase [] status + git-debrebase [] prepush [--prose=...] + git-debrebase [] quick|conclude + git-debrebase [] new-upstream [
] + git-debrebase [] convert-from-gbp [] + ... +See git-debrebase(1), git-debrebase(5), dgit-maint-debrebase(7) (in dgit). +END + our ($opt_force, $opt_noop_ok, @opt_anchors); our ($opt_defaultcmd_interactive); @@ -1826,7 +1838,9 @@ getoptions("bad options\n", # approach. '-i=s{0,}' does not work with bundling. push @$opt_defaultcmd_interactive, @ARGV; @ARGV=(); - }); + }, + 'help' => sub { print $usage_message or die $!; finish 0; }, + ); initdebug('git-debrebase '); enabledebug if $debuglevel; -- cgit v1.2.3 From 6195748b77343d61f81ee4cdac2942fbbfcc3590 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Thu, 2 Aug 2018 03:46:24 +0100 Subject: changelog: finalise 6.3 Signed-off-by: Ian Jackson --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index dd97216..bae63cc 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -dgit (6.3~) unstable; urgency=medium +dgit (6.3) unstable; urgency=medium * git-debrebase: breakwater: Fix error message for unprocessable commits. Closes:#905003. @@ -18,7 +18,7 @@ dgit (6.3~) unstable; urgency=medium * git-debrebase: Implement --help, providing a summary. Closes:#904990. - -- + -- Ian Jackson Thu, 02 Aug 2018 03:45:40 +0100 dgit (6.2) unstable; urgency=medium -- cgit v1.2.3 From 87d482318c13dc6a4fd1cbc2c45643af4cafa44c Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Thu, 2 Aug 2018 03:48:03 +0100 Subject: changelog: start 6.4 Signed-off-by: Ian Jackson --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index bae63cc..758f31f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +dgit (6.4~) unstable; urgency=medium + + * + + -- + dgit (6.3) unstable; urgency=medium * git-debrebase: breakwater: Fix error message for unprocessable -- cgit v1.2.3 From 8bfc1691211b345c319eed386e0442e1f579726a Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Thu, 2 Aug 2018 07:39:12 +0100 Subject: git-debrebase(1): Fix typo "unappled". Closes:#905064. Signed-off-by: Ian Jackson --- debian/changelog | 2 +- git-debrebase.1.pod | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 758f31f..ae86731 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,6 @@ dgit (6.4~) unstable; urgency=medium - * + * git-debrebase(1): Fix typo "unappled". Closes:#905064. -- diff --git a/git-debrebase.1.pod b/git-debrebase.1.pod index 286d671..db22fa5 100644 --- a/git-debrebase.1.pod +++ b/git-debrebase.1.pod @@ -278,7 +278,7 @@ just as for a laundering/unstitching call to git-debrebase; See L, below. Note that it is dangerous not to know whether you are -dealing with a gbp patches-unappled branch containing quilt patches, +dealing with a gbp patches-unapplied branch containing quilt patches, or a git-debrebase interchange branch. At worst, using the wrong tool for the branch format might result in -- cgit v1.2.3 From d43a4766cefecd2dda1e66faf4f33cca716fe459 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Thu, 2 Aug 2018 08:24:52 +0100 Subject: changelog: finalise 6.4 Signed-off-by: Ian Jackson --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index ae86731..6d2afcc 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,8 @@ -dgit (6.4~) unstable; urgency=medium +dgit (6.4) unstable; urgency=medium * git-debrebase(1): Fix typo "unappled". Closes:#905064. - -- + -- Ian Jackson Thu, 02 Aug 2018 08:24:32 +0100 dgit (6.3) unstable; urgency=medium -- cgit v1.2.3 From fe665d943b9d35e8221893c7e6d95c3ec1ead778 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Thu, 2 Aug 2018 08:31:30 +0100 Subject: changelog: start 6.5 Signed-off-by: Ian Jackson --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index 6d2afcc..2a00f3d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +dgit (6.5~) unstable; urgency=medium + + * + + -- + dgit (6.4) unstable; urgency=medium * git-debrebase(1): Fix typo "unappled". Closes:#905064. -- cgit v1.2.3 From 89108c5f44ad57febbb24a28d605a5c6322d14c2 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 3 Aug 2018 07:29:52 +0100 Subject: test suite: Add t-tstunt-parsechangelog to many gdr tests. Signed-off-by: Ian Jackson --- debian/changelog | 2 +- tests/tests/gdr-diverge-nmu | 1 + tests/tests/gdr-edits | 1 + tests/tests/gdr-import-dgit | 1 + tests/tests/gdr-makepatches7 | 1 + tests/tests/gdr-newupstream | 1 + tests/tests/gdr-subcommands | 1 + tests/tests/gdr-unprocessable | 1 + tests/tests/gdr-viagit | 1 + 9 files changed, 9 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 2a00f3d..70e21d5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,6 @@ dgit (6.5~) unstable; urgency=medium - * + * test suite: Add t-tstunt-parsechangelog to many gdr tests. -- diff --git a/tests/tests/gdr-diverge-nmu b/tests/tests/gdr-diverge-nmu index 15bf901..82aeaa5 100755 --- a/tests/tests/gdr-diverge-nmu +++ b/tests/tests/gdr-diverge-nmu @@ -4,6 +4,7 @@ set -e t-dependencies GDR +t-tstunt-parsechangelog t-setup-import gdr-convert-gbp cd $p diff --git a/tests/tests/gdr-edits b/tests/tests/gdr-edits index 52c083b..124de29 100755 --- a/tests/tests/gdr-edits +++ b/tests/tests/gdr-edits @@ -4,6 +4,7 @@ set -e t-dependencies GDR +t-tstunt-parsechangelog t-setup-import gdr-convert-gbp cd $p diff --git a/tests/tests/gdr-import-dgit b/tests/tests/gdr-import-dgit index c18c097..e58ff32 100755 --- a/tests/tests/gdr-import-dgit +++ b/tests/tests/gdr-import-dgit @@ -4,6 +4,7 @@ set -e t-dependencies GDR +t-tstunt-parsechangelog t-setup-import gdr-convert-gbp cd $p diff --git a/tests/tests/gdr-makepatches7 b/tests/tests/gdr-makepatches7 index 02ea7ab..52462d4 100755 --- a/tests/tests/gdr-makepatches7 +++ b/tests/tests/gdr-makepatches7 @@ -4,6 +4,7 @@ set -e t-dependencies GDR +t-tstunt-parsechangelog t-setup-import gdr-convert-gbp cd $p diff --git a/tests/tests/gdr-newupstream b/tests/tests/gdr-newupstream index 39ed24b..ada5516 100755 --- a/tests/tests/gdr-newupstream +++ b/tests/tests/gdr-newupstream @@ -5,6 +5,7 @@ autoimport= t-dependencies NO-DGIT GDR +t-tstunt-parsechangelog t-setup-import gdr-convert-gbp-noarchive cd $p diff --git a/tests/tests/gdr-subcommands b/tests/tests/gdr-subcommands index e59fc07..0b07372 100755 --- a/tests/tests/gdr-subcommands +++ b/tests/tests/gdr-subcommands @@ -4,6 +4,7 @@ set -e t-dependencies GDR +t-tstunt-parsechangelog t-setup-import gdr-convert-gbp cd $p diff --git a/tests/tests/gdr-unprocessable b/tests/tests/gdr-unprocessable index caa5321..14d1e8e 100755 --- a/tests/tests/gdr-unprocessable +++ b/tests/tests/gdr-unprocessable @@ -4,6 +4,7 @@ set -e t-dependencies GDR +t-tstunt-parsechangelog t-setup-import gdr-convert-gbp cd $p diff --git a/tests/tests/gdr-viagit b/tests/tests/gdr-viagit index a83e622..5887651 100755 --- a/tests/tests/gdr-viagit +++ b/tests/tests/gdr-viagit @@ -5,6 +5,7 @@ autoimport= t-dependencies NO-DGIT GDR +t-tstunt-parsechangelog t-setup-import gdr-convert-gbp-noarchive : 'set up so t-git-debrebase runs gdr via git' -- cgit v1.2.3 From 7bed50ebbcdf503896de776c0c70656b3dfeea7e Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 3 Aug 2018 07:31:09 +0100 Subject: test suite: editing a test script overrides DGIT_TESTS_PROGRESSIVE. By making the script a dependency of the .ok stamp file. Signed-off-by: Ian Jackson --- debian/changelog | 1 + tests/Makefile | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 70e21d5..cb9f3df 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,7 @@ dgit (6.5~) unstable; urgency=medium * test suite: Add t-tstunt-parsechangelog to many gdr tests. + * test suite: editing a test script overrides DGIT_TESTS_PROGRESSIVE. -- diff --git a/tests/Makefile b/tests/Makefile index 8494284..88bc0a0 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -9,7 +9,7 @@ TESTNAMES := $(notdir $(TESTSCRIPTS)) all: $(foreach t,$(TESTNAMES),tests/tmp/$t.ok) @echo "ALL PASSED$${DGIT_TESTS_PROGRESSIVE+ AT SOME POINT}" -tests/tmp/%.ok: +tests/tmp/%.ok: tests/tests/% ifeq ($(DGIT_TEST_RETRY_COUNT),) tests/tests/$* >tests/tmp/$*.log 2>&1 else -- cgit v1.2.3 From fabaa10f37c0cea45e0fcb08d3bcaa6ad07191bd Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 3 Aug 2018 07:55:31 +0100 Subject: dgit: Refactor %internal_object_save from $dgit_view_save Preparatory to allow saving other internal objects. Signed-off-by: Ian Jackson --- dgit | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/dgit b/dgit index 4e43d21..0da0c7f 100755 --- a/dgit +++ b/dgit @@ -78,7 +78,7 @@ our $overwrite_version; # undef: not specified; '': check changelog our $quilt_mode; our $quilt_modes_re = 'linear|smash|auto|nofix|nocheck|gbp|dpm|unapplied'; our $dodep14tag; -our $split_brain_save; +our %internal_object_save; our $we_are_responder; our $we_are_initiator; our $initiator_tempdir; @@ -3837,13 +3837,14 @@ sub madformat_wantfixup ($) { 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 $save = $internal_object_save{'dgit-view'}; + return "commit id $dgitview" unless defined $save; my @cmd = (shell_cmd 'cd "$1"; shift', $maindir, git_update_ref_cmd "dgit --dgit-view-save $msg HEAD=$headref", - $split_brain_save, $dgitview); + $save, $dgitview); runcmd @cmd; - return "and left in $split_brain_save"; + return "and left in $save"; } # An "infopair" is a tuple [ $thing, $what ] @@ -6952,10 +6953,10 @@ sub parseopts () { } elsif (m/^--delayed=(\d+)$/s) { push @ropts, $_; push @dput, $_; - } elsif (m/^--dgit-view-save=(.+)$/s) { + } elsif (my ($k,$v) = m/^--(dgit-view)-save=(.+)$/s) { push @ropts, $_; - $split_brain_save = $1; - $split_brain_save =~ s#^(?!refs/)#refs/heads/#; + $v =~ s#^(?!refs/)#refs/heads/#; + $internal_object_save{$k} = $v; } elsif (m/^--(no-)?rm-old-changes$/s) { push @ropts, $_; $rmchanges = !$1; -- cgit v1.2.3 From 12948968b9a6e48898a5a704a524930da170cd75 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 3 Aug 2018 07:59:34 +0100 Subject: dgit: Rename --dgit-view-save to --save-dgit-view, leaving an alias. This name makes more sense. Signed-off-by: Ian Jackson --- debian/changelog | 1 + dgit | 5 ++++- dgit.1 | 6 +++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index cb9f3df..4ea57ef 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,7 @@ dgit (6.5~) unstable; urgency=medium * test suite: Add t-tstunt-parsechangelog to many gdr tests. * test suite: editing a test script overrides DGIT_TESTS_PROGRESSIVE. + * dgit: Rename --dgit-view-save to --save-dgit-view, leaving an alias. -- diff --git a/dgit b/dgit index 0da0c7f..a5745a5 100755 --- a/dgit +++ b/dgit @@ -6953,7 +6953,10 @@ sub parseopts () { } elsif (m/^--delayed=(\d+)$/s) { push @ropts, $_; push @dput, $_; - } elsif (my ($k,$v) = m/^--(dgit-view)-save=(.+)$/s) { + } elsif (my ($k,$v) = + m/^--save-(dgit-view)=(.+)$/s || + m/^--(dgit-view)-save=(.+)$/s + ) { push @ropts, $_; $v =~ s#^(?!refs/)#refs/heads/#; $internal_object_save{$k} = $v; diff --git a/dgit.1 b/dgit.1 index a4b1694..4ea34da 100644 --- a/dgit.1 +++ b/dgit.1 @@ -661,7 +661,7 @@ Also, it can mean that dgit fails to find necessary git commits. .TP -.BR --dgit-view-save= \fIbranch\fR|\fIref\fR +.BR --save-dgit-view= \fIbranch\fR|\fIref\fR Specifies that when a split view quilt mode is in operation, and dgit calculates (or looks up in its cache) @@ -681,6 +681,10 @@ And it is only effective with If ref does not start with refs/ it is taken to to be a branch - i.e. refs/heads/ is prepended. + +.B --dgit-view-save +is a deprecated alias for +--save-dgit-view. .TP .BI --deliberately- something Declare that you are deliberately doing -- cgit v1.2.3 From e59fb2f70123dc40f515f60d707c4f99653d6d07 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 3 Aug 2018 11:09:21 +0100 Subject: dgit: Break out quilt_fakedsc2unapplied. NFC. Signed-off-by: Ian Jackson --- dgit | 44 ++++++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/dgit b/dgit index a5745a5..777532e 100755 --- a/dgit +++ b/dgit @@ -5738,6 +5738,31 @@ END close $fakedsc or die $!; } +sub quilt_fakedsc2unapplied ($$) { + my ($headref, $upstreamversion) = @_; + # must be run in the playground + # quilt_make_fake_dsc must have been called + + runcmd qw(sh -ec), + 'exec dpkg-source --no-check --skip-patches -x fake.dsc >/dev/null'; + + my $fakexdir= $package.'-'.(stripepoch $upstreamversion); + rename $fakexdir, "fake" or die "$fakexdir $!"; + + changedir 'fake'; + + remove_stray_gits("source package"); + mktree_in_ud_here(); + + rmtree '.pc'; + + rmtree 'debian'; # git checkout commitish paths does not delete! + runcmd @git, qw(checkout -f), $headref, qw(-- debian); + my $unapplied=git_add_write_tree(); + printdebug "fake orig tree object $unapplied\n"; + return $unapplied; +} + sub quilt_check_splitbrain_cache ($$) { my ($headref, $upstreamversion) = @_; # Called only if we are in (potentially) split brain mode. @@ -5891,24 +5916,7 @@ sub quilt_fixup_multipatch ($$$) { quilt_check_splitbrain_cache($headref, $upstreamversion); return if $cachehit; } - - runcmd qw(sh -ec), - 'exec dpkg-source --no-check --skip-patches -x fake.dsc >/dev/null'; - - my $fakexdir= $package.'-'.(stripepoch $upstreamversion); - rename $fakexdir, "fake" or die "$fakexdir $!"; - - changedir 'fake'; - - remove_stray_gits("source package"); - mktree_in_ud_here(); - - rmtree '.pc'; - - rmtree 'debian'; # git checkout commitish paths does not delete! - runcmd @git, qw(checkout -f), $headref, qw(-- debian); - my $unapplied=git_add_write_tree(); - printdebug "fake orig tree object $unapplied\n"; + my $unapplied=quilt_fakedsc2unapplied($headref, $upstreamversion); ensuredir '.pc'; -- cgit v1.2.3 From 51a3f746ef8525c1a24085b97e28cc36c85b1268 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 3 Aug 2018 12:18:00 +0100 Subject: dgit: Provide print-unapplied-treeish subcommand. Signed-off-by: Ian Jackson --- debian/changelog | 1 + dgit | 18 ++++++++++++++++++ dgit.1 | 20 ++++++++++++++++++++ 3 files changed, 39 insertions(+) diff --git a/debian/changelog b/debian/changelog index 4ea57ef..791066d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,7 @@ dgit (6.5~) unstable; urgency=medium * test suite: Add t-tstunt-parsechangelog to many gdr tests. * test suite: editing a test script overrides DGIT_TESTS_PROGRESSIVE. * dgit: Rename --dgit-view-save to --save-dgit-view, leaving an alias. + * dgit: Provide print-unapplied-treeish subcommand. -- diff --git a/dgit b/dgit index 777532e..48feca9 100755 --- a/dgit +++ b/dgit @@ -6558,6 +6558,24 @@ sub cmd_quilt_fixup { build_maybe_quilt_fixup(); } +sub cmd_print_unapplied_treeish { + badusage "incorrect arguments to dgit print-unapplied-treeish" if @ARGV; + my $headref = git_rev_parse('HEAD'); + my $clogp = commit_getclogp $headref; + $package = getfield $clogp, 'Source'; + $version = getfield $clogp, 'Version'; + $isuite = getfield $clogp, 'Distribution'; + $csuite = $isuite; # we want this to be offline! + notpushing(); + + prep_ud(); + changedir $playground; + my $uv = upstreamversion $version; + quilt_make_fake_dsc($uv); + my $u = quilt_fakedsc2unapplied($headref, $uv); + print $u, "\n" or die $!; +} + sub import_dsc_result { my ($dstref, $newhash, $what_log, $what_msg) = @_; my @cmd = (git_update_ref_cmd $what_log, $dstref, $newhash); diff --git a/dgit.1 b/dgit.1 index 4ea34da..a21f212 100644 --- a/dgit.1 +++ b/dgit.1 @@ -471,6 +471,26 @@ to cause it to exclude exactly the .git diredcory and nothing else. The separate arguments are unquoted, separated by spaces, and do not contain spaces. +.TP +.B dgit print-unapplied-treeish +Constructs a tree-ish approximating the patches-unapplied state +of your 3.0 (quilt) package, +and prints the git object name to stdout. +This requires appropriate .orig tarballs. +This tree object is identical to your .origs +as regards upstream files. +The contents of the debian subdirectory is not interesting +and should not be inspected; +except that debian/patches will be identical to your HEAD. + +To make this operate off-line, +the access configuration key +which is used to determine the build-products-dir +is the uncanonicalised version of the suite name from the changelog, +or (of course) dgit.default.build-products-dir. +See ACCESS CONFIGURATION, below. + +This function is primarily provided for the benefit of git-debrebase. .SH OPTIONS .TP .BR --dry-run " | " -n -- cgit v1.2.3 From fe63aca9ed9d55d546a8cb5cd83053bbaaafe309 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 3 Aug 2018 12:53:10 +0100 Subject: git-debrebase: factor out getoptions for subcommand No functional change. Signed-off-by: Ian Jackson --- git-debrebase | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/git-debrebase b/git-debrebase index b61970c..907ebfe 100755 --- a/git-debrebase +++ b/git-debrebase @@ -61,11 +61,15 @@ sub badusage ($) { finish 8; } -sub getoptions { +sub getoptions_main { my $m = shift; local $SIG{__WARN__}; # GetOptions calls `warn' to print messages GetOptions @_ or badusage $m; } +sub getoptions { + my $sc = shift; + getoptions_main "bad options follow \`git-debrebase $sc'", @_; +} sub cfg ($;$) { my ($k, $optional) = @_; @@ -1536,7 +1540,7 @@ sub cmd_status () { sub cmd_stitch () { my $prose = 'stitch'; - getoptions("bad options follow \`git-debrebase stitch'", + getoptions("stitch", 'prose=s', \$prose); badusage "no arguments allowed" if @ARGV; do_stitch $prose, 0; @@ -1600,7 +1604,7 @@ sub make_patches ($) { sub cmd_make_patches () { my $opt_quiet_would_amend; - getoptions("bad options follow \`git-debrebase make-patches'", + getoptions("make-patches", 'quiet-would-amend!', \$opt_quiet_would_amend); badusage "no arguments allowed" if @ARGV; my $old_head = get_head(); @@ -1821,7 +1825,8 @@ sub cmd_downstream_rebase_launder_v0 () { } } -getoptions("bad options\n", +getoptions_main + ("bad options\n", "D+" => \$debuglevel, 'noop-ok', => \$opt_noop_ok, 'f=s' => \@snag_force_opts, -- cgit v1.2.3 From 666278d3724ee2f7b3f75272a9735c5bb4176575 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 3 Aug 2018 13:49:37 +0100 Subject: Dgit.pm: Move is_orig_file_of_p_v and its dependencies from dgit We want is_orig_file_of_p_v, so move it and all the things it depends on. NFC. Signed-off-by: Ian Jackson --- Debian/Dgit.pm | 23 +++++++++++++++++++++++ dgit | 22 ++-------------------- 2 files changed, 25 insertions(+), 20 deletions(-) diff --git a/Debian/Dgit.pm b/Debian/Dgit.pm index 0e2464d..05e4c0c 100644 --- a/Debian/Dgit.pm +++ b/Debian/Dgit.pm @@ -43,6 +43,7 @@ BEGIN { dep14_version_mangle debiantags debiantag_old debiantag_new debiantag_maintview + stripepoch source_file_leafname is_orig_file_of_p_v server_branch server_ref stat_exists link_ltarget hashfile @@ -57,6 +58,7 @@ BEGIN { git_reflog_action_msg git_update_ref_cmd $package_re $component_re $deliberately_re $distro_re $versiontag_re $series_filename_re + $orig_f_comp_re $orig_f_sig_re $orig_f_tail_re $extra_orig_namepart_re $git_null_obj $branchprefix @@ -91,6 +93,9 @@ our $versiontag_re = qr{[-+.\%_0-9a-zA-Z/]+}; our $branchprefix = 'dgit'; our $series_filename_re = qr{(?:^|\.)series(?!\n)$}s; our $extra_orig_namepart_re = qr{[-0-9a-z]+}; +our $orig_f_comp_re = qr{orig(?:-$extra_orig_namepart_re)?}; +our $orig_f_sig_re = '\\.(?:asc|gpg|pgp)'; +our $orig_f_tail_re = "$orig_f_comp_re\\.tar(?:\\.\\w+)?(?:$orig_f_sig_re)?"; our $git_null_obj = '0' x 40; our $ffq_refprefix = 'ffq-prev'; our $gdrlast_refprefix = 'debrebase-last'; @@ -220,6 +225,24 @@ sub debiantags ($$) { map { $_->($version, $distro) } (\&debiantag_new, \&debiantag_old); } +sub stripepoch ($) { + my ($vsn) = @_; + $vsn =~ s/^\d+\://; + return $vsn; +} + +sub source_file_leafname ($$$) { + my ($package,$vsn,$sfx) = @_; + return "${package}_".(stripepoch $vsn).$sfx +} + +sub is_orig_file_of_p_v ($$$) { + my ($package, $f, $upstreamvsn) = @_; + my $base = source_file_leafname $package, $upstreamvsn, ''; + return 0 unless $f =~ m/^\Q$base\E\.$orig_f_tail_re$/; + return 1; +} + sub server_branch ($) { return "$branchprefix/$_[0]"; } sub server_ref ($) { return "refs/".server_branch($_[0]); } diff --git a/dgit b/dgit index 48feca9..ddc2d6c 100755 --- a/dgit +++ b/dgit @@ -100,9 +100,6 @@ our %format_ok = map { $_=>1 } ("1.0","3.0 (native)","3.0 (quilt)"); our $suite_re = '[-+.0-9a-z]+'; our $cleanmode_re = 'dpkg-source(?:-d)?|git|git-ff|check|none'; -our $orig_f_comp_re = qr{orig(?:-$extra_orig_namepart_re)?}; -our $orig_f_sig_re = '\\.(?:asc|gpg|pgp)'; -our $orig_f_tail_re = "$orig_f_comp_re\\.tar(?:\\.\\w+)?(?:$orig_f_sig_re)?"; our $git_authline_re = '^([^<>]+) \<(\S+)\> (\d+ [-+]\d+)$'; our $splitbraincache = 'dgit-intern/quilt-cache'; @@ -201,16 +198,8 @@ sub lref () { return "refs/heads/".lbranch(); } sub lrref () { return "refs/remotes/$remotename/".server_branch($csuite); } sub rrref () { return server_ref($csuite); } -sub stripepoch ($) { - my ($vsn) = @_; - $vsn =~ s/^\d+\://; - return $vsn; -} - -sub srcfn ($$) { - my ($vsn,$sfx) = @_; - return "${package}_".(stripepoch $vsn).$sfx -} +sub srcfn ($$) { return &source_file_leafname($package, @_); } +sub is_orig_file_of_vsn ($$) { return &is_orig_file_of_p_v($package, @_); } sub dscfn ($) { my ($vsn) = @_; @@ -1867,13 +1856,6 @@ sub is_orig_file_in_dsc ($$) { return 1; } -sub is_orig_file_of_vsn ($$) { - my ($f, $upstreamvsn) = @_; - my $base = srcfn $upstreamvsn, ''; - return 0 unless $f =~ m/^\Q$base\E\.$orig_f_tail_re$/; - return 1; -} - # This function determines whether a .changes file is source-only from # the point of view of dak. Thus, it permits *_source.buildinfo # files. -- cgit v1.2.3 From 9b6abc0738dde6c9fd71cf33ead7262fc00c57f9 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 3 Aug 2018 14:38:37 +0100 Subject: dgit: Improve error message for unknown suite, to suggest -d Signed-off-by: Ian Jackson --- debian/changelog | 1 + dgit | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 791066d..491e80f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,7 @@ dgit (6.5~) unstable; urgency=medium * test suite: editing a test script overrides DGIT_TESTS_PROGRESSIVE. * dgit: Rename --dgit-view-save to --save-dgit-view, leaving an alias. * dgit: Provide print-unapplied-treeish subcommand. + * dgit: Improve error message for unknown suite, to suggest -d. -- diff --git a/dgit b/dgit index ddc2d6c..29d29d1 100755 --- a/dgit +++ b/dgit @@ -1078,7 +1078,7 @@ sub canonicalise_suite_ftpmasterapi { } qw(codename name); push @matched, $entry; } - fail "unknown suite $isuite" unless @matched; + fail "unknown suite $isuite, maybe -d would help" unless @matched; my $cn; eval { @matched==1 or die "multiple matches for suite $isuite\n"; -- cgit v1.2.3 From dcdaf7a166dbf5599eefb8174a2445ed90560e23 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 3 Aug 2018 14:08:23 +0100 Subject: Dgit.pm: Deconfuse argument orders of is_orig_file_of_p_v etc. NFC. Signed-off-by: Ian Jackson --- Debian/Dgit.pm | 2 +- dgit | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Debian/Dgit.pm b/Debian/Dgit.pm index 05e4c0c..787e506 100644 --- a/Debian/Dgit.pm +++ b/Debian/Dgit.pm @@ -237,7 +237,7 @@ sub source_file_leafname ($$$) { } sub is_orig_file_of_p_v ($$$) { - my ($package, $f, $upstreamvsn) = @_; + my ($f, $package, $upstreamvsn) = @_; my $base = source_file_leafname $package, $upstreamvsn, ''; return 0 unless $f =~ m/^\Q$base\E\.$orig_f_tail_re$/; return 1; diff --git a/dgit b/dgit index 29d29d1..283db22 100755 --- a/dgit +++ b/dgit @@ -198,8 +198,14 @@ sub lref () { return "refs/heads/".lbranch(); } sub lrref () { return "refs/remotes/$remotename/".server_branch($csuite); } sub rrref () { return server_ref($csuite); } -sub srcfn ($$) { return &source_file_leafname($package, @_); } -sub is_orig_file_of_vsn ($$) { return &is_orig_file_of_p_v($package, @_); } +sub srcfn ($$) { + my ($vsn, $sfx) = @_; + return &source_file_leafname($package, $vsn, $sfx); +} +sub is_orig_file_of_vsn ($$) { + my ($f, $upstreamvsn) = @_; + return is_orig_file_of_p_v($f, $package, $upstreamvsn); +} sub dscfn ($) { my ($vsn) = @_; -- cgit v1.2.3 From 21e1afc5f7963a0223207d8284f2f2d0d382cc6f Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 3 Aug 2018 14:10:37 +0100 Subject: Dgit.pm: Move upstreamversion from dgit NFC. Signed-off-by: Ian Jackson --- Debian/Dgit.pm | 7 +++++++ dgit | 6 ------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Debian/Dgit.pm b/Debian/Dgit.pm index 787e506..1cd765d 100644 --- a/Debian/Dgit.pm +++ b/Debian/Dgit.pm @@ -43,6 +43,7 @@ BEGIN { dep14_version_mangle debiantags debiantag_old debiantag_new debiantag_maintview + upstreamversion stripepoch source_file_leafname is_orig_file_of_p_v server_branch server_ref stat_exists link_ltarget @@ -231,6 +232,12 @@ sub stripepoch ($) { return $vsn; } +sub upstreamversion ($) { + my ($vsn) = @_; + $vsn =~ s/-[^-]+$//; + return $vsn; +} + sub source_file_leafname ($$$) { my ($package,$vsn,$sfx) = @_; return "${package}_".(stripepoch $vsn).$sfx diff --git a/dgit b/dgit index 283db22..dbb23f3 100755 --- a/dgit +++ b/dgit @@ -217,12 +217,6 @@ sub changespat ($;$) { return "${package}_".(stripepoch $vsn)."_".($arch//'*').".changes"; } -sub upstreamversion ($) { - my ($vsn) = @_; - $vsn =~ s/-[^-]+$//; - return $vsn; -} - our $us = 'dgit'; initdebug(''); -- cgit v1.2.3 From 4d1ab1d76fd6d96ff09550f877fa3fc904fa6bb7 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 3 Aug 2018 14:11:05 +0100 Subject: git-debrebase: Use upstreamversion rather than open-coding Signed-off-by: Ian Jackson --- git-debrebase | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/git-debrebase b/git-debrebase index 907ebfe..c111513 100755 --- a/git-debrebase +++ b/git-debrebase @@ -1187,8 +1187,7 @@ sub do_stitch ($;$) { sub resolve_upstream_version ($$) { my ($new_upstream, $version) = @_; - my $new_upstream_version = "$version"; - $new_upstream_version =~ s/-.*?$//;; + my $new_upstream_version = upstreamversion $version; if (!defined $new_upstream) { my @tried; -- cgit v1.2.3 From 4e06aef7012d5768a537ed13b9e332a2295f719c Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 3 Aug 2018 15:36:03 +0100 Subject: git-debrebase; Refactor resolve_upstream_version to take upstream version NFC. Signed-off-by: Ian Jackson --- git-debrebase | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/git-debrebase b/git-debrebase index c111513..e75c90f 100755 --- a/git-debrebase +++ b/git-debrebase @@ -1185,9 +1185,7 @@ sub do_stitch ($;$) { } sub resolve_upstream_version ($$) { - my ($new_upstream, $version) = @_; - - my $new_upstream_version = upstreamversion $version; + my ($new_upstream, $new_upstream_version) = @_; if (!defined $new_upstream) { my @tried; @@ -1206,7 +1204,7 @@ sub resolve_upstream_version ($$) { } $new_upstream = git_rev_parse $new_upstream; - return ($new_upstream, $new_upstream_version); + return $new_upstream; } sub cmd_new_upstream () { @@ -1226,9 +1224,9 @@ sub cmd_new_upstream () { } my $new_upstream = shift @ARGV; - my $new_upstream_version; - ($new_upstream, $new_upstream_version) = - resolve_upstream_version $new_upstream, $new_version; + my $new_upstream_version = upstreamversion $new_version; + $new_upstream = + resolve_upstream_version $new_upstream, $new_upstream_version; record_ffq_auto(); @@ -1635,8 +1633,9 @@ sub cmd_convert_from_gbp () { my ($upstream_spec) = @ARGV; - my ($upstream, $upstream_version) = - resolve_upstream_version($upstream_spec, $version); + my $upstream_version = upstreamversion $version; + my $upstream = + resolve_upstream_version($upstream_spec, $upstream_version); my $old_head = get_head(); -- cgit v1.2.3 From e8d0e4e6c4a5c34798d6be4e6b5be2349301d584 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 4 Aug 2018 07:35:05 +0100 Subject: git-debrebase: resolve_upstream_version: Rename $upstream_version This used to be called $new_upstream_version but this function is called in other contexts too. NFC. Signed-off-by: Ian Jackson --- git-debrebase | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/git-debrebase b/git-debrebase index e75c90f..a28b910 100755 --- a/git-debrebase +++ b/git-debrebase @@ -1185,13 +1185,13 @@ sub do_stitch ($;$) { } sub resolve_upstream_version ($$) { - my ($new_upstream, $new_upstream_version) = @_; + my ($new_upstream, $upstream_version) = @_; if (!defined $new_upstream) { my @tried; # todo: at some point maybe use git-deborig to do this foreach my $tagpfx ('', 'v', 'upstream/') { - my $tag = $tagpfx.(dep14_version_mangle $new_upstream_version); + my $tag = $tagpfx.(dep14_version_mangle $upstream_version); $new_upstream = git_get_ref "refs/tags/$tag"; last if length $new_upstream; push @tried, $tag; -- cgit v1.2.3 From 3e041f7eae8fcac38d485e17df481b9b0aeef9b8 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 4 Aug 2018 07:39:11 +0100 Subject: git-debrebase: Break out resolve_upstream_version NFC. Signed-off-by: Ian Jackson --- git-debrebase | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/git-debrebase b/git-debrebase index a28b910..35284d5 100755 --- a/git-debrebase +++ b/git-debrebase @@ -1184,18 +1184,23 @@ sub do_stitch ($;$) { stitch($dangling_head, $ffq_prev, $gdrlast, $ffq_prev_commitish, $prose); } +sub upstream_commitish_search ($$) { + my ($upstream_version, $tried) = @_; + # todo: at some point maybe use git-deborig to do this + foreach my $tagpfx ('', 'v', 'upstream/') { + my $tag = $tagpfx.(dep14_version_mangle $upstream_version); + my $new_upstream = git_get_ref "refs/tags/$tag"; + return $new_upstream if length $new_upstream; + push @$tried, $tag; + } +} + sub resolve_upstream_version ($$) { my ($new_upstream, $upstream_version) = @_; if (!defined $new_upstream) { my @tried; - # todo: at some point maybe use git-deborig to do this - foreach my $tagpfx ('', 'v', 'upstream/') { - my $tag = $tagpfx.(dep14_version_mangle $upstream_version); - $new_upstream = git_get_ref "refs/tags/$tag"; - last if length $new_upstream; - push @tried, $tag; - } + $new_upstream = upstream_commitish_search $upstream_version, \@tried; if (!length $new_upstream) { fail "Could not determine appropriate upstream commitish.\n". " (Tried these tags: @tried)\n". -- cgit v1.2.3 From 32a64c4b2ca401cd594c38ceaa01a2bdfc56f8eb Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 4 Aug 2018 07:52:38 +0100 Subject: git-debrebase: Have resolve_upstream_commit set @$tried first This allows a caller to know what tag name was successfully found, by looking at $tried[-1]; Signed-off-by: Ian Jackson --- git-debrebase | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git-debrebase b/git-debrebase index 35284d5..13c320e 100755 --- a/git-debrebase +++ b/git-debrebase @@ -1190,8 +1190,8 @@ sub upstream_commitish_search ($$) { foreach my $tagpfx ('', 'v', 'upstream/') { my $tag = $tagpfx.(dep14_version_mangle $upstream_version); my $new_upstream = git_get_ref "refs/tags/$tag"; - return $new_upstream if length $new_upstream; push @$tried, $tag; + return $new_upstream if length $new_upstream; } } -- cgit v1.2.3 From 32302c566f46426687ae9dcccec2f16ddeb56e4b Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 4 Aug 2018 10:35:58 +0100 Subject: git-debrebase: Properly reject bare dgit dsc imports A bare dgit dsc import is not a legal gdr branch, because the main merge contains debian/patches/. So it cannot be processed without conversion. Previously an attempt to launder such a branch would crash with a stack trace, although keycommits would falsely claim it was OK Signed-off-by: Ian Jackson --- debian/changelog | 1 + git-debrebase | 28 ++++++++++++++++++---------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/debian/changelog b/debian/changelog index 491e80f..664a3d1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,6 +5,7 @@ dgit (6.5~) unstable; urgency=medium * dgit: Rename --dgit-view-save to --save-dgit-view, leaving an alias. * dgit: Provide print-unapplied-treeish subcommand. * dgit: Improve error message for unknown suite, to suggest -d. + * git-debrebase: Properly reject bare dgit dsc imports -- diff --git a/git-debrebase b/git-debrebase index 13c320e..a2a14ca 100755 --- a/git-debrebase +++ b/git-debrebase @@ -595,6 +595,7 @@ sub keycommits ($;$$$$) { my ($anchor, $breakwater); my $clogonly; my $cl; + my $found_pm; $fatal //= sub { fail $_[1]; }; my $x = sub { my ($cb, $tagsfx, $mainwhy, $xwhy) = @_; @@ -634,12 +635,20 @@ sub keycommits ($;$$$$) { $breakwater = undef; } elsif ($ty eq 'Pseudomerge' or $ty eq 'AddPatches') { + my $found_pm = 1; $x->($furniture, (lc $ty), "found interchange bureaucracy commit ($ty)"," ($head)"); } elsif ($ty eq 'DgitImportUnpatched') { - $x->($trouble, 'dgitimport', - "found dgit dsc import ($head)"); - return (undef,undef); + if ($found_pm) { + $x->($trouble, 'dgitimport', + "found dgit dsc import"," ($head)"); + return (undef,undef); + } else { + $x->($fatal, 'unprocessable', + "found bare dgit dsc import with no prior history", + " ($head)"); + return (undef,undef); + } } else { $x->($fatal, 'unprocessable', "found unprocessable commit, cannot cope: $cl->{Why}", @@ -814,13 +823,12 @@ sub walk ($;$$) { next; } else { # Everything is from this import. This kind of import - # is already in valid breakwater format, with the - # patches as commits. - printf $report " NoPM" if $report; - # last thing we processed will have been the first patch, - # if there is one; which is fine, so no need to rewrite - # on account of this import - $build_start->("ImportOrigin", $cur); + # is already nearly in valid breakwater format, with the + # patches as commits. Unfortunately it contains + # debian/patches/. + printdebug "*** WALK BOMB bare dgit import\n"; + $cl->{Why} = "bare dgit dsc import"; + return $bomb->(); } die "$ty ?"; } else { -- cgit v1.2.3 From 5026d3c30a7046299179ca3ba422fb21505cdf4d Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 4 Aug 2018 10:42:42 +0100 Subject: git-debrebase: Improve error message formatting from $bomb in walk The : and ; were messed up. Signed-off-by: Ian Jackson --- debian/changelog | 1 + git-debrebase | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 664a3d1..742b752 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,6 +6,7 @@ dgit (6.5~) unstable; urgency=medium * dgit: Provide print-unapplied-treeish subcommand. * dgit: Improve error message for unknown suite, to suggest -d. * git-debrebase: Properly reject bare dgit dsc imports + * git-debrebase: Improve some error message formatting. -- diff --git a/git-debrebase b/git-debrebase index a2a14ca..eb0acb2 100755 --- a/git-debrebase +++ b/git-debrebase @@ -710,8 +710,8 @@ sub walk ($;$$) { if ($nogenerate) { return (undef,undef); } - fail "found unprocessable commit, cannot cope:". - (defined $cl->{Why} ? "; $cl->{Why}": ''). + fail "found unprocessable commit, cannot cope". + (defined $cl->{Why} ? "; $cl->{Why}:": ':'). " (commit $cur) (d.". (join ' ', map { sprintf "%#x", $_->{Differs} } @{ $cl->{Parents} }). -- cgit v1.2.3 From e5bae1c8621bb50925404c3ba70c83b037a5b74f Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 4 Aug 2018 10:44:59 +0100 Subject: test suite: gdr-import-dgitview: New test for dgit dsc imports So far this just tests the bugfixes I've just done. Signed-off-by: Ian Jackson --- debian/changelog | 1 + debian/tests/control | 2 +- tests/tests/gdr-import-dgitview | 25 +++++++++++++++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100755 tests/tests/gdr-import-dgitview diff --git a/debian/changelog b/debian/changelog index 742b752..a64a06d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,6 +7,7 @@ dgit (6.5~) unstable; urgency=medium * dgit: Improve error message for unknown suite, to suggest -d. * git-debrebase: Properly reject bare dgit dsc imports * git-debrebase: Improve some error message formatting. + * test suite: gdr-import-dgitview: New test for dgit dsc imports. -- diff --git a/debian/tests/control b/debian/tests/control index 8f7fd7d..e3274f2 100644 --- a/debian/tests/control +++ b/debian/tests/control @@ -16,7 +16,7 @@ Tests-Directory: tests/tests Depends: dgit, dgit-infrastructure, devscripts, debhelper (>=8), fakeroot, build-essential, chiark-utils-bin, bc Restrictions: x-dgit-intree-only x-dgit-git-only -Tests: gdr-diverge-nmu gdr-diverge-nmu-dgit gdr-edits gdr-import-dgit gdr-makepatches7 gdr-subcommands gdr-unprocessable +Tests: gdr-diverge-nmu gdr-diverge-nmu-dgit gdr-edits gdr-import-dgit gdr-import-dgitview gdr-makepatches7 gdr-subcommands gdr-unprocessable Tests-Directory: tests/tests Depends: dgit, dgit-infrastructure, devscripts, debhelper (>=8), fakeroot, build-essential, chiark-utils-bin, bc, git-debrebase, git-buildpackage, faketime diff --git a/tests/tests/gdr-import-dgitview b/tests/tests/gdr-import-dgitview new file mode 100755 index 0000000..84fc50c --- /dev/null +++ b/tests/tests/gdr-import-dgitview @@ -0,0 +1,25 @@ +#!/bin/bash +set -e +. tests/lib +. $troot/lib-gdr + +t-dependencies GDR + +t-tstunt-parsechangelog + +t-archive example 1.0-1 +t-git-none + +t-dgit clone $p + +cd $p + +t-git-debrebase status + +t-expect-fail E:'bare dgit dsc import' \ +t-git-debrebase + +LC_MESSAGES=C t-git-debrebase status |tee ../bare-output +grep 'bare dgit dsc import with no prior history' ../bare-output + +t-ok -- cgit v1.2.3 From 69aae724c3d05a20219e5a9642e162dd65ef2fe9 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 4 Aug 2018 11:18:29 +0100 Subject: git-debrebase: Support --dgit option for finding dgit Nothing uses this yet. Signed-off-by: Ian Jackson --- git-debrebase | 2 ++ git-debrebase.1.pod | 6 ++++++ tests/lib-gdr | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/git-debrebase b/git-debrebase index eb0acb2..b51c714 100755 --- a/git-debrebase +++ b/git-debrebase @@ -114,6 +114,7 @@ our $rd; our $workarea; our @git = qw(git); +our @dgit = qw(dgit); sub in_workarea ($) { my ($sub) = @_; @@ -1842,6 +1843,7 @@ getoptions_main 'noop-ok', => \$opt_noop_ok, 'f=s' => \@snag_force_opts, 'anchor=s' => \@opt_anchors, + '--dgit=s' => \($dgit[0]), 'force!', '-i:s' => sub { my ($opt,$val) = @_; diff --git a/git-debrebase.1.pod b/git-debrebase.1.pod index db22fa5..eb85c6c 100644 --- a/git-debrebase.1.pod +++ b/git-debrebase.1.pod @@ -407,6 +407,12 @@ it is a snag if is the anchor for the previous upstream version in git-debrebase new-upstream operations. +=item --dgit= + +Run , instead of dgit from PATH, +when invocation of dgit is necessary. +This is provided mostly for the benefit of the test suite. + =item -D Requests (more) debugging. May be repeated. diff --git a/tests/lib-gdr b/tests/lib-gdr index 95d2330..7b43d4f 100644 --- a/tests/lib-gdr +++ b/tests/lib-gdr @@ -7,7 +7,7 @@ t-git-debrebase () { local gdr=${DGIT_GITDEBREBASE_TEST-git-debrebase} : ' {{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{' - $gdr $GDR_TEST_OPTS $GDR_TEST_DEBUG $t_gdr_xopts "$@" + $gdr --dgit=$DGIT_TEST $GDR_TEST_OPTS $GDR_TEST_DEBUG $t_gdr_xopts "$@" : '}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} ' } -- cgit v1.2.3 From 485a61ef66da7ad675e0495355b1f9f1df952bf5 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 4 Aug 2018 12:01:50 +0100 Subject: git-debrebase: Provide new convert-from-dgit-view operation. The output is, unavoidably, not very pretty. Closes:#905322. Signed-off-by: Ian Jackson --- debian/changelog | 2 + git-debrebase | 188 ++++++++++++++++++++++++++++++++++++++++++++++++++++ git-debrebase.1.pod | 66 ++++++++++++++++++ 3 files changed, 256 insertions(+) diff --git a/debian/changelog b/debian/changelog index a64a06d..fd3f102 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,6 +8,8 @@ dgit (6.5~) unstable; urgency=medium * git-debrebase: Properly reject bare dgit dsc imports * git-debrebase: Improve some error message formatting. * test suite: gdr-import-dgitview: New test for dgit dsc imports. + * git-debrebase: Provide new convert-from-dgit-view operation. + The output is, unavoidably, not very pretty. Closes:#905322. -- diff --git a/git-debrebase b/git-debrebase index b51c714..98e645a 100755 --- a/git-debrebase +++ b/git-debrebase @@ -1788,6 +1788,194 @@ git-debrebase: WARNING: doing so would drop all upstream patches! END } +sub cmd_convert_from_dgit_view () { + my $clogp = parsechangelog(); + + my $bpd = (cfg 'dgit.default.build-products-dir',1) // '..'; + my $do_origs = 1; + my $do_tags = 1; + my $always = 0; + my $diagnose = 0; + + getoptions("convert-from-dgit-view", + 'diagnose!', \$diagnose, + 'build-products-dir:s', \$bpd, + 'origs!', \$do_origs, + 'tags!', \$do_tags, + 'always-convert-anyway!', \$always); + fail "takes 1 optional argument, the upstream commitish" if @ARGV>1; + + my @upstreams; + + if (@ARGV) { + my $spec = shift @ARGV; + my $commit = git_rev_parse "$spec^{commit}"; + push @upstreams, { Commit => $commit, + Source => "$ARGV[0], from command line", + Only => 1, + }; + } + + my $head = get_head(); + + if (!$always) { + my $troubles = 0; + my $trouble = sub { $troubles++; }; + keycommits $head, sub{}, sub{}, $trouble, $trouble; + printdebug "troubles=$troubles\n"; + if (!$troubles) { + print STDERR <{Version}; + print STDERR "Considering possible commits corresponding to upstream:\n"; + + if (!@upstreams) { + if ($do_tags) { + my @tried; + my $ups_tag = upstream_commitish_search $version, \@tried; + if ($ups_tag) { + my $this = "git tag $tried[-1]"; + push @upstreams, { Commit => $ups_tag, + Source => $this, + }; + } else { + printf STDERR + " git tag: no suitable tag found (tried %s)\n", + "@tried"; + } + } + if ($do_origs) { + my $p = $clogp->{'Source'}; + # we do a quick check to see if there are plausible origs + my $something=0; + if (!opendir BPD, $bpd) { + die "$bpd: opendir: $!" unless $!==ENOENT; + } else { + while ($!=0, my $f = readdir BPD) { + next unless is_orig_file_of_p_v $f, $p, $version; + printf STDERR + " orig: found what looks like a .orig, %s\n", + "$bpd/$f"; + $something=1; + last; + } + die "read $bpd: $!" if $!; + closedir BPD; + } + if ($something) { + my $tree = cmdoutput + @dgit, qw(--build-products-dir), $bpd, + qw(print-unapplied-treeish); + fresh_workarea(); + in_workarea sub { + runcmd @git, qw(reset --quiet), $tree, qw(-- .); + rm_subdir_cached 'debian'; + $tree = cmdoutput @git, qw(write-tree); + my $ups_synth = make_commit [], [ < $ups_synth, + Source => "orig(s) imported via dgit", + }; + } + } else { + printf STDERR + " orig: no suitable origs found (looked for %s in %s)\n", + "${p}_".(stripeoch $version)."...", $bpd; + } + } + } + + my $some_patches = stat_exists 'debian/patches/series'; + + print STDERR "Evaluating possible commits corresponding to upstream:\n"; + + my $result; + foreach my $u (@upstreams) { + my $work = $head; + fresh_workarea(); + in_workarea sub { + runcmd @git, qw(reset --quiet), $u->{Commit}, qw(-- .); + runcmd @git, qw(checkout), $u->{Commit}, qw(-- .); + runcmd @git, qw(clean -xdff); + runcmd @git, qw(checkout), $head, qw(-- debian); + if ($some_patches) { + rm_subdir_cached 'debian/patches'; + $work = make_commit [ $work ], [ + 'git-debrebase convert-from-dgit-view: drop upstream changes from breakwater', + "Drop upstream changes, and delete debian/patches, as part of converting\n". + "to git-debrebase format. Upstream changes will appear as commits.", + '[git-debrebase convert-from-dgit-view: drop patches from tree]' + ]; + } + $work = make_commit [ $work, $u->{Commit} ], [ + 'git-debrebase convert-from-dgit-view: declare upstream', + '(Re)constructed breakwater merge.', + '[git-debrebase anchor: declare upstream]' + ]; + runcmd @git, qw(checkout --quiet -b mk), $work; + if ($some_patches) { + runcmd @git, qw(checkout), $head, qw(-- debian/patches); + runcmd @git, qw(reset --quiet); + my @gbp_cmd = (qw(gbp pq import)); + if (!$diagnose) { + my $gbp_err = "../gbp-pq-err"; + @gbp_cmd = shell_cmd "exec >$gbp_err 2>&1", @gbp_cmd; + } + my $r = system @gbp_cmd; + if ($r) { + printf STDERR + " %s: couldn't apply patches: gbp pq %s", + $u->{Source}, waitstatusmsg(); + return; + } + } + my $work = git_rev_parse qw(HEAD); + my $diffout = cmdoutput @git, qw(diff-tree --stat HEAD), $work; + if (length $diffout) { + print STDERR + " $u->{Source}: applying patches gives different tree\n"; + print STDERR $diffout if $diagnose; + return; + } + # OMG! + $u->{Result} = $work; + $result = $u; + }; + last if $result; + } + + if (!$result) { + fail <{Source}; + + ffq_check $result->{Result}; + snags_maybe_bail(); + update_head_checkout $head, $result->{Result}, + 'convert-from-dgit-view'; +} + sub cmd_downstream_rebase_launder_v0 () { badusage "needs 1 argument, the baseline" unless @ARGV==1; my ($base) = @ARGV; diff --git a/git-debrebase.1.pod b/git-debrebase.1.pod index eb85c6c..e544a8c 100644 --- a/git-debrebase.1.pod +++ b/git-debrebase.1.pod @@ -343,6 +343,72 @@ Be sure to not accidentally treat the result as a git-debrebase branch, or you will drop all the patches! +=item git-debrebase convert-from-dgit-view [] [upstream] + +Converts any dgit-compatible git branch +corresponding to a (possibly hypothetical) 3.0 quilt dsc source package +into a git-debrebase-compatible branch. + +This operation should not be used +if the branch is already in git-debrebase form. +Normally git-debrebase will refuse to continue in this case +(or silently do nothing if the global --noop-ok option is used). + +Some representation of the original upstream source code will be needed. +If I is supplied, that must be a suitable upstream commit. +By default, +git-debrebase will look first for git tags (as for new-upstream), +and then for orig tarballs which it will ask dgit to process. + +The upstream source must be exactly right and +all the patches in debian/patches must be up to date. +Applying the patches from debian/patches to the upstream source +must result in exactly your HEAD. + +The output is laundered and stitched. +The resulting history is not particularly pretty, +especially if orig tarball(s) were imported +to produce a synthetic upstream commit. + +The available convert-options are as follows. +(These must come after convert-from-dgit-view.) + +=over + +=item --[no-]diagnose + +Print additional error messages to help diagnose +failure to find an appropriate upstream. +--no-diagnose is the default. + +=item --build-products-dir + +Directory to look in for orig tarballs. +The default is the git config option +dgit.default.build-products-dir +or failing that, C<..>. +Passed on to dgit, if git-debrebase invokes dgit. + +=item --[no-]origs + +Whether to try to look for or use any orig tarballs. +--origs is the default. + +=item --[no-]tags + +Whether to try to look for or use any upstream git tags. +--tags is the default. + +=item --always-convert-anyway + +Perform the conversion operation, +producing unpleasant extra history, +even if the branch seems to be in git-debrebase form already. +This should not be done unless necessary, +and it should not be necessary. + +=back + =back =head1 OPTIONS -- cgit v1.2.3 From 999fd7ad45c4a442ffe199df4e43918bc192dcb4 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 4 Aug 2018 12:02:21 +0100 Subject: test suite: gdr-import-dgitview: Actually test convert-from-dgitview This was always my intention with this test, of course. Signed-off-by: Ian Jackson --- tests/tests/gdr-import-dgitview | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/tests/gdr-import-dgitview b/tests/tests/gdr-import-dgitview index 84fc50c..3670deb 100755 --- a/tests/tests/gdr-import-dgitview +++ b/tests/tests/gdr-import-dgitview @@ -22,4 +22,24 @@ t-git-debrebase LC_MESSAGES=C t-git-debrebase status |tee ../bare-output grep 'bare dgit dsc import with no prior history' ../bare-output +git branch before + +t-expect-fail E:'Could not find or construct a suitable upstream commit' \ +t-git-debrebase convert-from-dgit-view --no-origs + +t-git-debrebase convert-from-dgit-view +t-gdr-good laundered + +t-expect-fail E:'already seems to be in git-debrebase format' \ +t-git-debrebase convert-from-dgit-view + +t-refs-same-start +t-ref-head +t-git-debrebase --noop-ok convert-from-dgit-view +t-ref-head + +t-git-debrebase convert-from-dgit-view --always-convert-anyway +t-expect-fail E:'ref varies' t-ref-head +t-gdr-good laundered + t-ok -- cgit v1.2.3 From b58f7c61452fc5b8b7d70f735283ecdc1b5e8ac3 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 4 Aug 2018 13:40:15 +0100 Subject: git-debrebase: New feature `scrap' Signed-off-by: Ian Jackson --- debian/changelog | 1 + git-debrebase | 12 ++++++++++++ git-debrebase.1.pod | 5 +++++ 3 files changed, 18 insertions(+) diff --git a/debian/changelog b/debian/changelog index fd3f102..787cd2c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -10,6 +10,7 @@ dgit (6.5~) unstable; urgency=medium * test suite: gdr-import-dgitview: New test for dgit dsc imports. * git-debrebase: Provide new convert-from-dgit-view operation. The output is, unavoidably, not very pretty. Closes:#905322. + * git-debrebase: New feature `scrap'. Closes:#905063. -- diff --git a/git-debrebase b/git-debrebase index 98e645a..62fbf61 100755 --- a/git-debrebase +++ b/git-debrebase @@ -1577,6 +1577,18 @@ sub cmd_conclude () { do_stitch 'quick'; } +sub cmd_scrap () { + my ($ffq_prev, $gdrlast, $ffq_prev_commitish) = ffq_prev_info(); + fail "No ongoing git-debrebase session." unless $ffq_prev_commitish; + my $scrapping_head = get_head(); + badusage "no arguments allowed" if @ARGV; + push @deferred_updates, + "update $gdrlast $ffq_prev_commitish $git_null_obj", + "update $ffq_prev $git_null_obj $ffq_prev_commitish"; + snags_maybe_bail(); + update_head_checkout $scrapping_head, $ffq_prev_commitish, "scrap"; +} + sub make_patches_staged ($) { my ($head) = @_; # Produces the patches that would result from $head if it were diff --git a/git-debrebase.1.pod b/git-debrebase.1.pod index e544a8c..28f3084 100644 --- a/git-debrebase.1.pod +++ b/git-debrebase.1.pod @@ -106,6 +106,11 @@ If there is no ffq-prev, it is an error, unless --noop-ok. You should consider using B instead, because that launders the branch too. +=item git-debrebase scrap + +Throws away all the work since the branch was last stitched. +This is done by rewinding you to ffq-prev. + =item git-debrebase new-upstream [...] Rebases the delta queue -- cgit v1.2.3 From 5a93e9272cd62a4f84d3bed67d7ce28c666dd2d4 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 4 Aug 2018 13:41:43 +0100 Subject: test suite: gdr-viagit: Test scrap Signed-off-by: Ian Jackson --- tests/tests/gdr-viagit | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/tests/gdr-viagit b/tests/tests/gdr-viagit index 5887651..0495eb1 100755 --- a/tests/tests/gdr-viagit +++ b/tests/tests/gdr-viagit @@ -39,4 +39,18 @@ t-gdr-good laundered t-git-debrebase stitch --prose=wombat t-gdr-good stitched +: ----- test scrap ----- + +t-refs-same-start +t-ref-head + +t-git-debrebase +t-gdr-good laundered + +t-some-changes +t-git-debrebase scrap +t-gdr-good stitched + +t-ref-head + t-ok -- cgit v1.2.3 From f4cc9bfd072ea021caf9ae97d56d29c2ed01773e Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 4 Aug 2018 14:05:43 +0100 Subject: git-debrebase: scrap: Make it honour --noop-ok Signed-off-by: Ian Jackson --- git-debrebase | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/git-debrebase b/git-debrebase index 62fbf61..4046425 100755 --- a/git-debrebase +++ b/git-debrebase @@ -1579,7 +1579,10 @@ sub cmd_conclude () { sub cmd_scrap () { my ($ffq_prev, $gdrlast, $ffq_prev_commitish) = ffq_prev_info(); - fail "No ongoing git-debrebase session." unless $ffq_prev_commitish; + if (!$ffq_prev_commitish) { + fail "No ongoing git-debrebase session." unless $opt_noop_ok; + finish 0; + } my $scrapping_head = get_head(); badusage "no arguments allowed" if @ARGV; push @deferred_updates, -- cgit v1.2.3 From caa7cbcf78c1b936d5300f34c83a6b33ebebf50c Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 4 Aug 2018 14:06:03 +0100 Subject: test suite: gdr-subcommands: Test scrap Signed-off-by: Ian Jackson --- tests/tests/gdr-subcommands | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/tests/gdr-subcommands b/tests/tests/gdr-subcommands index 0b07372..c48fb5d 100755 --- a/tests/tests/gdr-subcommands +++ b/tests/tests/gdr-subcommands @@ -35,10 +35,12 @@ mix-it git checkout -b unstitched-laundered master mix-it +git branch before-unstitch/unstitched-laundered t-git-debrebase t-gdr-good laundered git checkout -b unstitched-mixed master +git branch before-unstitch/unstitched-mixed t-git-debrebase mix-it @@ -173,6 +175,12 @@ make_check () { f*) t-has-ancestor HEAD refs/heads/$before ;; + Z*) + t-refs-same-start + t-refs-same refs/heads/$work + t-refs-same refs/heads/before-unstitch/$startbranch + t-ref-head + ;; *) fail "$1" ;; @@ -195,6 +203,7 @@ subcmd stitch Ns Nu Sltf Stf subcmd prepush Ns Nu Sltf Stf subcmd quick ns Sl Sltf Sl subcmd conclude "$Ec" "$Ec" Sltf Sl +subcmd scrap Ns Ns Z Z subcmd make-patches sPft "$Ep" uPft "$Ep" #subcmd dgit-upload-hook Psft "$Ep" SPft "$Ep" # @@ -215,6 +224,7 @@ subcmd make-patches sPft "$Ep" uPft "$Ep" # V ffq-prev remains unchanged; implies also u # s result is stitched, debrebase-last exists and is unchanged # S result is stitch just made, remaining letters apply to result~ +# Z result is rewind to before changes made # # P result is add-patches, remaining letters apply to result~ # -- cgit v1.2.3 From d436b26183c219a8633f84aa39cf991fd8b6de4d Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 4 Aug 2018 14:06:21 +0100 Subject: test suite: gdr-subcommands: Drop obsolete line We have done this another way and there will never be a push-hook like this. Signed-off-by: Ian Jackson --- tests/tests/gdr-subcommands | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/tests/gdr-subcommands b/tests/tests/gdr-subcommands index c48fb5d..b4d8f44 100755 --- a/tests/tests/gdr-subcommands +++ b/tests/tests/gdr-subcommands @@ -205,7 +205,6 @@ subcmd quick ns Sl Sltf Sl subcmd conclude "$Ec" "$Ec" Sltf Sl subcmd scrap Ns Ns Z Z subcmd make-patches sPft "$Ep" uPft "$Ep" -#subcmd dgit-upload-hook Psft "$Ep" SPft "$Ep" # # result codes, each one is a check: # E:$pat } this is an error (must come first) -- cgit v1.2.3 From bc3be36a946aeb6485259be594645c3c3d69550f Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 4 Aug 2018 14:28:16 +0100 Subject: git-debrebase: check for git-rebase in progress and abort most operations scrap should abort, but doesn't yet. status just prints a message. Signed-off-by: Ian Jackson --- debian/changelog | 1 + git-debrebase | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/debian/changelog b/debian/changelog index 787cd2c..fdd5509 100644 --- a/debian/changelog +++ b/debian/changelog @@ -11,6 +11,7 @@ dgit (6.5~) unstable; urgency=medium * git-debrebase: Provide new convert-from-dgit-view operation. The output is, unavoidably, not very pretty. Closes:#905322. * git-debrebase: New feature `scrap'. Closes:#905063. + * git-debrebase: check for git-rebase in progress and abort most operations. -- diff --git a/git-debrebase b/git-debrebase index 4046425..f4831c3 100755 --- a/git-debrebase +++ b/git-debrebase @@ -975,6 +975,18 @@ sub update_head_postlaunder ($$$) { runcmd @git, qw(rm --quiet --ignore-unmatch -rf debian/patches); } +sub currently_rebasing() { + foreach (qw(rebase-merge rebase-apply)) { + return 1 if stat_exists "$maindir_gitdir/$_"; + } + return 0; +} + +sub bail_if_rebasing() { + fail "you are in the middle of a git-rebase already" + if currently_rebasing(); +} + sub do_launder_head ($) { my ($reflogmsg) = @_; my $old = get_head(); @@ -1114,6 +1126,7 @@ sub record_ffq_prev_deferred () { # if "deferred", will have added something about that to # @deferred_update_messages, and also maybe printed (already) # some messages about ff checks + bail_if_rebasing(); my $currentval = get_head(); my ($status,$message, $ffq_prev,$gdrlast) = ffq_check $currentval; @@ -1137,6 +1150,7 @@ sub record_ffq_auto () { } sub ffq_prev_info () { + bail_if_rebasing(); # => ($ffq_prev, $gdrlast, $ffq_prev_commitish) my ($status, $message, $current, $ffq_prev, $gdrlast) = ffq_prev_branchinfo(); @@ -1547,6 +1561,7 @@ sub cmd_status () { print " not git-debrebase (diverged since last stitch)\n" } } + print "you are currently rebasing\n" if currently_rebasing(); } sub cmd_stitch () { @@ -1633,6 +1648,7 @@ sub cmd_make_patches () { getoptions("make-patches", 'quiet-would-amend!', \$opt_quiet_would_amend); badusage "no arguments allowed" if @ARGV; + bail_if_rebasing(); my $old_head = get_head(); my $new = make_patches $old_head; my $d = get_differs $old_head, $new; -- cgit v1.2.3 From 76b90289f6bbd304e35d984cebd28a1cbc14d4fe Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 4 Aug 2018 14:31:41 +0100 Subject: git-debrebase: scrap: Run git-rebase --abort if applicable Signed-off-by: Ian Jackson --- git-debrebase | 3 +++ git-debrebase.1.pod | 2 ++ 2 files changed, 5 insertions(+) diff --git a/git-debrebase b/git-debrebase index f4831c3..24be35e 100755 --- a/git-debrebase +++ b/git-debrebase @@ -1593,6 +1593,9 @@ sub cmd_conclude () { } sub cmd_scrap () { + if (currently_rebasing()) { + runcmd @git, qw(rebase --abort); + } my ($ffq_prev, $gdrlast, $ffq_prev_commitish) = ffq_prev_info(); if (!$ffq_prev_commitish) { fail "No ongoing git-debrebase session." unless $opt_noop_ok; diff --git a/git-debrebase.1.pod b/git-debrebase.1.pod index 28f3084..fe65674 100644 --- a/git-debrebase.1.pod +++ b/git-debrebase.1.pod @@ -111,6 +111,8 @@ because that launders the branch too. Throws away all the work since the branch was last stitched. This is done by rewinding you to ffq-prev. +If you are in the middle of a git-rebase, will abort that too. + =item git-debrebase new-upstream [...] Rebases the delta queue -- cgit v1.2.3 From db9a52f723ee82e8f01a8de1b7822ee98ecf7a18 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 4 Aug 2018 17:38:35 +0100 Subject: changelog: Categorise and reorder entries Signed-off-by: Ian Jackson --- debian/changelog | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/debian/changelog b/debian/changelog index fdd5509..f2cce1d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,17 +1,24 @@ dgit (6.5~) unstable; urgency=medium - * test suite: Add t-tstunt-parsechangelog to many gdr tests. - * test suite: editing a test script overrides DGIT_TESTS_PROGRESSIVE. - * dgit: Rename --dgit-view-save to --save-dgit-view, leaving an alias. - * dgit: Provide print-unapplied-treeish subcommand. - * dgit: Improve error message for unknown suite, to suggest -d. + git-debrebase new features: + * git-debrebase: Provide new convert-from-dgit-view operation. + The output is, unavoidably, not very pretty. Closes:#905322. + * git-debrebase: New subcommand `scrap'. Closes:#905063. + + git-debrebase error handling improvements: * git-debrebase: Properly reject bare dgit dsc imports * git-debrebase: Improve some error message formatting. + * git-debrebase: Check for git-rebase in progress and abort most operations. + + dgit improvements: + * dgit: Improve error message for unknown suite, to suggest -d. + * dgit: Rename --dgit-view-save to --save-dgit-view, leaving an alias. + * dgit: Provide print-unapplied-treeish subcommand. + + Test suite changes: + * test suite: Add t-tstunt-parsechangelog to many gdr tests. + * test suite: editing a test script overrides DGIT_TESTS_PROGRESSIVE. * test suite: gdr-import-dgitview: New test for dgit dsc imports. - * git-debrebase: Provide new convert-from-dgit-view operation. - The output is, unavoidably, not very pretty. Closes:#905322. - * git-debrebase: New feature `scrap'. Closes:#905063. - * git-debrebase: check for git-rebase in progress and abort most operations. -- -- cgit v1.2.3 From adc50d1b8db1796f5d38743af1b18f1abda3b3cd Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 4 Aug 2018 17:54:07 +0100 Subject: changelog: finalise 6.5 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index f2cce1d..df6dcdd 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -dgit (6.5~) unstable; urgency=medium +dgit (6.5) unstable; urgency=medium git-debrebase new features: * git-debrebase: Provide new convert-from-dgit-view operation. @@ -20,7 +20,7 @@ dgit (6.5~) unstable; urgency=medium * test suite: editing a test script overrides DGIT_TESTS_PROGRESSIVE. * test suite: gdr-import-dgitview: New test for dgit dsc imports. - -- + -- Ian Jackson Sat, 04 Aug 2018 17:53:57 +0100 dgit (6.4) unstable; urgency=medium -- cgit v1.2.3 From 486fcc0b7b82c9dcca4a4ad52af592e176ab8f18 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 5 Aug 2018 10:19:11 +0100 Subject: changelog: Start 6.5 Signed-off-by: Ian Jackson --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index df6dcdd..1ca7cf0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +dgit (6.6~) unstable; urgency=medium + + * + + -- + dgit (6.5) unstable; urgency=medium git-debrebase new features: -- cgit v1.2.3 From 75ca716a6e0a737795ab552a830ee277f8fda56c Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 5 Aug 2018 10:32:08 +0100 Subject: test suite: Fix gdr's calls to dgit when run formally in autopkgtest. We should not pass `--dgit='. That causes gdr to try to exec "". Affects gdr-import-dgitview. Signed-off-by: Ian Jackson --- debian/changelog | 3 ++- tests/lib-gdr | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 1ca7cf0..dce10bf 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,7 @@ dgit (6.6~) unstable; urgency=medium - * + * test suite: Fix gdr's calls to dgit when run formally in + autopkgtest. (Affects gdr-import-dgitview.) -- diff --git a/tests/lib-gdr b/tests/lib-gdr index 7b43d4f..479ef41 100644 --- a/tests/lib-gdr +++ b/tests/lib-gdr @@ -7,7 +7,8 @@ t-git-debrebase () { local gdr=${DGIT_GITDEBREBASE_TEST-git-debrebase} : ' {{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{' - $gdr --dgit=$DGIT_TEST $GDR_TEST_OPTS $GDR_TEST_DEBUG $t_gdr_xopts "$@" + $gdr "--dgit=${DGIT_TEST-dgit}" $GDR_TEST_OPTS \ + $GDR_TEST_DEBUG $t_gdr_xopts "$@" : '}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} ' } -- cgit v1.2.3 From 66d19f834577d2495c8255f042aff4d86d040049 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 5 Aug 2018 10:42:15 +0100 Subject: changelog: finalise 6.6. Signed-off-by: Ian Jackson --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index dce10bf..31cc533 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,9 +1,9 @@ -dgit (6.6~) unstable; urgency=medium +dgit (6.6) unstable; urgency=medium * test suite: Fix gdr's calls to dgit when run formally in autopkgtest. (Affects gdr-import-dgitview.) - -- + -- Ian Jackson Sun, 05 Aug 2018 10:42:01 +0100 dgit (6.5) unstable; urgency=medium -- cgit v1.2.3