chiark / gitweb /
git-debrebase: convert-from-gbp: Use same algorithm for finding upstream
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 31 Jul 2018 12:16:53 +0000 (13:16 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 31 Jul 2018 12:16:54 +0000 (13:16 +0100)
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 <ijackson@chiark.greenend.org.uk>
debian/changelog
git-debrebase
git-debrebase.1.pod

index ef70f6e284ca3c903636bb1266846ea58c83bd20..4d6e50af5b9d1ab0cecf40d6975f668c89b92699 100644 (file)
@@ -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.
 
  --
 
index 5d3c7426da687046ae3dccabc134cab99f484458..2687ef1f6873240c22feb16df93621328841c809 100755 (executable)
@@ -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;
index 273ef47dc1c13ee465d59950783a1f495b63763d..b15bf00c1c88f233fa569f38a693e0cca4d5523d 100644 (file)
@@ -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.