'gitolite list-repos' added, plus some usage message changes

This commit is contained in:
Sitaram Chamarty 2012-03-08 16:14:13 +05:30
parent d88cdbefd6
commit 4e81d3cfed
2 changed files with 42 additions and 3 deletions

View file

@ -9,6 +9,7 @@ package Gitolite::Conf::Load;
list_groups list_groups
list_users list_users
list_repos
); );
use Exporter 'import'; use Exporter 'import';
@ -178,7 +179,13 @@ sub data_version_mismatch {
# list all groups # list all groups
sub list_groups { sub list_groups {
die "\nUsage: gitolite list-groups\n\n(no options, no flags)\n\n" if @ARGV; die "
Usage: gitolite list-groups
- lists all group names in conf
- no options, no flags
" if @ARGV;
load_common(); load_common();
@ -193,7 +200,14 @@ sub list_users {
my $count = 0; my $count = 0;
my $total = 0; my $total = 0;
die "\nUsage: gitolite list-users\n\n - no options, no flags\n - may be slow if you have thousands of repos\n\n" if @ARGV; die "
Usage: gitolite list-users
- lists all users/user groups in conf
- no options, no flags
- WARNING: may be slow if you have thousands of repos
" if @ARGV;
load_common(); load_common();
@ -209,6 +223,25 @@ sub list_users {
return (sort_u(\@u)); return (sort_u(\@u));
} }
sub list_repos {
die "
Usage: gitolite list-repos
- lists all repos/repo groups in conf
- no options, no flags
" if @ARGV;
load_common();
my @r = keys %repos;
push @r, keys %split_conf;
return (sort_u(\@r));
}
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
{ {

View file

@ -12,7 +12,8 @@ The following subcommands are available; they should all respond to '-h':
compile compile gitolite.conf compile compile gitolite.conf
query-rc get values of rc variables query-rc get values of rc variables
list-groups list all group names in conf list-groups list all group names in conf
list-users list all user names in conf list-users list all users/user groups in conf
list-repos list all repos/repo groups in conf
Warnings: 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 thousands of repos
@ -65,5 +66,10 @@ sub args {
require Gitolite::Conf::Load; require Gitolite::Conf::Load;
Gitolite::Conf::Load->import; Gitolite::Conf::Load->import;
print "$_\n" for ( @{ list_users() } ); print "$_\n" for ( @{ list_users() } );
} elsif ( $command eq 'list-repos' ) {
shift @ARGV;
require Gitolite::Conf::Load;
Gitolite::Conf::Load->import;
print "$_\n" for ( @{ list_repos() } );
} }
} }