diff --git a/Gitolite/Conf/Load.pm b/Gitolite/Conf/Load.pm index c9b09b5..130850a 100644 --- a/Gitolite/Conf/Load.pm +++ b/Gitolite/Conf/Load.pm @@ -9,6 +9,7 @@ package Gitolite::Conf::Load; list_groups list_users + list_repos ); use Exporter 'import'; @@ -178,7 +179,13 @@ sub data_version_mismatch { # list all 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(); @@ -193,7 +200,14 @@ sub list_users { my $count = 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(); @@ -209,6 +223,25 @@ sub list_users { 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)); +} + # ---------------------------------------------------------------------- { diff --git a/gitolite b/gitolite index fb835e2..6adc347 100755 --- a/gitolite +++ b/gitolite @@ -12,7 +12,8 @@ The following subcommands are available; they should all respond to '-h': compile compile gitolite.conf query-rc get values of rc variables 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: - 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; Gitolite::Conf::Load->import; 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() } ); } }