'gitolite list-memberships' added
This commit is contained in:
parent
4e81d3cfed
commit
c9826eee07
|
@ -10,6 +10,7 @@ package Gitolite::Conf::Load;
|
|||
list_groups
|
||||
list_users
|
||||
list_repos
|
||||
list_memberships
|
||||
);
|
||||
|
||||
use Exporter 'import';
|
||||
|
@ -242,6 +243,23 @@ Usage: gitolite list-repos
|
|||
return (sort_u(\@r));
|
||||
}
|
||||
|
||||
sub list_memberships {
|
||||
|
||||
die "
|
||||
Usage: gitolite list-memberships <name>
|
||||
|
||||
- list all groups a name is a member of
|
||||
- takes one user/repo name
|
||||
|
||||
" if @ARGV and $ARGV[0] eq '-h' or not @ARGV and not @_;
|
||||
|
||||
my $name = ( @_ ? shift @_ : shift @ARGV );
|
||||
|
||||
load_common();
|
||||
my @m = memberships($name);
|
||||
return (sort_u(\@m));
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
{
|
||||
|
|
10
gitolite
10
gitolite
|
@ -14,9 +14,12 @@ The following subcommands are available; they should all respond to '-h':
|
|||
list-groups list all group names in conf
|
||||
list-users list all users/user groups in conf
|
||||
list-repos list all repos/repo groups in conf
|
||||
list-memberships list all groups a name is a member of
|
||||
|
||||
Warnings:
|
||||
- list-users is disk bound and could take a while on sites with thousands of repos
|
||||
- list-users is disk bound and could take a while on sites with 1000s of repos
|
||||
- list-memberships does not check if the name is known; unknown names come
|
||||
back with 2 answers: the name itself and '@all'
|
||||
=cut
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
|
@ -71,5 +74,10 @@ sub args {
|
|||
require Gitolite::Conf::Load;
|
||||
Gitolite::Conf::Load->import;
|
||||
print "$_\n" for ( @{ list_repos() } );
|
||||
} elsif ( $command eq 'list-memberships' ) {
|
||||
shift @ARGV;
|
||||
require Gitolite::Conf::Load;
|
||||
Gitolite::Conf::Load->import;
|
||||
print "$_\n" for ( @{ list_memberships() } );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue