'writes' -> 'writable', order of arguments changed

This commit is contained in:
Sitaram Chamarty 2012-03-27 19:28:56 +05:30
parent cc8b10483b
commit 2bec551009
4 changed files with 12 additions and 13 deletions

View file

@ -94,7 +94,7 @@ $ENV{PATH} = "$ENV{GL_BINDIR}:$ENV{PATH}";
} }
# these two are meant to help externally written commands (see # these two are meant to help externally written commands (see
# src/commands/writes for an example) # src/commands/writable for an example)
$ENV{GL_REPO_BASE} = $rc{GL_REPO_BASE}; $ENV{GL_REPO_BASE} = $rc{GL_REPO_BASE};
$ENV{GL_ADMIN_BASE} = $rc{GL_ADMIN_BASE}; $ENV{GL_ADMIN_BASE} = $rc{GL_ADMIN_BASE};
@ -282,7 +282,7 @@ __DATA__
'info' => 1, 'info' => 1,
'desc' => 1, 'desc' => 1,
'perms' => 1, 'perms' => 1,
'writes' => 1, 'writable' => 1,
}, },
# comment out or uncomment as needed # comment out or uncomment as needed

View file

@ -6,7 +6,7 @@ use lib $ENV{GL_BINDIR};
use Gitolite::Easy; use Gitolite::Easy;
=for usage =for usage
Usage: gitolite writes on|off <reponame>|@all Usage: gitolite writable <reponame>|@all on|off
'on' enables, 'off' disables, writes (pushes) to the named repo or all repos. 'on' enables, 'off' disables, writes (pushes) to the named repo or all repos.
@ -16,11 +16,10 @@ from STDIN; this allows longer messages.
=cut =cut
usage() if not @ARGV or @ARGV < 2 or $ARGV[0] eq '-h'; usage() if not @ARGV or @ARGV < 2 or $ARGV[0] eq '-h';
usage() if $ARGV[1] ne 'on' and $ARGV[1] ne 'off';
usage() if $ARGV[0] ne 'on' and $ARGV[0] ne 'off';
my $on = ( shift eq 'on' );
my $repo = shift; my $repo = shift;
my $on = ( shift eq 'on' );
if ( $repo eq '@all' ) { if ( $repo eq '@all' ) {
die "you are not authorized\n" if $ENV{GL_USER} and not is_admin(); die "you are not authorized\n" if $ENV{GL_USER} and not is_admin();

2
t/glt
View file

@ -14,7 +14,7 @@ my %extcmds = (
info => 1, info => 1,
desc => 1, desc => 1,
perms => 1, perms => 1,
writes => 1, writable => 1,
); );
$ENV{G3T_USER} = $user; $ENV{G3T_USER} = $user;

View file

@ -8,7 +8,7 @@ use Gitolite::Test;
use Cwd; use Cwd;
my $workdir = getcwd(); my $workdir = getcwd();
# 'gitolite writes' command # 'gitolite writable' command
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
my $sf = ".gitolite.down"; my $sf = ".gitolite.down";
@ -48,7 +48,7 @@ try "
PUSH u2 master; ok; PUSH u2 master; ok;
# disable site with some message # disable site with some message
gitolite writes off \@all testing site-wide disable; ok gitolite writable \@all off testing site-wide disable; ok
# try push foo and see fail + message # try push foo and see fail + message
cd ../foo; ok cd ../foo; ok
@ -67,7 +67,7 @@ try "
cd u4; ok cd u4; ok
# enable site # enable site
gitolite writes on \@all; ok gitolite writable \@all on; ok
# try same 3 again # try same 3 again
@ -88,7 +88,7 @@ try "
cd u6; ok cd u6; ok
# disable just foo # disable just foo
gitolite writes off foo foo down gitolite writable foo off foo down
# try push foo and see the message # try push foo and see the message
cd ../foo; ok cd ../foo; ok
@ -101,8 +101,8 @@ try "
PUSH u2; ok; /master -> master/ PUSH u2; ok; /master -> master/
# enable foo, disable bar/u2 # enable foo, disable bar/u2
gitolite writes on foo gitolite writable foo on
gitolite writes off bar/u2 the bar is closed gitolite writable bar/u2 off the bar is closed
# try both # try both
cd ../foo; ok cd ../foo; ok