X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=blobdiff_plain;f=dgit;h=8f4a71c2a3683087b020520dcc05fea6eb8a1fe5;hp=a051622d1617310b3e5555307d2de534a3c024a5;hb=067e68de07f7d1cf1d406c4917e9cdd7b0b6f26a;hpb=6a8f914beb77ec4cc36ed0aecb0e5da31a450418 diff --git a/dgit b/dgit index a051622d..8f4a71c2 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 (@) { @@ -634,6 +646,7 @@ sub access_gituserhost () { sub access_giturl (;$) { my ($optional) = @_; my $url = access_cfg('git-url','RETURN-UNDEF'); + my $suffix; if (!defined $url) { my $proto = access_cfg('git-proto', 'RETURN-UNDEF'); return undef unless defined $proto; @@ -641,8 +654,11 @@ sub access_giturl (;$) { $proto. access_gituserhost(). access_cfg('git-path'); + } else { + $suffix = access_cfg('git-url-suffix','RETURN-UNDEF'); } - return "$url/$package.git"; + $suffix //= '.git'; + return "$url/$package$suffix"; } sub parsecontrolfh ($$;$) { @@ -1034,6 +1050,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 +1967,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 +2021,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 +2082,7 @@ sub i_method { } sub cmd_rpush { + pushing(); my $host = nextarg; my $dir; if ($host =~ m/^((?:[^][]|\[[^][]*\])*)\:/) {