Git-Annex
view release on metacpan or search on metacpan
lib/App/annex_to_annex.pm view on Meta::CPAN
use Try::Tiny;
use Git::Annex;
my $exit_main = 0;
CORE::exit main unless caller;
sub main {
shift if $_[0] and ref $_[0] eq ""; # in case main called as a class method
local @ARGV = @{ $_[0] } if $_[0] and ref $_[0] ne "";
# only support v7 because supporting v5 too would make things quite
# complex. require git-annex >=7.20191009 because it will refuse to
# work in v5 repos, and because it supports `git annex find --unlocked`
chomp(my %annex_version_fields = map { split ': ' } `git annex version`);
die "I need git-annex >=7.20191009 and a v7 repository\n"
unless $annex_version_fields{'git-annex version'} >= 7.20191009;
die "need at least two arguments\n" unless @ARGV > 1;
my $dest = rel2abs pop @ARGV;
lib/App/annex_to_annex_reinject.pm view on Meta::CPAN
use File::Spec::Functions qw(rel2abs);
use File::Find;
use Try::Tiny;
use File::Temp qw(tempdir);
exit main() unless caller;
sub main {
shift if $_[0] and ref $_[0] eq ""; # in case main called as a class method
local @ARGV = @{ $_[0] } if $_[0] and ref $_[0] ne "";
die "usage: annex-to-annex-reinject SOURCEANNEX DESTANNEX\n"
unless @ARGV == 2;
my $source = Git::Annex->new($ARGV[0]);
my $dest = Git::Annex->new($ARGV[1]);
#<<<
try {
$source->git->rev_parse({ git_dir => 1 });
} catch {
lib/App/git_annex_reviewunused.pm view on Meta::CPAN
use Term::ReadKey;
use Term::ANSIColor;
my $exit_main = 0;
CORE::exit main unless caller;
sub main {
shift if $_[0] and ref $_[0] eq ""; # in case main called as a class method
local @ARGV = @{ $_[0] } if $_[0] and ref $_[0] ne "";
my $annex = Git::Annex->new;
my $just_print = 0;
my ($uuid, $from_arg, $used_refspec_arg, %unused_opts, %dropunused_args);
GetOptions
'from=s' => \$from_arg,
'used-refspec=s' => \$used_refspec_arg,
'just-print' => \$just_print;
if ($from_arg) {
t/lib/t/Util.pm view on Meta::CPAN
return ($foo_id != $bar_id);
}
sub git_annex_available {
`sh -c "command -v git-annex"`;
return !$?;
}
sub run_bin {
(my $bin = "App::" . shift) =~ tr/-/_/;
local @ARGV = @_;
my ($stdout, $stderr, $exit) = capture {
my $exit;
# in order to simulate calling the program at the command
# line, convert exceptions into what happens when an ordinary
# perl script, invoked from the command line, calls 'die'
#<<<
try {
$exit = $bin->main;
} catch {
say STDERR $_;
( run in 0.588 second using v1.01-cache-2.11-cpan-49f99fa48dc )