From 4c06b83c1207a4a5d92575ef5117be6f2fab6104 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 18 Jul 2015 14:42:01 +0100 Subject: Provide for different access mechanisms when pushing. --- debian/changelog | 3 +++ dgit | 18 +++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index a1f6ba1..716b1ad 100644 --- a/debian/changelog +++ b/debian/changelog @@ -11,6 +11,9 @@ dgit (0.31~~) unstable; urgency=low * Provide -wdd aka --clean=dpkg-source-d. Closes:#792433. * Provide -wc aka --clean=check. + Access machinery: + * Provide for different access mechanisms when pushing. + Infrastructure: * Provide for mirroring git updates to a different server. * Provide cgit-regen-config command for cgi-grnet-01. diff --git a/dgit b/dgit index a051622..76a073f 100755 --- a/dgit +++ b/dgit @@ -461,6 +461,7 @@ our %defcfg = ('dgit.default.distro' => 'debian', # '--ca-path=/etc/ssl/ca-debian', # ^ this is a workaround but works (only) on DSA-administered machines 'dgit-distro.debian.diverts.alioth' => '/alioth', + 'dgit-distro.debian/push.diverts.alioth' => '/alioth', 'dgit-distro.debian/alioth.git-host' => 'git.debian.org', 'dgit-distro.debian/alioth.git-user-force' => '', 'dgit-distro.debian/alioth.git-proto' => 'git+ssh://', @@ -548,6 +549,12 @@ sub access_quirk () { return ('none',undef); } +our $access_pushing = 0; + +sub pushing () { + $access_pushing = 1; +} + sub access_distros () { # Returns list of distros to try, in order # @@ -561,7 +568,12 @@ sub access_distros () { my (undef,$quirkdistro) = access_quirk(); unshift @l, $quirkdistro; unshift @l, $instead_distro; - return grep { defined } @l; + @l = grep { defined } @l; + + if ($access_pushing) { + @l = map { ("$_/push", $_) } @l; + } + @l; } sub access_cfg (@) { @@ -1034,6 +1046,7 @@ sub check_for_git () { if ($r =~ m/^divert (\w+)$/) { my $divert=$1; my ($usedistro,) = access_distros(); + # NB that if we are pushing, $usedistro will be $distro/push $instead_distro= cfg("dgit-distro.$usedistro.diverts.$divert"); $instead_distro =~ s{^/}{ access_basedistro()."/" }e; progress "diverting to $divert (using config for $instead_distro)"; @@ -1950,6 +1963,7 @@ sub cmd_pull { } sub cmd_push { + pushing(); parseopts(); badusage "-p is not allowed with dgit push" if defined $package; check_not_dirty(); @@ -2003,6 +2017,7 @@ sub cmd_push { #---------- remote commands' implementation ---------- sub cmd_remote_push_build_host { + pushing(); my ($nrargs) = shift @ARGV; my (@rargs) = @ARGV[0..$nrargs-1]; @ARGV = @ARGV[$nrargs..$#ARGV]; @@ -2063,6 +2078,7 @@ sub i_method { } sub cmd_rpush { + pushing(); my $host = nextarg; my $dir; if ($host =~ m/^((?:[^][]|\[[^][]*\])*)\:/) { -- cgit v1.2.3