chiark / gitweb /
Protocol change: Add distro info to Dgit field
[dgit.git] / dgit
diff --git a/dgit b/dgit
index 88bd431ab37e277bcd273079a2f6fc42078e3030..54c38c24f534c668b3ecf6e3fccbd62d70cb5c48 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -142,7 +142,6 @@ our %opts_cfg_insertpos = map {
     scalar @{ $opts_opt_map{$_} }
 } keys %opts_opt_map;
 
-sub finalise_opts_opts();
 sub parseopts_late_defaults();
 
 our $keyid;
@@ -792,11 +791,11 @@ sub pushing () {
 Push failed, before we got started.
 You can retry the push, after fixing the problem, if you like.
 END
-    finalise_opts_opts();
+    parseopts_late_defaults();
 }
 
 sub notpushing () {
-    finalise_opts_opts();
+    parseopts_late_defaults();
 }
 
 sub supplementary_message ($) {
@@ -3724,7 +3723,11 @@ sub push_mktags ($$ $$ $) {
 
     die unless $tagwants->[0]{View} eq 'dgit';
 
-    $dsc->{$ourdscfield[0]} = $tagwants->[0]{Objid};
+    my $declaredistro = access_nomdistro();
+    my $reader_giturl = do { local $access_forpush=0; access_giturl(); };
+    $dsc->{$ourdscfield[0]} = join " ",
+       $tagwants->[0]{Objid}, $declaredistro, $tagwants->[0]{Tag},
+       $reader_giturl;
     $dsc->save("$dscfn.tmp") or die $!;
 
     my $changes = parsecontrol($changesfile,$changesfilewhat);
@@ -3741,7 +3744,6 @@ sub push_mktags ($$ $$ $) {
     # to control the "tagger" (b) we can do remote signing
     my $authline = clogp_authline $clogp;
     my $delibs = join(" ", "",@deliberatelies);
-    my $declaredistro = access_nomdistro();
 
     my $mktag = sub {
        my ($tw) = @_;
@@ -4132,7 +4134,6 @@ sub branchsuite () {
 }
 
 sub fetchpullargs () {
-    notpushing();
     if (!defined $package) {
        my $sourcep = parsecontrol('debian/control','debian/control');
        $package = getfield $sourcep, 'Source';
@@ -4148,6 +4149,7 @@ sub fetchpullargs () {
     } else {
        badusage "incorrect arguments to dgit fetch or dgit pull";
     }
+    notpushing();
 }
 
 sub cmd_fetch {
@@ -6265,7 +6267,7 @@ END
 }
 
 
-sub finalise_opts_opts () {
+sub parseopts_late_defaults () {
     foreach my $k (keys %opts_opt_map) {
        my $om = $opts_opt_map{$k};
 
@@ -6293,32 +6295,6 @@ sub finalise_opts_opts () {
        }
     }
 
-    parseopts_late_defaults();
-}
-
-if ($ENV{$fakeeditorenv}) {
-    git_slurp_config();
-    quilt_fixup_editor();
-}
-
-parseopts();
-check_env_sanity();
-git_slurp_config();
-
-print STDERR "DRY RUN ONLY\n" if $dryrun_level > 1;
-print STDERR "DAMP RUN - WILL MAKE LOCAL (UNSIGNED) CHANGES\n"
-    if $dryrun_level == 1;
-if (!@ARGV) {
-    print STDERR $helpmsg or die $!;
-    exit 8;
-}
-my $cmd = shift @ARGV;
-$cmd =~ y/-/_/;
-
-my $pre_fn = ${*::}{"pre_$cmd"};
-$pre_fn->() if $pre_fn;
-
-sub parseopts_late_defaults () {
     if (!defined $rmchanges) {
        local $access_forpush;
        $rmchanges = access_cfg_bool(0, 'rm-old-changes');
@@ -6354,6 +6330,28 @@ sub parseopts_late_defaults () {
     }
 }
 
+if ($ENV{$fakeeditorenv}) {
+    git_slurp_config();
+    quilt_fixup_editor();
+}
+
+parseopts();
+check_env_sanity();
+git_slurp_config();
+
+print STDERR "DRY RUN ONLY\n" if $dryrun_level > 1;
+print STDERR "DAMP RUN - WILL MAKE LOCAL (UNSIGNED) CHANGES\n"
+    if $dryrun_level == 1;
+if (!@ARGV) {
+    print STDERR $helpmsg or die $!;
+    exit 8;
+}
+my $cmd = shift @ARGV;
+$cmd =~ y/-/_/;
+
+my $pre_fn = ${*::}{"pre_$cmd"};
+$pre_fn->() if $pre_fn;
+
 my $fn = ${*::}{"cmd_$cmd"};
 $fn or badusage "unknown operation $cmd";
 $fn->();