[Bps-public-commit] r14953 - in Prophet/trunk: .
sartak at bestpractical.com
sartak at bestpractical.com
Sat Aug 9 15:09:53 EDT 2008
Author: sartak
Date: Sat Aug 9 15:09:29 2008
New Revision: 14953
Modified:
Prophet/trunk/ (props changed)
Prophet/trunk/lib/Prophet/CLI/Command/Merge.pm
Log:
r69022 at onn: sartak | 2008-08-09 15:09:05 -0400
Report how many changesets were merged
Modified: Prophet/trunk/lib/Prophet/CLI/Command/Merge.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/CLI/Command/Merge.pm (original)
+++ Prophet/trunk/lib/Prophet/CLI/Command/Merge.pm Sat Aug 9 15:09:29 2008
@@ -27,9 +27,17 @@
force => $self->has_arg('force'),
);
- $self->_do_merge( $source, $target );
+ my $changesets = $self->_do_merge( $source, $target );
- print "Merge complete.\n";
+ if ($changesets == 0) {
+ print "No new changesets.\n";
+ }
+ elsif ($changesets == 1) {
+ print "Merged one changeset.\n";
+ }
+ else {
+ print "Merged $changesets changesets.\n";
+ }
}
=head2 _do_merge $source $target
@@ -45,6 +53,8 @@
always prefer changesets from one replica or the other), or by
using a default resolver.
+Returns the number of changesets merged.
+
=cut
sub _do_merge {
@@ -82,17 +92,21 @@
$import_args{resolver_class} = $resolver
if $resolver;
- if ($self->has_arg('verbose')) {
- $import_args{reporting_callback} = sub {
- my %args = @_;
- my $changeset = $args{changeset};
- print $changeset->as_string;
- };
- }
+ my $changesets = 0;
+ my $verbose = $self->has_arg('verbose');
+
+ $import_args{reporting_callback} = sub {
+ my %args = @_;
+ my $changeset = $args{changeset};
+ print $changeset->as_string if $verbose;
+ $changesets++;
+ };
$target->import_changesets(
%import_args,
);
+
+ return $changesets;
}
__PACKAGE__->meta->make_immutable;
More information about the Bps-public-commit
mailing list