From c83cc428208bee99de3b75158b9779449403ee1b Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 31 Jul 2018 13:16:53 +0100 Subject: [PATCH] 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 ef70f6e2..4d6e50af 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 5d3c7426..2687ef1f 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 273ef47d..b15bf00c 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. -- 2.30.2