chiark / gitweb /
Dgit.pm: Move resolve_upstream_version from git-debrebase
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 28 Jun 2019 16:30:55 +0000 (17:30 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 28 Jun 2019 23:43:18 +0000 (00:43 +0100)
No functional change.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Debian/Dgit.pm
git-debrebase

index 892ebf9..912a524 100644 (file)
@@ -45,7 +45,8 @@ BEGIN {
                      dep14_version_mangle
                       debiantags debiantag_new
                      debiantag_maintview
-                     upstreamversion upstream_commitish_search
+                     upstreamversion
+                     upstream_commitish_search resolve_upstream_version
                      stripepoch source_file_leafname is_orig_file_of_p_v
                      server_branch server_ref
                       stat_exists link_ltarget rename_link_xf
@@ -628,6 +629,28 @@ sub upstream_commitish_search ($$) {
     }
 }
 
+sub resolve_upstream_version ($$) {
+    my ($new_upstream, $upstream_version) = @_;
+
+    my $used = $new_upstream;
+    if (!defined $new_upstream) {
+       my @tried;
+       $new_upstream = upstream_commitish_search $upstream_version, \@tried;
+       if (!length $new_upstream) {
+           fail f_
+               "Could not determine appropriate upstream commitish.\n".
+               " (Tried these tags: %s)\n".
+               " Check version, and specify upstream commitish explicitly.",
+               "@tried";
+       }
+       $used = $tried[-1];
+    }
+    $new_upstream = git_rev_parse $new_upstream;
+
+    return ($new_upstream, $used);
+    # used is a human-readable idea of what we found
+}
+
 sub is_fast_fwd ($$) {
     my ($ancestor,$child) = @_;
     my @cmd = (qw(git merge-base), $ancestor, $child);
index eb585e3..39b700a 100755 (executable)
@@ -1994,28 +1994,6 @@ sub do_stitch ($;$) {
     stitch($dangling_head, $ffq_prev, $gdrlast, $ffq_prev_commitish, $prose);
 }
 
-sub resolve_upstream_version ($$) {
-    my ($new_upstream, $upstream_version) = @_;
-
-    my $used = $new_upstream;
-    if (!defined $new_upstream) {
-       my @tried;
-       $new_upstream = upstream_commitish_search $upstream_version, \@tried;
-       if (!length $new_upstream) {
-           fail f_
-               "Could not determine appropriate upstream commitish.\n".
-               " (Tried these tags: %s)\n".
-               " Check version, and specify upstream commitish explicitly.",
-               "@tried";
-       }
-       $used = $tried[-1];
-    }
-    $new_upstream = git_rev_parse $new_upstream;
-
-    return ($new_upstream, $used);
-    # used is a human-readable idea of what we found
-}
-
 sub cmd_new_upstream () {
     # automatically and unconditionally launders before rebasing
     # if rebase --abort is used, laundering has still been done