chiark / gitweb /
dgit: Dgit parsing: Move @ourdscfield loop into parse_dsc_field
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 7 Jan 2017 18:51:37 +0000 (18:51 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 8 Jan 2017 22:14:48 +0000 (22:14 +0000)
This gives it the $dsc.  Also it means that import-dsc will understand
very old .dscs with Vcs-Dgit-Master.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
dgit

diff --git a/dgit b/dgit
index de7b4de625ec4520ff13d552cee200172d76c3b3..eb6fb9cd5970169854b0a5f85551b746c03c23d9 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -2704,7 +2704,12 @@ sub fetch_from_archive_record_2 ($) {
 }
 
 sub parse_dsc_field ($$) {
-    my ($f, $what) = @_;
+    my ($dsc, $what) = @_;
+    my $f;
+    foreach my $field (@ourdscfield) {
+       $f = $dsc->{$field};
+       last if defined $f;
+    }
     if (!defined $f) {
        progress "$what: NO git hash";
     } elsif ($f =~ m/^\w+/) {
@@ -2726,12 +2731,7 @@ sub fetch_from_archive () {
     get_archive_dsc();
 
     if ($dsc) {
-       my $f;
-       foreach my $field (@ourdscfield) {
-           $f = $dsc->{$field};
-           last if defined $f;
-       }
-       parse_dsc_field($f, 'last upload to archive');
+       parse_dsc_field($dsc, 'last upload to archive');
     } else {
        progress "no version available from the archive";
     }
@@ -5901,8 +5901,7 @@ sub cmd_import_dsc {
 
     parse_dscdata();
 
-    my $dgit_field = $dsc->{$ourdscfield[0]};
-    parse_dsc_field($dgit_field, "$ourdscfield[0] field in .dsc");
+    parse_dsc_field($dsc, "Dgit metadata in .dsc");
 
     if (defined $dsc_hash
        && !forceing [qw(import-dsc-with-dgit-field)]) {