X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=blobdiff_plain;f=dgit;h=91b1aa3dc3af35efc223b748420dabd6ea873307;hp=9d1570c7a9f86fdfba869973e12cc08487cb8afb;hb=cbca47ad5bff421a432a2183c28b897acaeb4b02;hpb=28789232f5edcc1c24bbb4bfe3b5e12119e9886e diff --git a/dgit b/dgit index 9d1570c7..91b1aa3d 100755 --- a/dgit +++ b/dgit @@ -28,6 +28,8 @@ use File::Basename; use Dpkg::Version; use POSIX; +our $dgit_version = 'UNRELEASED'; ###substituted### + our $isuite = 'unstable'; our $idistro; our $package; @@ -230,7 +232,7 @@ sub badusage { exit 8; } -sub helponly () { +sub cmd_help () { print $helpmsg or die $!; exit 0; } @@ -247,6 +249,7 @@ our %defcfg = ('dgit.default.distro' => 'debian', 'dgit-distro.debian.sshdakls-host' => 'coccia.debian.org', 'dgit-distro.debian.sshdakls-dir' => '/srv/ftp-master.debian.org/ftp/dists', + 'dgit-distro.debian.upload-host' => 'ftp-master', # for dput 'dgit-distro.debian.mirror' => 'http://ftp.debian.org/debian/'); sub cfg { @@ -679,8 +682,7 @@ sub is_fast_fwd ($$) { } sub git_fetch_us () { - badusage "cannot dry run with fetch" if $dryrun; - runcmd @git, qw(fetch),access_giturl(),fetchspec(); + runcmd_ordryrun @git, qw(fetch),access_giturl(),fetchspec(); } sub fetch_from_archive () { @@ -767,7 +769,7 @@ sub clone ($) { if (check_for_git()) { print "fetching existing git history\n"; git_fetch_us(); - runcmd @git, qw(fetch origin); + runcmd_ordryrun @git, qw(fetch origin); } else { print "starting new git history\n"; } @@ -911,6 +913,7 @@ sub dopush () { create_remote_git_repo(); } runcmd_ordryrun @git, qw(push),access_giturl(),"HEAD:".rrref(); + runcmd_ordryrun @git, qw(update-ref -m), 'dgit push', lrref(), 'HEAD'; if (!$dryrun) { rename "../$dscfn.tmp","../$dscfn" or die "$dscfn $!"; } else { @@ -921,7 +924,7 @@ sub dopush () { $keyid = access_cfg('keyid','RETURN-UNDEF'); } my @tag_cmd = (@git, qw(tag -s -m), - "Release $dversion for $csuite [dgit]"); + "$package release $dversion for $csuite [dgit]"); push @tag_cmd, qw(-u),$keyid if defined $keyid; push @tag_cmd, $tag; runcmd_ordryrun @tag_cmd; @@ -1054,6 +1057,7 @@ sub build_maybe_quilt_fixup () { my $ncommits = 3; my $patchname = "auto-$version-$headref-$time"; my $msg = cmdoutput @git, qw(log), "-n$ncommits"; + mkpath '.git/dgit'; my $descfn = ".git/dgit/quilt-description.tmp"; open O, '>', $descfn or die "$descfn: $!"; $msg =~ s/\n/\n /g; @@ -1197,6 +1201,10 @@ sub cmd_quilt_fixup { build_maybe_quilt_fixup(); } +sub cmd_version { + print "dgit version $dgit_version\n"; +} + sub parseopts () { my $om; while (@ARGV) { @@ -1209,7 +1217,7 @@ sub parseopts () { } elsif (m/^--no-sign$/) { $sign=0; } elsif (m/^--help$/) { - helponly(); + cmd_help(); } elsif (m/^--new$/) { $new_package=1; } elsif (m/^--(\w+)=(.*)/s && @@ -1239,7 +1247,7 @@ sub parseopts () { if (s/^-n/-/) { $dryrun=1; } elsif (s/^-h/-/) { - helponly(); + cmd_help(); } elsif (s/^-D/-/) { open DEBUG, ">&STDERR" or die $!; $debug++;