diff options
author | Sitaram Chamarty <sitaramc@gmail.com> | 2018-07-21 05:26:14 +0530 |
---|---|---|
committer | Sitaram Chamarty <sitaramc@gmail.com> | 2018-07-22 04:16:29 +0530 |
commit | 4bc9705d6c2a46298438e1b6f9c8bdc5792ee5ab (patch) | |
tree | 61d6370982e5157902786577f86e46b2b659af14 | |
parent | autoflush stdout... (diff) | |
download | gitolite-gentoo-4bc9705d6c2a46298438e1b6f9c8bdc5792ee5ab.tar.gz gitolite-gentoo-4bc9705d6c2a46298438e1b6f9c8bdc5792ee5ab.tar.bz2 gitolite-gentoo-4bc9705d6c2a46298438e1b6f9c8bdc5792ee5ab.zip |
'info' learns '-p' option to show only physical repos
While we were meaninglessly debating (on the mailing list) the merits of
showing the wild repo regexes to a *human*, someone came up with a
reasonable need for an option to *not* show them so that certain
automated tasks can be a wee bit simpler. Note that I still think the
regexes *should* be shown to the user by default; we're just adding an
option to explicitly suppress them.
15:31:59 <hiroki> sitaram: Thanks ! The most common use case would be
for a sanity check script running on slaves that will check what
repositories it has locally, and compare it with the output of info
to their master. That way they can be certain all repositories are
synced over properly. Second step would be to check all commit
hashes of all repositories locally and their respective master.
-rwxr-xr-x | src/commands/info | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/commands/info b/src/commands/info index 5079cfa..b88e288 100755 --- a/src/commands/info +++ b/src/commands/info @@ -12,12 +12,13 @@ use Gitolite::Conf::Load; =for args Usage: gitolite info [-lc] [-ld] [-json] [<repo name pattern>] -List all existing repos you can access, as well as repo name patterns you can -create repos from (if any). +List all existing repos you can access, as well as repo name patterns (see +"wild repos") you have any kind of access to. '-lc' lists creators as an additional field at the end. '-ld' lists description as an additional field at the end. '-json' produce JSON output instead of normal output + '-p' limits output to physical repos only (no wild repo regexes!) The optional pattern is an unanchored regex that will limit the repos searched, in both cases. It might speed up things a little if you have more @@ -25,7 +26,7 @@ than a few thousand repos. =cut # these are globals -my ( $lc, $ld, $json, $patt ) = args(); +my ( $lc, $ld, $json, $p, $patt ) = args(); my %out; # holds info to be json'd $ENV{GL_USER} or _die "GL_USER not set"; @@ -35,8 +36,8 @@ if ($json) { print greeting(); } -print_patterns(); # repos he can create for himself -print_phy_repos(); # repos already created +print_patterns() unless $p; # repos he can create for himself +print_phy_repos(); # repos already created if ( $rc{SITE_INFO} ) { $json @@ -49,13 +50,14 @@ print JSON::to_json( \%out, { utf8 => 1, pretty => 1 } ) if $json; # ---------------------------------------------------------------------- sub args { - my ( $lc, $ld, $json, $patt ) = ( '', '', '', '' ); + my ( $lc, $ld, $json, $p, $patt ) = ( '', '', '', '' ); my $help = ''; GetOptions( 'lc' => \$lc, 'ld' => \$ld, 'json' => \$json, + 'p' => \$p, 'h' => \$help, ) or usage(); @@ -64,7 +66,7 @@ sub args { require JSON if $json; - return ( $lc, $ld, $json, $patt ); + return ( $lc, $ld, $json, $p, $patt ); } sub print_patterns { |