From 8d37038bddb78dbe6dcf1c1e2bc515c1dcd7002c Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Wed, 11 Sep 2013 23:34:56 +0100 Subject: Better handling of packages pushed using dgit and stuck in NEW. (And, use of `--new' is not needed with fetch.) Closes: #722199. Specifically * get_archive_dsc leaves its answer in $dsc, not the return value * fetch_from_archive tolerates get_archive_dsc saying "no", and then uses the git ref, with a warning message --- dgit | 43 ++++++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 13 deletions(-) (limited to 'dgit') diff --git a/dgit b/dgit index 562cef0..f77d349 100755 --- a/dgit +++ b/dgit @@ -452,9 +452,9 @@ sub get_archive_dsc () { print DEBUG Dumper($dsc) if $debug>1; my $fmt = getfield $dsc, 'Format'; fail "unsupported source format $fmt, sorry" unless $format_ok{$fmt}; - return $dsc; + return; } - return undef; + $dsc = undef; } sub check_for_git () { @@ -688,17 +688,22 @@ sub git_fetch_us () { sub fetch_from_archive () { # ensures that lrref() is what is actually in the archive, # one way or another - get_archive_dsc() or return 0; - foreach my $field (@ourdscfield) { - $dsc_hash = $dsc->{$field}; - last if defined $dsc_hash; - } - if (defined $dsc_hash) { - $dsc_hash =~ m/\w+/ or fail "invalid hash in .dsc \`$dsc_hash'"; - $dsc_hash = $&; - print "last upload to archive specified git hash\n"; + get_archive_dsc(); + + if ($dsc) { + foreach my $field (@ourdscfield) { + $dsc_hash = $dsc->{$field}; + last if defined $dsc_hash; + } + if (defined $dsc_hash) { + $dsc_hash =~ m/\w+/ or fail "invalid hash in .dsc \`$dsc_hash'"; + $dsc_hash = $&; + print "last upload to archive specified git hash\n"; + } else { + print "last upload to archive has NO git hash\n"; + } } else { - print "last upload to archive has NO git hash\n"; + print "no version available from the archive\n"; } my $lrref_fn = ".git/".lrref(); @@ -734,8 +739,20 @@ END fail "archive's .dsc refers to ".$dsc_hash. " but this is an ancestor of ".$lastpush_hash; } - } else { + } elsif ($dsc) { $hash = generate_commit_from_dsc(); + } elsif ($lastpush_hash) { + # only in git, not in the archive yet + $hash = $lastpush_hash; + print STDERR <