From dda17d8a6fec27f631653cf8ac63ba6d96e642c3 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 7 Jan 2017 18:51:37 +0000 Subject: dgit: Dgit parsing: Move @ourdscfield loop into parse_dsc_field 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 --- dgit | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/dgit b/dgit index de7b4de..eb6fb9c 100755 --- 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)]) { -- cgit v1.2.3