X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=blobdiff_plain;f=dgit;h=9768fe9309870d26e36ebc3fdd2e6f0dbf939974;hp=deb633ba90eb86ebe42dcf6ba58396c6f880ac9a;hb=66594ad255963a63ee55caa88ce5fa3a2b5954a1;hpb=86bc713be7d9ea486b76e947ceffed91b4265f0f diff --git a/dgit b/dgit index deb633ba..9768fe93 100755 --- a/dgit +++ b/dgit @@ -28,7 +28,7 @@ use File::Basename; use Dpkg::Version; use POSIX; -our $dgit_version = 'UNRELEASED'; ###substituted### +our $our_version = 'UNRELEASED'; ###substituted### our $isuite = 'unstable'; our $idistro; @@ -209,6 +209,11 @@ sub runcmd_ordryrun { } } +sub shell_cmd { + my ($first_shell, @cmd) = @_; + return qw(sh -ec), $first_shell.'; exec "$@"', 'x', @cmd; +} + our $helpmsg = <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 () { @@ -485,7 +490,7 @@ sub create_remote_git_repo () { } } -our ($dsc_hash,$upload_hash); +our ($dsc_hash,$lastpush_hash); our $ud = '.git/dgit/unpack'; @@ -596,8 +601,8 @@ END my $outputhash = make_commit qw(../commit.tmp); my $cversion = getfield $clogp, 'Version'; print "synthesised git commit from .dsc $cversion\n"; - if ($upload_hash) { - runcmd @git, qw(reset --hard), $upload_hash; + if ($lastpush_hash) { + runcmd @git, qw(reset --hard), $lastpush_hash; runcmd qw(sh -ec), 'dpkg-parsechangelog >>../changelogold.tmp'; my $oldclogp = parsecontrol('../changelogold.tmp','previous changelog'); my $oversion = getfield $oldclogp, 'Version'; @@ -608,7 +613,7 @@ END open C, ">../commit2.tmp" or die $!; print C <{$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(); if (open H, $lrref_fn) { - $upload_hash = ; - chomp $upload_hash; - die "$lrref_fn $upload_hash ?" unless $upload_hash =~ m/^\w+$/; + $lastpush_hash = ; + chomp $lastpush_hash; + die "$lrref_fn $lastpush_hash ?" unless $lastpush_hash =~ m/^\w+$/; } elsif ($! == &ENOENT) { - $upload_hash = ''; + $lastpush_hash = ''; } else { die "$lrref_fn $!"; } - print DEBUG "previous reference hash=$upload_hash\n"; + print DEBUG "previous reference hash=$lastpush_hash\n"; my $hash; if (defined $dsc_hash) { fail "missing git history even though dsc has hash -". " could not find commit $dsc_hash". " (should be in ".access_giturl()."#".rrref().")" - unless $upload_hash; + unless $lastpush_hash; $hash = $dsc_hash; ensure_we_have_orig(); - if ($dsc_hash eq $upload_hash) { - } elsif (is_fast_fwd($dsc_hash,$upload_hash)) { + if ($dsc_hash eq $lastpush_hash) { + } elsif (is_fast_fwd($dsc_hash,$lastpush_hash)) { print STDERR <