App-SnerpVortex

 view release on metacpan or  search on metacpan

bin/snerp  view on Meta::CPAN

#!/usr/bin/env perl

use warnings;
use strict;
use lib qw(./lib);

# Don't buffer standard output.  Buffered stdout would be faster, but
# it tends to have synchronization issues with unbuffered stderr.
use IO::Handle;
STDOUT->autoflush(1);

use Getopt::Long;

my $replayer_class = "git";
my (
	$authors_file, $replay_base, $dump_file_name, $copy_depot_path,
	$include_regexp, $analysis_db_name,
);
my $verbose = 0;
my $help = 0;
my $agree = 0;

my $getopt_okay = GetOptions(
	'analysis=s',   \$analysis_db_name,
	'authors=s',    \$authors_file,
	'copies=s',     \$copy_depot_path,
	'dump=s',       \$dump_file_name,
	'experimental', \$agree,
	'help',         \$help,
	'include=s',    \$include_regexp,
	'into=s',       \$replay_base,
	'replayer=s',   \$replayer_class,
	'verbose',      \$verbose,
);

if ($help or !$getopt_okay) {
	die(
		"$0 usage:\n",
		"  --replayer=CLASS     how to replay the svn dump file\n",
		"                          ('git' or 'filesystem' so far)\n",
		"  --authors=FILENAME   location of git-svn authors file\n",
		"                          (optional; only for git)\n",
		"  --dump=FILENAME      location of svn dump file to replay. - for STDIN\n",
		"  --into=PATH          path where the svn dump will be replayed\n",
		"                          (must not exist)\n",
		"  --copies=PATH        directory where svn copy files are stored\n",
		"                          (must not exist)\n",
		"  --verbose            explain what's happening in great detail\n",
		"  --help               you're soaking in it.\n",
		"  --experimental       enable experimental features at one's own risk\n",
		"  --include=REGEXP     limit replay to paths matching REGEXP\n",
		"  --analysis=FILENAME  path to snanalyze sqlite3 database\n",
	);
}

unless (
	defined($replayer_class) and ($replayer_class =~ /(:?git|filesystem)/i)
) {
	die "$0: --replayer=git or --replayer=filesystem required\n";
}

unless ($agree) {
	die(
		"$0:\n",
		"  This is alpha-quality experimental code.\n",
		"  Use the --experimental flag to run it at your own risk.\n",
	);
}



( run in 0.433 second using v1.01-cache-2.11-cpan-c966e8aa7e8 )