perlancar > Git-Bunch > gitbunch

Download:
Git-Bunch-0.44.tar.gz

Annotate this POD

Website

CPAN RT

Open  0
View/Report Bugs
Source  

NAME ^

gitbunch - Manage gitbunch directory (directory which contain git repos)

VERSION ^

This document describes version 0.44 of gitbunch (from Perl distribution Git-Bunch), released on 2015-01-22.

DESCRIPTION ^

See Git::Bunch for more documentation.

SYNOPSIS ^

Usage:

 % gitbunch check [options] <source>
 % gitbunch exec [options] <source> <command> ...
 % gitbunch sync [options] <source> <target>

SUBCOMMANDS ^

check

Check status of git repositories inside gitbunch directory.

Will perform a 'git status' for each git repositories inside the bunch and report which repositories are clean/unclean.

Will die if can't chdir into bunch or git repository.

exec

Execute a command for each repo in the bunch.

For each git repository in the bunch, will chdir to it and execute specified command.

sync

Synchronize bunch to another bunch.

For each git repository in the bunch, will perform a 'git pull/push' for each branch. If repository in destination doesn't exist, it will be rsync-ed first from source. When 'git pull' fails, will exit to let you fix the problem manually.

For all other non-git repos, will simply synchronize by one-way rsync.

OPTIONS ^

* marks required options.

Common options

--config-path=s

{en_US Set path to configuration file}.

Can be specified multiple times.

--config-profile=s

{en_US Set configuration profile to use}.

--debug

{en_US Set log level to debug}.

--format=s

{en_US Choose output format, e.g. json, text}.

--help, -h, -?

{en_US Display this help message}.

--json

{en_US Set output format to json}.

--log-level=s

{en_US Set log level}.

--naked-res

{en_US When outputing as JSON, strip result envelope}.

{en_US By default, when outputing as JSON, the full enveloped result is returned, e.g.:

    [200,"OK",[1,2,3],{"func.extra"=>4}]

The reason is so you can get the status (1st element), status message (2nd element) as well as result metadata/extra result (4th element) instead of just the result (3rd element). However, sometimes you want just the result, e.g. when you want to pipe the result for more post-processing. In this case you can use `--naked-res` so you just get:

    [1,2,3]
}
--no-config

{en_US Do not use any configuration file}.

--quiet

{en_US Set log level to quiet}.

--subcommands

{en_US List available subcommands}.

--trace

{en_US Set log level to trace}.

--verbose

{en_US Set log level to info}.

--version, -v

Options for subcommand check

--exclude-files

{en_US Exclude files from processing}.

{en_US This only applies to `sync_bunch` operations. Operations like `check_bunch` and `exec_bunch` already ignore these and only operate on git repos. }

--exclude-non-git-dirs

{en_US Exclude non-git dirs from processing}.

{en_US This only applies to and `sync_bunch` operations. Operations like `check_bunch` and `exec_bunch` already ignore these and only operate on git repos. }

--exclude-repos-json=s

{en_US Exclude some repos from processing} (JSON-encoded).

See --exclude-repos.

--exclude-repos-pat=s

{en_US Specify regex pattern of repos to exclude}.

--exclude-repos=s@

{en_US Exclude some repos from processing}.

Can be specified multiple times.

--include-files

{en_US Alias for --no-exclude-files}.

See --exclude-files.

--include-non-git-dirs

{en_US Alias for --no-exclude-non-git-dirs}.

See --exclude-non-git-dirs.

--include-repos-json=s

{en_US Specific git repos to sync, if not specified all repos in the bunch will be processed} (JSON-encoded).

See --include-repos.

--include-repos-pat=s

{en_US Specify regex pattern of repos to include}.

--include-repos=s@

{en_US Specific git repos to sync, if not specified all repos in the bunch will be processed}.

Can be specified multiple times.

--repo=s

{en_US Only process a single repo}.

--sort=s

{en_US Order entries in bunch}.

Default value:

 "-commit-timestamp"

Valid values:

 ["name", "-name", "mtime", "-mtime", "rand", "commit-timestamp", "-commit-timestamp"]

{en_US `commit-timestamp` (and `-commit-timestamp`) compares the timestamp of `.git/commit-timestamp` file in each repo. Repos or dirs not having this file will be processed later. You can touch these `.git/commit-timestamp` files in your post-commit script, for example. This allows sorting recently committed repos more cheaply (compared to doing `git log -1`). }

--source=s*

{en_US Directory to check}.

Options for subcommand exec

--command=s*

{en_US Command to execute}.

--exclude-files

{en_US Exclude files from processing}.

{en_US This only applies to `sync_bunch` operations. Operations like `check_bunch` and `exec_bunch` already ignore these and only operate on git repos. }

--exclude-non-git-dirs

{en_US Exclude non-git dirs from processing}.

{en_US This only applies to and `sync_bunch` operations. Operations like `check_bunch` and `exec_bunch` already ignore these and only operate on git repos. }

--exclude-repos-json=s

{en_US Exclude some repos from processing} (JSON-encoded).

See --exclude-repos.

--exclude-repos-pat=s

{en_US Specify regex pattern of repos to exclude}.

--exclude-repos=s@

{en_US Exclude some repos from processing}.

Can be specified multiple times.

--include-files

{en_US Alias for --no-exclude-files}.

See --exclude-files.

--include-non-git-dirs

{en_US Alias for --no-exclude-non-git-dirs}.

See --exclude-non-git-dirs.

--include-repos-json=s

{en_US Specific git repos to sync, if not specified all repos in the bunch will be processed} (JSON-encoded).

See --include-repos.

--include-repos-pat=s

{en_US Specify regex pattern of repos to include}.

--include-repos=s@

{en_US Specific git repos to sync, if not specified all repos in the bunch will be processed}.

Can be specified multiple times.

--repo=s

{en_US Only process a single repo}.

--sort=s

{en_US Order entries in bunch}.

Default value:

 "-commit-timestamp"

Valid values:

 ["name", "-name", "mtime", "-mtime", "rand", "commit-timestamp", "-commit-timestamp"]

{en_US `commit-timestamp` (and `-commit-timestamp`) compares the timestamp of `.git/commit-timestamp` file in each repo. Repos or dirs not having this file will be processed later. You can touch these `.git/commit-timestamp` files in your post-commit script, for example. This allows sorting recently committed repos more cheaply (compared to doing `git log -1`). }

--source=s*

{en_US Directory to check}.

Options for subcommand sync

--backup

{en_US Whether doing backup to target}.

{en_US This setting lets you express that you want to perform synchronizing to a backup target, and that you do not do work on the target. Thus, you do not care about uncommitted or untracked files/dirs in the target repos (might happen if you also do periodic copying of repos to backup using cp/rsync). When this setting is turned on, the function will first do a `git clean -f -d` (to delete untracked files/dirs) and then `git checkout .` (to discard all uncommitted changes). This setting will also implicitly turn on `create_bare` setting (unless that setting has been explicitly enabled/disabled). }

--create-bare-target, --use-bare

{en_US Whether to create bare git repo when target does not exist}.

{en_US When target repo does not exist, gitbunch can either copy the source repo using `rsync` (the default, if this setting is undefined), or it can create target repo with `git init --bare` (if this setting is set to 1), or it can create target repo with `git init` (if this setting is set to 0).

Bare git repositories contain only contents of the .git folder inside the directory and no working copies of your source files.

Creating bare repos are apt for backup purposes since they are more space-efficient.

Non-repos will still be copied/rsync-ed. }

--delete-branch

{en_US Whether to delete branches in dest repos not existing in source repos}.

--exclude-files

{en_US Exclude files from processing}.

{en_US This only applies to `sync_bunch` operations. Operations like `check_bunch` and `exec_bunch` already ignore these and only operate on git repos. }

--exclude-non-git-dirs

{en_US Exclude non-git dirs from processing}.

{en_US This only applies to and `sync_bunch` operations. Operations like `check_bunch` and `exec_bunch` already ignore these and only operate on git repos. }

--exclude-repos-json=s

{en_US Exclude some repos from processing} (JSON-encoded).

See --exclude-repos.

--exclude-repos-pat=s

{en_US Specify regex pattern of repos to exclude}.

--exclude-repos=s@

{en_US Exclude some repos from processing}.

Can be specified multiple times.

--include-files

{en_US Alias for --no-exclude-files}.

See --exclude-files.

--include-non-git-dirs

{en_US Alias for --no-exclude-non-git-dirs}.

See --exclude-non-git-dirs.

--include-repos-json=s

{en_US Specific git repos to sync, if not specified all repos in the bunch will be processed} (JSON-encoded).

See --include-repos.

--include-repos-pat=s

{en_US Specify regex pattern of repos to include}.

--include-repos=s@

{en_US Specific git repos to sync, if not specified all repos in the bunch will be processed}.

Can be specified multiple times.

--repo=s

{en_US Only process a single repo}.

--rsync-opt-maintain-ownership

{en_US Whether or not, when rsync-ing from source, we use -a (= -rlptgoD) or -rlptD (-a minus -go)}.

{en_US Sometimes using -a results in failure to preserve permission modes on sshfs-mounted filesystem, while -rlptD succeeds, so by default we don't maintain ownership. If you need to maintain ownership (e.g. you run as root and the repos are not owned by root), turn this option on. }

--sort=s

{en_US Order entries in bunch}.

Default value:

 "-commit-timestamp"

Valid values:

 ["name", "-name", "mtime", "-mtime", "rand", "commit-timestamp", "-commit-timestamp"]

{en_US `commit-timestamp` (and `-commit-timestamp`) compares the timestamp of `.git/commit-timestamp` file in each repo. Repos or dirs not having this file will be processed later. You can touch these `.git/commit-timestamp` files in your post-commit script, for example. This allows sorting recently committed repos more cheaply (compared to doing `git log -1`). }

--source=s*

{en_US Directory to check}.

--target=s*

{en_US Destination bunch}.

ENVIRONMENT ^

GITBUNCH_OPT

FILES ^

~/gitbunch.conf

/etc/gitbunch.conf

FAQ ^

How to see more verbose/debugging output?

gitbunch uses Log::Any::App. You can customize logging levels using a variety of ways, e.g. environment variable:

 % TRACE=1 gitbunch ...

By default it also writes log to ~/gitbunch.log. You can disable this using:

 % FILE_LOG_LEVEL=off gitbunch ...

Or you can customize the level using:

 % FILE_QUIET=1 gitbunch ...

See the documentation for Log::Any::App for more details.

COMPLETION ^

This script has shell tab completion capability with support for several shells.

bash

To activate bash completion for this script, put:

 complete -C gitbunch gitbunch

in your bash startup (e.g. ~/.bashrc). Your next shell session will then recognize tab completion for the command. Or, you can also directly execute the line above in your shell to activate immediately.

It is recommended, however, that you install shcompgen which allows you to activate completion scripts for several kinds of scripts on multiple shells. Some CPAN distributions (those that are built with Dist::Zilla::Plugin::GenShellCompletion) will even automatically enable shell completion for their included scripts (using shcompgen) at installation time, so you can immadiately have tab completion.

tcsh

To activate tcsh completion for this script, put:

 complete gitbunch 'p/*/`gitbunch`/'

in your tcsh startup (e.g. ~/.tcshrc). Your next shell session will then recognize tab completion for the command. Or, you can also directly execute the line above in your shell to activate immediately.

It is also recommended to install shcompgen (see above).

other shells

For fish and zsh, install shcompgen as described above.

HOMEPAGE ^

Please visit the project's homepage at https://metacpan.org/release/Git-Bunch.

SOURCE ^

Source repository is at https://github.com/perlancar/perl-Git-Bunch.

BUGS ^

Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Git-Bunch

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

AUTHOR ^

perlancar <perlancar@cpan.org>

COPYRIGHT AND LICENSE ^

This software is copyright (c) 2015 by perlancar@cpan.org.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

syntax highlighting: