From: Ian Jackson Date: Wed, 11 Sep 2013 22:34:56 +0000 (+0100) Subject: Better handling of packages pushed using dgit and stuck in NEW. (And, use of `--new... X-Git-Tag: debian/0.15~4 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=commitdiff_plain;h=8d37038bddb78dbe6dcf1c1e2bc515c1dcd7002c 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 --- diff --git a/debian/changelog b/debian/changelog index 191ea084..507d2c13 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,8 @@ dgit (0.15) unstable; urgency=low * Implement `dgit help' as well as `--help'. Closes: #721661. * Provide `dgit version' and `--version'. Closes: #721654. + * Better handling of packages pushed using dgit and stuck in NEW. + (And, use of `--new' is not needed with fetch.) Closes: #722199. -- diff --git a/dgit b/dgit index 562cef08..f77d349b 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 <