diff options
author | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2013-09-11 23:34:56 +0100 |
---|---|---|
committer | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2013-09-11 23:34:59 +0100 |
commit | 8d37038bddb78dbe6dcf1c1e2bc515c1dcd7002c (patch) | |
tree | c40a3faffbec0e49909315d9e1157908020a720e /dgit | |
parent | 7c57131ff6c444187b09ed9be5b58e5c0112a5e2 (diff) |
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
Diffstat (limited to 'dgit')
-rwxr-xr-x | dgit | 43 |
1 files changed, 30 insertions, 13 deletions
@@ -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 <<END or die $!; + +Package not found in the archive, but has allegedly been +pushed/uploaded using dgit. +$later_warning_msg +END + } else { + print DEBUG "nothing found!\n"; + return 0; } print DEBUG "current hash=$hash\n"; if ($lastpush_hash) { |