summaryrefslogtreecommitdiff
path: root/dgit
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2015-07-18 14:42:01 +0100
committerIan Jackson <ijackson@chiark.greenend.org.uk>2015-07-19 19:36:14 +0100
commit4c06b83c1207a4a5d92575ef5117be6f2fab6104 (patch)
treef7581968a4f551ca184b961cac85f0e6d2800990 /dgit
parentb41c0ab7f4a34da89964ce85ffeccae6dce52191 (diff)
Provide for different access mechanisms when pushing.
Diffstat (limited to 'dgit')
-rwxr-xr-xdgit18
1 files changed, 17 insertions, 1 deletions
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/^((?:[^][]|\[[^][]*\])*)\:/) {