#!perl
use strict;
use warnings;

=head1 NAME

SVN::Rami - Automates merging to multiple branches

=head1 SYNOPSIS

Should be invoked from the command line:

  rami -c <version-number>

=head1 SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc SVN::Rami


You can also look for information at:

=over 4

=item * RT: CPAN's request tracker (report bugs here)

L<https://rt.cpan.org/NoAuth/Bugs.html?Dist=SVN-Rami>

=item * CPAN Ratings

L<https://cpanratings.perl.org/d/SVN-Rami>

=item * Search CPAN

L<https://metacpan.org/release/SVN-Rami>

=back

=head1 SEE ALSO

SVK::Merge

=head1 LICENSE AND COPYRIGHT

This software is copyright (c) 2023 by Dan Richter.

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


=cut

package rami;



# PODNAME: rami
# ABSTRACT: automate merging to an arbitrary number of branches

# To invoke this script from the dev environment, use:
#   perl -Ilib script\rami
# For example:
#   perl -Ilib script\rami -c 84987 

use SVN::Rami;

# TODO: parse equals sign: --load-repo-config-from-svn-url=http://...
my $load_config_from_SVN_arg = '--load-repo-config-from-svn-url';

my $command = shift;   # Usually this is '-c'
my $source_revision = shift;
my $valid_command = ($command eq '-c' or $command eq $load_config_from_SVN_arg);
if ( not $source_revision or not $valid_command ) {
	print "Usage: $0 -c <revision_number>\n";
	print "or: $0 $load_config_from_SVN_arg <SVN-URL>\n";
	exit 1;
}

if ($command eq $load_config_from_SVN_arg) {
	SVN::Rami::load_config_from_SVN_url($source_revision);
} else {
	# The usual case.
	SVN::Rami::rami_main($source_revision);
}
